apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: apr_bucket_simple_split
Date Sun, 26 Aug 2001 09:00:22 GMT
On Sat, Aug 25, 2001 at 05:09:14PM -0400, Cliff Woolley wrote:
>...
>  APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_split(apr_bucket *a,
> -                                                         apr_off_t point)
> +                                                         apr_size_t point)

Euh... why is that an apr_size_t? I thought we just talked about that
earlier this week? A bucket could hold a *lot* more than what can fit in
memory. I could easily have a FILE bucket that is 6gig in size (say, a video
file). A FILE bucket can easily be split without needing to read anything
into memory, so the apr_off_t works quite well.

>  {
>      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.

Untrue. Please explain why a PIPE bucket cannot be split at byte 100? Sure,
it doesn't know its length, but it can easily read in 100 bytes, give you
that, and leave itself as the second part of the split.

> 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.
> 
> What am I missing?

First off, that the point should be an apr_off_t.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message