apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r588057 - /apr/apr-util/branches/1.2.x/buckets/apr_brigade.c
Date Wed, 24 Oct 2007 22:22:12 GMT
Author: wrowe
Date: Wed Oct 24 15:22:11 2007
New Revision: 588057

URL: http://svn.apache.org/viewvc?rev=588057&view=rev
Log:
>From discussion on list with Jeff and Martin, this appears
to be the safest solution for the true max_unsigned whatever,
invert all the bits to 1 and never treat it as signed.

Backport: 588056

Modified:
    apr/apr-util/branches/1.2.x/buckets/apr_brigade.c

Modified: apr/apr-util/branches/1.2.x/buckets/apr_brigade.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.2.x/buckets/apr_brigade.c?rev=588057&r1=588056&r2=588057&view=diff
==============================================================================
--- apr/apr-util/branches/1.2.x/buckets/apr_brigade.c (original)
+++ apr/apr-util/branches/1.2.x/buckets/apr_brigade.c Wed Oct 24 15:22:11 2007
@@ -29,6 +29,12 @@
 #include <sys/uio.h>
 #endif
 
+/* TODO: ~((apr_size_t)0) appears to be the best way to quickly 
+ * represent  MAX_APR_SIZE_T for any CPU we support.  Move this
+ * out as APR_MAX_SIZE_T to our public headers...
+ */
+#define MAX_APR_SIZE_T (~((apr_size_t)0))
+
 static apr_status_t brigade_cleanup(void *data) 
 {
     return apr_brigade_cleanup(data);
@@ -114,12 +120,10 @@
          e != APR_BRIGADE_SENTINEL(b);
          e = APR_BUCKET_NEXT(e))
     {
-        /* XXX: 2's compliment math error here, (apr_size_t)(-1) is not
-         * a sufficient replacement for MAX_SIZE_T (compared to 'point' here);
-         * For an unknown length bucket, while 'point' is beyond the possible
+        /* For an unknown length bucket, while 'point' is beyond the possible
          * size contained in apr_size_t, read and continue...
          */
-        if ((e->length == (apr_size_t)(-1)) && (point > (apr_size_t)(-1)))
{
+        if ((e->length == (apr_size_t)(-1)) && (point > MAX_APR_SIZE_T)) {
             /* point is too far out to simply split this bucket,
              * we must fix this bucket's size and keep going... */
             rv = apr_bucket_read(e, &s, &len, APR_BLOCK_READ);



Mime
View raw message