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 Fri, 24 Aug 2001 12:19:01 GMT
trawick     01/08/24 05:19:01

  Modified:    file_io/unix readwrite.c
               test     testfile.c
  Log:
  get apr_file_ungetc() for unix working well enough with buffered
  files that the current testfile.c and mod_negotiation (.var files)
  are happy
  
  testfile could probably stand some more rigorous tests
  
  Revision  Changes    Path
  1.71      +6 -0      apr/file_io/unix/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/readwrite.c,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- readwrite.c	2001/08/10 21:04:47	1.70
  +++ readwrite.c	2001/08/24 12:19:01	1.71
  @@ -129,6 +129,12 @@
           }
   
   	rv = 0;
  +        if (thefile->ungetchar != -1) {
  +            *pos = (char)thefile->ungetchar;
  +            ++pos;
  +            --size;
  +            thefile->ungetchar = -1;
  +        }
           while (rv == 0 && size > 0) {
               if (thefile->bufpos >= thefile->dataRead) {
                   thefile->dataRead = read(thefile->filedes, thefile->buffer, APR_FILE_BUFSIZE);
  
  
  
  1.41      +8 -16     apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfile.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- testfile.c	2001/08/23 01:52:02	1.40
  +++ testfile.c	2001/08/24 12:19:01	1.41
  @@ -390,22 +390,14 @@
       assert(!rv);
       read_one(f, 'a');
       read_one(f, 'b');
  -    if (extra_flags & APR_BUFFERED) {
  -        printf("\n        skipping apr_file_ungetc() for APR_BUFFERED as it "
  -               "doesn't work yet\n");
  -        apr_file_close(f);
  -        return (0);
  -    }
  -    else {
  -        rv = apr_file_ungetc('b', f);
  -        assert(!rv);
  -        /* Note: some implementations move the file ptr back;
  -         *       others just save up to one char; it isn't 
  -         *       portable to unget more than once.
  -         */
  -        /* Don't do this: rv = apr_file_ungetc('a', f); */
  -        read_one(f, 'b');
  -    }
  +    rv = apr_file_ungetc('b', f);
  +    assert(!rv);
  +    /* Note: some implementations move the file ptr back;
  +     *       others just save up to one char; it isn't 
  +     *       portable to unget more than once.
  +     */
  +    /* Don't do this: rv = apr_file_ungetc('a', f); */
  +    read_one(f, 'b');
       read_one(f, 'c');
       read_one(f, '\n');
       for (i = 0; i < TESTREAD_BLKSIZE; i++) {
  
  
  

Mime
View raw message