apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r381936 - /apr/apr/trunk/file_io/win32/readwrite.c
Date Wed, 01 Mar 2006 07:03:14 GMT
Author: wrowe
Date: Tue Feb 28 23:03:13 2006
New Revision: 381936

URL: http://svn.apache.org/viewcvs?rev=381936&view=rev
Log:

  This patch needs additional pairs of eyeballs before considering
  for backport.  We bucket the bytecount results from ReadFile and
  GetOverlappedResult into a true DWORD buffer, and then pass that
  value across to the apr_size_t *nbytes argument, which on Win64
  is a quadword.  Please vote for correctness.

Modified:
    apr/apr/trunk/file_io/win32/readwrite.c

Modified: apr/apr/trunk/file_io/win32/readwrite.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/win32/readwrite.c?rev=381936&r1=381935&r2=381936&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/readwrite.c (original)
+++ apr/apr/trunk/file_io/win32/readwrite.c Tue Feb 28 23:03:13 2006
@@ -32,7 +32,7 @@
 {
     apr_status_t rv;
     DWORD len = (DWORD)len_in;
-    *nbytes = 0;
+    DWORD bytesread = 0;
 
     /* Handle the zero timeout non-blocking case */
     if (file->timeout == 0) {
@@ -46,10 +46,12 @@
                 if (rv == APR_FROM_OS_ERROR(ERROR_BROKEN_PIPE)) {
                     rv = APR_EOF;
                 }
+                *nbytes = 0;
                 return rv;
             }
             else {
                 if (bytes == 0) {
+                    *nbytes = 0;
                     return APR_EAGAIN;
                 }
                 if (len > bytes) {
@@ -70,8 +72,9 @@
         file->pOverlapped->OffsetHigh = (DWORD)(file->filePtr >> 32);
     }
 
-    *nbytes = 0;
-    rv = ReadFile(file->filehand, buf, len, nbytes, file->pOverlapped);
+    rv = ReadFile(file->filehand, buf, len, 
+                  &bytesread, file->pOverlapped);
+    *nbytes = bytesread;
 
     if (!rv) {
         rv = apr_get_os_error();
@@ -88,7 +91,7 @@
             switch (rv) {
                 case WAIT_OBJECT_0:
                     GetOverlappedResult(file->filehand, file->pOverlapped, 
-                                        nbytes, TRUE);
+                                        &bytesread, TRUE);
                     rv = APR_SUCCESS;
                     break;
 
@@ -332,7 +335,9 @@
                 rv = WaitForSingleObject(thefile->pOverlapped->hEvent, timeout_ms);
                 switch (rv) {
                     case WAIT_OBJECT_0:
-                        GetOverlappedResult(thefile->filehand, thefile->pOverlapped,
nbytes, TRUE);
+                        GetOverlappedResult(thefile->filehand, thefile->pOverlapped,

+                                            &bwrote, TRUE);
+                        *nbytes = bwrote;
                         rv = APR_SUCCESS;
                         break;
                     case WAIT_TIMEOUT:



Mime
View raw message