httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cvs commit: httpd-apreq-2/src apreq.c apreq.h apreq_parsers.c
Date Sat, 10 Jul 2004 14:42:30 GMT
joes        2004/07/10 07:42:30

  Modified:    src      apreq.c apreq.h apreq_parsers.c
  Log:
  Reorder args in apreq_decodev and rename bytes_written dlen (which is less confusing since
this represents the length of the decoded string, not the size of the pre-decoded iovec data).
  
  Revision  Changes    Path
  1.42      +13 -13    httpd-apreq-2/src/apreq.c
  
  Index: apreq.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- apreq.c	10 Jul 2004 14:24:17 -0000	1.41
  +++ apreq.c	10 Jul 2004 14:42:30 -0000	1.42
  @@ -399,41 +399,41 @@
   }
   
   
  -APREQ_DECLARE(apr_status_t) apreq_decodev(char *d, struct iovec *v, int nelts, 
  -                                          apr_size_t *bytes_written)
  +APREQ_DECLARE(apr_status_t) apreq_decodev(char *d, apr_size_t *dlen,
  +                                          struct iovec *v, int nelts)
   {
       apr_status_t status = APR_SUCCESS;
       int n = 0;
   
  -    *bytes_written = 0;
  +    *dlen = 0;
       for (n = 0; n < nelts; ++n) {
  -        apr_size_t slen, dlen;
  +        apr_size_t slen, len;
   
       start_decodev:
   
           slen = v[n].iov_len;
  -        switch (status = url_decode(d,&dlen,v[n].iov_base, &slen)) {
  +        switch (status = url_decode(d,&len,v[n].iov_base, &slen)) {
   
           case APR_SUCCESS:
  -            d += dlen;
  -            *bytes_written += dlen;
  +            d += len;
  +            *dlen += len;
               continue;
   
           case APR_INCOMPLETE:
  -            d += dlen;
  -            *bytes_written += dlen;
  +            d += len;
  +            *dlen += len;
   
               if (++n == nelts)
                   return APR_INCOMPLETE;
   
  -            dlen = v[n-1].iov_len - slen;
  -            memcpy(d + dlen, v[n].iov_base, v[n].iov_len);
  -            v[n].iov_len += dlen;
  +            len = v[n-1].iov_len - slen;
  +            memcpy(d + len, v[n].iov_base, v[n].iov_len);
  +            v[n].iov_len += len;
               v[n].iov_base = d;
               goto start_decodev;
   
           default:
  -            *bytes_written = dlen;
  +            *dlen = len;
               return status;
           }
       }
  
  
  
  1.47      +3 -3      httpd-apreq-2/src/apreq.h
  
  Index: apreq.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq.h,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- apreq.h	10 Jul 2004 14:24:17 -0000	1.46
  +++ apreq.h	10 Jul 2004 14:42:30 -0000	1.47
  @@ -246,15 +246,15 @@
    * Url-decodes an iovec array.
    * @param dest Location of url-encoded result string. Caller must ensure dest is
    *             large enough to hold the encoded string and trailing null character.
  + * @param dlen  Resultant length of dest.
    * @param v Array of iovecs that represent the source string
    * @param nelts Number of iovecs in the array.
  - * @param bytes_written  Resultant length of successfully decoded data.
    * @return APR_SUCCESS on success, APR_INCOMPLETE if the iovec ends in the
    * middle of an %XX escape sequence, error otherwise.
    */
   
  -APREQ_DECLARE(apr_status_t) apreq_decodev(char *d, struct iovec *v, 
  -                                          int nelts, apr_size_t *bytes_written);
  +APREQ_DECLARE(apr_status_t) apreq_decodev(char *d, apr_size_t *dlen,
  +                                          struct iovec *v, int nelts);
   
   /**
    * Returns an url-encoded copy of a string.
  
  
  
  1.57      +4 -3      httpd-apreq-2/src/apreq_parsers.c
  
  Index: apreq_parsers.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_parsers.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- apreq_parsers.c	9 Jul 2004 23:00:38 -0000	1.56
  +++ apreq_parsers.c	10 Jul 2004 14:42:30 -0000	1.57
  @@ -143,8 +143,8 @@
   
       ((struct iovec *)arr.elts)[arr.nelts - 1].iov_len--; /* drop '=' sign */
   
  -    s = apreq_decodev((char *)v->name, (struct iovec *)arr.elts, 
  -                      arr.nelts, &v->size);
  +    s = apreq_decodev((char *)v->name, &v->size,
  +                      (struct iovec *)arr.elts, arr.nelts);
       if (s != APR_SUCCESS)
           return s;
   
  @@ -170,7 +170,8 @@
       if (end != APR_BRIGADE_SENTINEL(bb))
           ((struct iovec *)arr.elts)[arr.nelts - 1].iov_len--; /* drop '=' sign */
   
  -    s = apreq_decodev(v->data, (struct iovec *)arr.elts, arr.nelts, &v->size);
  +    s = apreq_decodev(v->data, &v->size,
  +                      (struct iovec *)arr.elts, arr.nelts);
       if (s != APR_SUCCESS)
           return s;
   
  
  
  

Mime
View raw message