httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c
Date Wed, 14 Jun 2000 16:39:22 GMT
> From: bjh@locus.apache.org
> Date: 14 Jun 2000 16:10:46 -0000
> 
> bjh         00/06/14 09:10:45
> 
>   Modified:    src/lib/apr/file_io/win32 readwrite.c
>   Log:
>   Win32: use ap_read() in ap_getc() so that it benefits from & doesn't mess
>   with buffering.
>   
>   Revision  Changes    Path
>   1.35      +9 -3      apache-2.0/src/lib/apr/file_io/win32/readwrite.c
>   
>   Index: readwrite.c
>   ===================================================================
>   RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readwrite.c,v
>   retrieving revision 1.34
>   retrieving revision 1.35
>   diff -u -r1.34 -r1.35
>   --- readwrite.c	2000/05/26 16:23:10	1.34
>   +++ readwrite.c	2000/06/14 16:10:45	1.35
>   @@ -245,10 +245,16 @@
>    
>    ap_status_t ap_getc(char *ch, ap_file_t *thefile)
>    {
>   -    DWORD bread;
>   -    if (!ReadFile(thefile->filehand, ch, 1, &bread, NULL)) {
>   -        return GetLastError();
>   +    ap_status_t rc;
>   +    int bread;
>   +
>   +    bread = 1;
>   +    rc = ap_read(thefile, ch, &bread);
>   +
>   +    if (rc) {
>   +        return rc;
>        }
>   +    
>        if (bread == 0) {
>            thefile->eof_hit = TRUE;
>            return APR_EOF;

I would think that you *should* be able to make it as simple as

ap_status_t ap_getc(char *ch, ap_file_t *thefile)
{
    ap_ssize_t bread = 1;
    return ap_read(thefile, ch, &bread);
}

However, while the Win32 ap_read() handles eof_hit, it doesn't return
APR_EOF.  Instead, it returns the GetLastError() code (which is zero).

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message