You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by da...@apache.org on 2007/07/21 19:42:15 UTC
svn commit: r558361 - in /apr/apr-util/trunk: buckets/apr_brigade.c
include/apr_buckets.h
Author: davi
Date: Sat Jul 21 10:42:14 2007
New Revision: 558361
URL: http://svn.apache.org/viewvc?view=rev&rev=558361
Log:
Make apr_brigade_length() always update the length parameter. In case of a
bucket read error, return the length up to the error.
PR: 40893
Modified:
apr/apr-util/trunk/buckets/apr_brigade.c
apr/apr-util/trunk/include/apr_buckets.h
Modified: apr/apr-util/trunk/buckets/apr_brigade.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/buckets/apr_brigade.c?view=diff&rev=558361&r1=558360&r2=558361
==============================================================================
--- apr/apr-util/trunk/buckets/apr_brigade.c (original)
+++ apr/apr-util/trunk/buckets/apr_brigade.c Sat Jul 21 10:42:14 2007
@@ -165,6 +165,7 @@
{
apr_off_t total = 0;
apr_bucket *bkt;
+ apr_status_t status = APR_SUCCESS;
for (bkt = APR_BRIGADE_FIRST(bb);
bkt != APR_BRIGADE_SENTINEL(bb);
@@ -173,16 +174,15 @@
if (bkt->length == (apr_size_t)(-1)) {
const char *ignore;
apr_size_t len;
- apr_status_t status;
if (!read_all) {
- *length = -1;
- return APR_SUCCESS;
+ total = -1;
+ break;
}
if ((status = apr_bucket_read(bkt, &ignore, &len,
APR_BLOCK_READ)) != APR_SUCCESS) {
- return status;
+ break;
}
}
Modified: apr/apr-util/trunk/include/apr_buckets.h
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/include/apr_buckets.h?view=diff&rev=558361&r1=558360&r2=558361
==============================================================================
--- apr/apr-util/trunk/include/apr_buckets.h (original)
+++ apr/apr-util/trunk/include/apr_buckets.h Sat Jul 21 10:42:14 2007
@@ -712,8 +712,9 @@
* Return the total length of the brigade.
* @param bb The brigade to compute the length of
* @param read_all Read unknown-length buckets to force a size
- * @param length Returns the length of the brigade, or -1 if the brigade has
- * buckets of indeterminate length and read_all is 0.
+ * @param length Returns the length of the brigade (up to the end, or up
+ * to a bucket read error), or -1 if the brigade has buckets
+ * of indeterminate length and read_all is 0.
*/
APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb,
int read_all,