httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/file_io/win32 open.c readwrite.c
Date Wed, 19 Apr 2000 17:42:08 GMT
stoddard    00/04/19 10:42:08

  Modified:    src/lib/apr/file_io/win32 open.c readwrite.c
  Log:
  Reimplement ap_writev, et. al. using ap_write.
  
  Revision  Changes    Path
  1.32      +3 -1      apache-2.0/src/lib/apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/open.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- open.c	2000/04/18 13:57:29	1.31
  +++ open.c	2000/04/19 17:42:07	1.32
  @@ -223,8 +223,10 @@
           return APR_ENOMEM;
       }
       (*thefile)->filehand = GetStdHandle(STD_ERROR_HANDLE);
  +    if ((*thefile)->filehand == INVALID_HANDLE_VALUE)
  +        return GetLastError();
       (*thefile)->cntxt = cont;
  -    (*thefile)->fname = NULL;
  +    (*thefile)->fname = "STD_ERROR_HANDLE";
       (*thefile)->stated = 0;
       (*thefile)->eof_hit = 0;
   
  
  
  
  1.26      +22 -22    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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- readwrite.c	2000/04/18 14:03:54	1.25
  +++ readwrite.c	2000/04/19 17:42:07	1.26
  @@ -88,14 +88,19 @@
   
   ap_status_t ap_write(ap_file_t *thefile, void *buf, ap_ssize_t *nbytes)
   {
  +    ap_status_t rv;
       DWORD bwrote;
  -    
  +
       if (WriteFile(thefile->filehand, buf, *nbytes, &bwrote, NULL)) {
           *nbytes = bwrote;
  -        return APR_SUCCESS;
  +        rv = APR_SUCCESS;
  +    } 
  +    else {
  +        (*nbytes) = 0;
  +        rv = GetLastError();
       }
  -    (*nbytes) = 0;
  -    return GetLastError();
  +
  +    return rv;
   }
   /*
    * Too bad WriteFileGather() is not supported on 95&98 (or NT prior to SP2) 
  @@ -103,28 +108,29 @@
   ap_status_t ap_writev(ap_file_t *thefile, const struct iovec *vec, ap_size_t nvec, 
                         ap_ssize_t *nbytes)
   {
  +    ap_status_t rv = APR_SUCCESS;
       int i;
       DWORD bwrote = 0;
  +    char *buf;
   
       *nbytes = 0;
       for (i = 0; i < nvec; i++) {
  -        if (!WriteFile(thefile->filehand,
  -                       vec[i].iov_base, vec[i].iov_len, &bwrote, NULL)) {
  -            return GetLastError();
  -        }
  +        buf = vec[i].iov_base;
  +        bwrote = vec[i].iov_len;
  +        rv = ap_write(thefile, buf, &bwrote);
           *nbytes += bwrote;
  +        if (rv != APR_SUCCESS) {
  +            break;
  +        }
       }
  -    return APR_SUCCESS;
  +    return rv;
   }
   
   ap_status_t ap_putc(char ch, ap_file_t *thefile)
   {
  -    DWORD bwrote;
  +    DWORD len = 1;
   
  -    if (!WriteFile(thefile->filehand, &ch, 1, &bwrote, NULL)) {
  -        return GetLastError();
  -    }
  -    return APR_SUCCESS; 
  +    return ap_write(thefile, &ch, &len);
   }
   
   ap_status_t ap_ungetc(char ch, ap_file_t *thefile)
  @@ -174,15 +180,9 @@
   
   ap_status_t ap_puts(char *str, ap_file_t *thefile)
   {
  -    DWORD bwrote;
  -    int len;
  +    DWORD len = strlen(str);
   
  -    len = strlen(str);
  -    if (!WriteFile(thefile->filehand, str, len, &bwrote, NULL)) {
  -        return GetLastError();
  -    }
  -
  -    return APR_SUCCESS; 
  +    return ap_write(thefile, str, &len);
   }
   
   ap_status_t ap_fgets(char *str, int len, ap_file_t *thefile)
  
  
  

Mime
View raw message