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:46:04 GMT
trawick     2004/05/03 17:46:04

  Modified:    .        Tag: APR_0_9_BRANCH CHANGES
               file_io/os2 Tag: APR_0_9_BRANCH seek.c
               file_io/unix Tag: APR_0_9_BRANCH seek.c
               file_io/win32 Tag: APR_0_9_BRANCH seek.c
               test     Tag: APR_0_9_BRANCH testfile.c
  Log:
  Fix sign error in apr_file_seek().
  
  Submitted by:	Greg Hudson <ghudson MIT.EDU>
  Reviewed by:	Jeff Trawick
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.426.2.18 +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.426.2.17
  retrieving revision 1.426.2.18
  diff -u -r1.426.2.17 -r1.426.2.18
  --- CHANGES	16 Apr 2004 17:12:40 -0000	1.426.2.17
  +++ CHANGES	4 May 2004 00:46:03 -0000	1.426.2.18
  @@ -1,5 +1,8 @@
   Changes with APR 0.9.5
   
  +  *) Fix sign error in apr_file_seek(APR_END).
  +     [Greg Hudson <ghudson MIT.EDU>]
  +
     *) Provide workaround for socklen_t declaration problem with 64-bit
        build on HP-UX.  Stop setting a PA-RISC-specific compile option
        on ia64.  Look for -mt thread option, which is used with HP-UX
  
  
  
  No                   revision
  No                   revision
  1.25.2.2  +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.25.2.1
  retrieving revision 1.25.2.2
  diff -u -r1.25.2.1 -r1.25.2.2
  --- seek.c	13 Feb 2004 09:33:42 -0000	1.25.2.1
  +++ seek.c	4 May 2004 00:46:03 -0000	1.25.2.2
  @@ -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;
           }
   
  
  
  
  No                   revision
  No                   revision
  1.30.2.2  +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.30.2.1
  retrieving revision 1.30.2.2
  diff -u -r1.30.2.1 -r1.30.2.2
  --- seek.c	13 Feb 2004 09:33:43 -0000	1.30.2.1
  +++ seek.c	4 May 2004 00:46:03 -0000	1.30.2.2
  @@ -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;
           }
   
  
  
  
  No                   revision
  No                   revision
  1.27.2.2  +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.27.2.1
  retrieving revision 1.27.2.2
  diff -u -r1.27.2.1 -r1.27.2.2
  --- seek.c	13 Feb 2004 09:33:44 -0000	1.27.2.1
  +++ seek.c	4 May 2004 00:46:03 -0000	1.27.2.2
  @@ -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:
  
  
  
  No                   revision
  No                   revision
  1.71.2.2  +21 -0     apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfile.c,v
  retrieving revision 1.71.2.1
  retrieving revision 1.71.2.2
  diff -u -r1.71.2.1 -r1.71.2.2
  --- testfile.c	13 Feb 2004 09:33:52 -0000	1.71.2.1
  +++ testfile.c	4 May 2004 00:46:04 -0000	1.71.2.2
  @@ -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