apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/test testfile.c
Date Tue, 04 May 2004 00:07:33 GMT
trawick     2004/05/03 17:07:33

  Modified:    .        CHANGES
               file_io/os2 seek.c
               file_io/unix seek.c
               file_io/win32 seek.c
               test     testfile.c
  Log:
  Fix sign error in apr_file_seek().
  
  Submitted by:	Greg Hudson <ghudson MIT.EDU>
  Reviewed by:	Jeff Trawick
  
  Revision  Changes    Path
  1.464     +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.463
  retrieving revision 1.464
  diff -u -r1.463 -r1.464
  --- CHANGES	21 Apr 2004 21:11:21 -0000	1.463
  +++ CHANGES	4 May 2004 00:07:32 -0000	1.464
  @@ -7,6 +7,9 @@
   
   Changes with APR 1.0
   
  +  *) Fix sign error in apr_file_seek(APR_END).
  +     [Greg Hudson <ghudson MIT.EDU>]
  +
     *) Support setuid, setgid and sticky file permissions bits on Unix.
        [André Malo]
   
  
  
  
  1.27      +1 -1      apr/file_io/os2/seek.c
  
  Index: seek.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/seek.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- seek.c	13 Feb 2004 09:38:24 -0000	1.26
  +++ seek.c	4 May 2004 00:07:32 -0000	1.27
  @@ -70,7 +70,7 @@
           case APR_END:
               rc = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile);
               if (rc == APR_SUCCESS)
  -                rc = setptr(thefile, finfo.size - *offset);
  +                rc = setptr(thefile, finfo.size + *offset);
               break;
           }
   
  
  
  
  1.35      +1 -1      apr/file_io/unix/seek.c
  
  Index: seek.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/seek.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- seek.c	27 Mar 2004 13:11:17 -0000	1.34
  +++ seek.c	4 May 2004 00:07:32 -0000	1.35
  @@ -69,7 +69,7 @@
           case APR_END:
               rc = apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile);
               if (rc == APR_SUCCESS)
  -                rc = setptr(thefile, finfo.size - *offset);
  +                rc = setptr(thefile, finfo.size + *offset);
               break;
           }
   
  
  
  
  1.29      +1 -1      apr/file_io/win32/seek.c
  
  Index: seek.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/seek.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- seek.c	13 Feb 2004 09:38:27 -0000	1.28
  +++ seek.c	4 May 2004 00:07:32 -0000	1.29
  @@ -73,7 +73,7 @@
               case APR_END:
                   rc = apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile);
                   if (rc == APR_SUCCESS)
  -                    rc = setptr(thefile, finfo.size - *offset);
  +                    rc = setptr(thefile, finfo.size + *offset);
                   break;
   
               default:
  
  
  
  1.73      +21 -0     apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfile.c,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- testfile.c	13 Feb 2004 09:38:34 -0000	1.72
  +++ testfile.c	4 May 2004 00:07:32 -0000	1.73
  @@ -228,6 +228,27 @@
       CuAssertStrEquals(tc, TESTSTR + 5, str);
   
       apr_file_close(filetest);
  +
  +    /* Test for regression of sign error bug with SEEK_END and
  +       buffered files. */
  +    rv = apr_file_open(&filetest, FILENAME,
  +                       APR_READ | APR_BUFFERED,
  +                       APR_UREAD | APR_UWRITE | APR_GREAD, p);
  +    apr_assert_success(tc, "Open test file " FILENAME, rv);
  +
  +    offset = -5;
  +    rv = apr_file_seek(filetest, SEEK_END, &offset);
  +    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  +    CuAssertIntEquals(tc, strlen(TESTSTR) - 5, nbytes);
  +
  +    memset(str, 0, nbytes + 1);
  +    nbytes = 256;
  +    rv = apr_file_read(filetest, str, &nbytes);
  +    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  +    CuAssertIntEquals(tc, 5, nbytes);
  +    CuAssertStrEquals(tc, TESTSTR + strlen(TESTSTR) - 5, str);
  +
  +    apr_file_close(filetest);
   }                
   
   static void test_userdata_set(CuTest *tc)
  
  
  

Mime
View raw message