apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: apr_bucket_simple_split
Date Sat, 25 Aug 2001 22:30:59 GMT
From: "Cliff Woolley" <cliffwoolley@yahoo.com>
Sent: Saturday, August 25, 2001 4:09 PM


> Somebody please explain this commit to me:
> 
> ===================================================================
> RCS file: /home/cvspublic/apr-util/buckets/apr_buckets_simple.c,v
> retrieving revision 1.29
> retrieving revision 1.30
> diff -u -r1.29 -r1.30
> --- apr-util/buckets/apr_buckets_simple.c 2001/06/19 18:48:32 1.29
> +++ apr-util/buckets/apr_buckets_simple.c 2001/07/24 20:36:03 1.30
> @@ -67,12 +67,12 @@
>  }
> 
>  APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_split(apr_bucket *a,
> -                                                         apr_off_t point)
> +                                                         apr_size_t point)
>  {
>      apr_bucket *b;
>      apr_status_t rv;
> 
> -    if (point < 0 || point > a->length) {
> +    if ((point > a->length) || (a->length == (apr_size_t)(-1))) {
>   return APR_EINVAL;
>      }
> 
> 
> Why check to see if a->length is -1?  That's a waste of time.  If
> a->length is -1, the bucket type should have never registered a split
> function in the first place.  What we really want to know is if point is
> before the beginning of the bucket or after the end of the bucket.  The
> original test gave us that.

My patch didn't change behavior.  The prior test is point < 0, that was, -1.
Now that they can be a full apr_size_t, we still need to check that it's not
-1, unless you want to alter this.  I was simply changing from a signed to an
unsigned type.

You don't register a bucket function by bucket, you register it by bucket_type.
Perhaps some types of buckets can split some of the time, but not all the time.
Correct?  (E.g. we can split a file bucket of known length, but not one of an
indeterminate length.)

Bill





Mime
View raw message