]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Revert and replace rev.13234
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 16 Jan 2014 00:24:34 +0000 (13:24 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 16 Jan 2014 00:24:34 +0000 (13:24 +1300)
Clang dentifies the StoreIOBuffer parameter as unsigned,
  error: comparison of unsigned expression < 0 is always false

src/StoreIOBuffer.h
src/store_client.cc

index eef8a2827f1119f5b9bfb45866ebe30c3ba669e5..d26bb881fe3de7d764eb42bf1f0e790c7a6974bd 100644 (file)
@@ -45,12 +45,7 @@ public:
 
     StoreIOBuffer(size_t aLength, int64_t anOffset, char *someData) :
             length (aLength), offset (anOffset), data (someData) {
-        if (aLength < 0) {
-            flags.error = 1;
-            length = 0;
-        } else {
-            flags.error = 0;
-        }
+        flags.error = 0;
     }
 
     /* Create a StoreIOBuffer from a MemBuf and offset */
index ea1d01487402ad09751a6a49942857231d463fe9..3be320230020aed4b920ab31af5a1f4f4e030520 100644 (file)
@@ -132,14 +132,19 @@ storeClientListAdd(StoreEntry * e, void *data)
 void
 store_client::callback(ssize_t sz, bool error)
 {
-    StoreIOBuffer result(sz, 0 ,copyInto.data);
+    size_t bSz = 0;
 
-    if (error)
+    if (sz >= 0 && !error)
+        bSz = sz;
+
+    StoreIOBuffer result(bSz, 0 ,copyInto.data);
+
+    if (sz < 0 || error)
         result.flags.error = 1;
 
     result.offset = cmp_offset;
     assert(_callback.pending());
-    cmp_offset = copyInto.offset + sz;
+    cmp_offset = copyInto.offset + bSz;
     STCB *temphandler = _callback.callback_handler;
     void *cbdata = _callback.callback_data;
     _callback = Callback(NULL, NULL);