diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-07-25 09:09:14 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-07-25 09:09:14 +0000 |
commit | a30f955d286e38b570f5e2ab59d5f096213e0328 (patch) | |
tree | b03f19834adc22e5815ade6866d9e6d0c5324145 | |
parent | a90f2ca74f5effcd2dcb65e304c63a7ebe119408 (diff) | |
download | cygnal-a30f955d286e38b570f5e2ab59d5f096213e0328.tar.gz cygnal-a30f955d286e38b570f5e2ab59d5f096213e0328.tar.bz2 cygnal-a30f955d286e38b570f5e2ab59d5f096213e0328.zip |
* gcc.xml (gcc-64): Fix example.
-rw-r--r-- | winsup/doc/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/doc/gcc.xml | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog index bd4eeefa9..ab97e59a1 100644 --- a/winsup/doc/ChangeLog +++ b/winsup/doc/ChangeLog @@ -1,5 +1,9 @@ 2013-07-25 Corinna Vinschen <corinna@vinschen.de> + * gcc.xml (gcc-64): Fix example. + +2013-07-25 Corinna Vinschen <corinna@vinschen.de> + * gcc.xml (gcc-default: Rename from gcc-cons. Change title. (gcc-64): New section explaininig differences in programming for 64 bit Cygwin. diff --git a/winsup/doc/gcc.xml b/winsup/doc/gcc.xml index e15862638..7edf89f79 100644 --- a/winsup/doc/gcc.xml +++ b/winsup/doc/gcc.xml @@ -81,9 +81,10 @@ my_read (int fd, void *buffer, size_t bytes_to_read) a bad bug. The assumption that the size of ssize_t is the same as the size of DWORD is wrong for 64 bit. In fact, since <function>sizeof(ssize_t)</function> is 8, <function>ReadFile</function> -will write the number of read bytes into the upper 4 bytes of the variable -<literal>bytes_read</literal>. <function>my_read</function> will -return the wrong number of read bytes to the caller.</para> +will write the number of read bytes into the lower 4 bytes of the variable +<literal>bytes_read</literal>, while the upper 4 bytes will contain an +undefined value. <function>my_read</function> will very likely return the +wrong number of read bytes to the caller.</para> <para>Here's the fixed version of <function>my_read</function>:</para> @@ -97,7 +98,7 @@ my_read (int fd, void *buffer, size_t bytes_to_read) DWORD bytes_read; if (ReadFile (fh, buffer, bytes_to_read, &bytes_read, NULL)) - return bytes_read; + return (ssize_t) bytes_read; set_errno_from_get_last_error (); return -1; } |