apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Havard" <bri...@kheldar.apana.org.au>
Subject Re: cvs commit: apr/file_io/win32 readwrite.c seek.c
Date Tue, 28 Aug 2001 15:14:23 GMT
On 28 Aug 2001 01:56:09 -0000, wrowe@apache.org wrote:

>wrowe       01/08/27 18:56:09
>
>  Modified:    file_io/win32 readwrite.c seek.c
>  Log:
>    Found a very ugly reaction to using apr_file_seek(APR_CUR, -value) in
>    conjuction with buffered reads.  Thank you for toggling that case Jeff,
>    so I could shoot out this bug ;)

Did this actually fix things for you? You see the new offset calculation in 
the buffered seek is wrong (my fault). I've only tested on OS/2 but it should 
apply equally to all platforms. The fix is:

Index: os2/seek.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/seek.c,v
retrieving revision 1.18
diff -u -r1.18 seek.c
--- seek.c	2001/08/21 12:09:50	1.18
+++ seek.c	2001/08/28 15:08:37
@@ -111,7 +111,7 @@
             break;
         }
 
-        *offset = thefile->filePtr + thefile->bufpos;
+        *offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
         return rc;
     } else {
         switch (where) {
Index: unix/seek.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/seek.c,v
retrieving revision 1.23
diff -u -r1.23 seek.c
--- seek.c	2001/08/22 15:40:29	1.23
+++ seek.c	2001/08/28 15:08:37
@@ -110,7 +110,7 @@
             break;
         }
 
-        *offset = thefile->filePtr + thefile->bufpos;
+        *offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
         return rc;
     } else {
 
Index: win32/seek.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/seek.c,v
retrieving revision 1.19
diff -u -r1.19 seek.c
--- seek.c	2001/07/31 19:51:34	1.19
+++ seek.c	2001/08/28 15:08:37
@@ -115,7 +115,7 @@
                 return APR_EINVAL;
         }
 
-        *offset = thefile->filePtr + thefile->bufpos;
+        *offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
         return rc;
     } 
     else if (thefile->pOverlapped) {

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Mime
View raw message