Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-12-14 07:01:32 +0300
committerChristopher Faylor <me@cgf.cx>2002-12-14 07:01:32 +0300
commit8bce0d723c50924b908dca1467037c8008e872be (patch)
treedcaf982175c090c0e7668af5fa00dac09fb07b27 /winsup/cygwin/fhandler_clipboard.cc
parentec085641a9b4d25e16df12d7449f7ad689934117 (diff)
Throughout, change fhandler_*::read and fhandler_*::raw_read to void functions
whose second arguments are both the lenght and the return value. * fhandler.cc (fhandler_base::read): Rework slightly to use second argument as input/output. Tweak CRLF stuff. (fhandler_base::readv): Accommodate fhandler_*::read changes. * cygthread.h (cygthread::detach): Declare as taking optional handle argument. (cygthread::detach): When given a handle argument, wait for the handle to be signalled before waiting for thread to detach. Return true when signal detected.
Diffstat (limited to 'winsup/cygwin/fhandler_clipboard.cc')
-rw-r--r--winsup/cygwin/fhandler_clipboard.cc39
1 files changed, 18 insertions, 21 deletions
diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc
index aeb5933dc..9cf1b287d 100644
--- a/winsup/cygwin/fhandler_clipboard.cc
+++ b/winsup/cygwin/fhandler_clipboard.cc
@@ -185,19 +185,30 @@ fhandler_dev_clipboard::write (const void *buf, size_t len)
}
}
-int __stdcall
-fhandler_dev_clipboard::read (void *ptr, size_t len)
+void __stdcall
+fhandler_dev_clipboard::read (void *ptr, size_t& len)
{
HGLOBAL hglb;
size_t ret;
UINT formatlist[2];
UINT format;
- if (!eof)
+ if (eof)
+ len = 0;
+ else
{
formatlist[0] = cygnativeformat;
formatlist[1] = current_codepage == ansi_cp ? CF_TEXT : CF_OEMTEXT;
OpenClipboard (0);
- if ((format = GetPriorityClipboardFormat (formatlist, 2)) > 0)
+ if ((format = GetPriorityClipboardFormat (formatlist, 2)) <= 0)
+ {
+ CloseClipboard ();
+#if 0
+ system_printf ("a non-accepted format! %d", format);
+#endif
+ set_errno (0);
+ len = 0;
+ }
+ else
{
hglb = GetClipboardData (format);
if (format == cygnativeformat)
@@ -216,9 +227,8 @@ fhandler_dev_clipboard::read (void *ptr, size_t len)
LPSTR lpstr;
lpstr = (LPSTR) GlobalLock (hglb);
- ret =
- ((len > (strlen (lpstr) - pos)) ? (strlen (lpstr) - pos) :
- len);
+ ret = ((len > (strlen (lpstr) - pos)) ? (strlen (lpstr) - pos)
+ : len);
memcpy (ptr, lpstr + pos, ret);
//ret = snprintf((char *) ptr, len, "%s", lpstr);//+pos);
@@ -229,22 +239,9 @@ fhandler_dev_clipboard::read (void *ptr, size_t len)
}
CloseClipboard ();
set_errno (0);
- return ret;
- }
- else
- {
- CloseClipboard ();
-#if 0
- system_printf ("a non-accepted format! %d", format);
-#endif
- set_errno (0);
- return 0;
+ len = ret;
}
}
- else
- {
- return 0;
- }
}
__off64_t