apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: types for bucket/brigade sizes (was: Re: bug in apr_brigade.c)
Date Fri, 25 Jan 2002 00:14:16 GMT
On Thu, Jan 24, 2002 at 03:35:03PM -0800, Justin Erenkrantz wrote:
>...
> > The warnings/errors discovered will tell us a bundle... It will tell us
> > where we're mixing them inappropriately, and where we're making assumptions
> > about certain sizes.
> 
> Lots of places are casting to check for -1.  We'll have to see how to 
> handle all of those cases.  It'd be goodness if we could have a
> defined way to check for unknown bucket lengths without the casting
> to "add" a sign.  Thoughts?

Define a specific constant for "unknown size". We shouldn't expose the fact
that -1 is used to represent unknown. e.g. APR_BUCKET_LEN_UNKNOWN

Note: I believe there are also assumptions that a given read() will return
the same amount as bkt->len. That is incorrect.

It is very reasonable to have a socket, to know that it represents 10k of
data, but only return 1k on a read(). For example: during a PUT request to
apache. The content may be 10k, but only 1k is available right now.

So... bkt->len is "the size of my data, or 'unknown'". And a read() can
*always* return a subset of that data. Or if unknown, then the read() will
return /something/.

Note that bkt->len being an apr_off_t, then the read() will by *definition*
need to return a subset in some cases. It all fits together... :-)

> I expect this to take a bit to straighten out.  I'm going to try to
> clear out my current patch queue first (mod_auth_db, ap_getline, 
> etc.) and then turn my focus onto the bucket sizes.  -- justin

No complaints there :-)

Cheers,
-g

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

Mime
View raw message