]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed some cases of variable shadowing
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 18 Nov 2009 08:54:02 +0000 (09:54 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 18 Nov 2009 08:54:02 +0000 (09:54 +0100)
Fixed shadowing-related bug in http reply handling

src/BodyPipe.cc
src/ConfigOption.cc
src/DiskIO/AIO/AIODiskIOStrategy.cc
src/DiskIO/DiskDaemon/DiskdIOStrategy.cc
src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc
src/HttpReply.cc

index 501f17b52b42ecf64df9172463f79c101b0ef7f2..eb0a7e52d4c8780ef9289f5c77bc6692a42da761 100644 (file)
@@ -200,14 +200,14 @@ BodyPipe::clearProducer(bool atEof)
 }
 
 size_t
-BodyPipe::putMoreData(const char *buf, size_t size)
+BodyPipe::putMoreData(const char *aBuffer, size_t size)
 {
     if (bodySizeKnown())
         size = min((uint64_t)size, unproducedSize());
 
     const size_t spaceSize = static_cast<size_t>(theBuf.potentialSpaceSize());
     if ((size = min(size, spaceSize))) {
-        theBuf.append(buf, size);
+        theBuf.append(aBuffer, size);
         postAppend(size);
         return size;
     }
@@ -261,15 +261,15 @@ BodyPipe::clearConsumer()
 }
 
 size_t
-BodyPipe::getMoreData(MemBuf &buf)
+BodyPipe::getMoreData(MemBuf &aMemBuffer)
 {
     if (!theBuf.hasContent())
         return 0; // did not touch the possibly uninitialized buf
 
-    if (buf.isNull())
-        buf.init();
-    const size_t size = min(theBuf.contentSize(), buf.potentialSpaceSize());
-    buf.append(theBuf.content(), size);
+    if (aMemBuffer.isNull())
+        aMemBuffer.init();
+    const size_t size = min(theBuf.contentSize(), aMemBuffer.potentialSpaceSize());
+    aMemBuffer.append(theBuf.content(), size);
     theBuf.consume(size);
     postConsume(size);
     return size; // cannot be zero if we called buf.init above
@@ -409,35 +409,35 @@ BodyPipe::scheduleBodyEndNotification()
 // a short temporary string describing buffer status for debugging
 const char *BodyPipe::status() const
 {
-    static MemBuf buf;
-    buf.reset();
+    static MemBuf outputBuffer;
+    outputBuffer.reset();
 
-    buf.append(" [", 2);
+    outputBuffer.append(" [", 2);
 
-    buf.Printf("%"PRIu64"<=%"PRIu64, theGetSize, thePutSize);
+    outputBuffer.Printf("%"PRIu64"<=%"PRIu64, theGetSize, thePutSize);
     if (theBodySize >= 0)
-        buf.Printf("<=%"PRId64, theBodySize);
+        outputBuffer.Printf("<=%"PRId64, theBodySize);
     else
-        buf.append("<=?", 3);
+        outputBuffer.append("<=?", 3);
 
-    buf.Printf(" %d+%d", (int)theBuf.contentSize(), (int)theBuf.spaceSize());
+    outputBuffer.Printf(" %d+%d", (int)theBuf.contentSize(), (int)theBuf.spaceSize());
 
-    buf.Printf(" pipe%p", this);
+    outputBuffer.Printf(" pipe%p", this);
     if (theProducer)
-        buf.Printf(" prod%p", theProducer);
+        outputBuffer.Printf(" prod%p", theProducer);
     if (theConsumer)
-        buf.Printf(" cons%p", theConsumer);
+        outputBuffer.Printf(" cons%p", theConsumer);
 
     if (mustAutoConsume)
-        buf.append(" A", 2);
+        outputBuffer.append(" A", 2);
     if (isCheckedOut)
-        buf.append(" L", 2); // Locked
+        outputBuffer.append(" L", 2); // Locked
 
-    buf.append("]", 1);
+    outputBuffer.append("]", 1);
 
-    buf.terminate();
+    outputBuffer.terminate();
 
-    return buf.content();
+    return outputBuffer.content();
 }
 
 
index de3ee2ea1465ed92fbf871d9b94aff825d615d35..00cb31d264287bc63d1557804dcb0da6918b7a98 100644 (file)
@@ -45,12 +45,12 @@ ConfigOptionVector::~ConfigOptionVector()
 }
 
 bool
-ConfigOptionVector::parse(char const *option, const char *value, int reconfiguring)
+ConfigOptionVector::parse(char const *option, const char *value, int isaReconfig)
 {
     Vector<ConfigOption *>::iterator i = options.begin();
 
     while (i != options.end()) {
-        if ((*i)->parse(option,value, reconfiguring))
+        if ((*i)->parse(option,value, isaReconfig))
             return true;
 
         ++i;
index 291d2f07baed75acacc249a3c6b27d4b59ba43d4..61f79921ad37e94ce33df54b43402247c6f272f0 100644 (file)
@@ -123,7 +123,7 @@ AIODiskIOStrategy::callback()
     void *cbdata;
     int callback_valid;
     void *buf;
-    int fd;
+    int filedescriptor;
     async_queue_entry_t *aqe;
     async_queue_entry_type_t type;
 
@@ -148,7 +148,7 @@ AIODiskIOStrategy::callback()
                 /* Get the callback parameters */
                 freefunc = aqe->aq_e_free;
                 buf = aqe->aq_e_buf;
-                fd = aqe->aq_e_fd;
+                filedescriptor = aqe->aq_e_fd;
                 type = aqe->aq_e_type;
                 callback_valid = cbdataReferenceValidDone(aqe->aq_e_callback_data, &cbdata);
                 AIODiskFile * theFile = NULL;
index ac09014551b160895ba173546b15a1d3f156390a..54ba1a04d0119c19e22b497300fc6af203dbd670 100644 (file)
@@ -439,7 +439,7 @@ DiskdIOStrategy::getOptionTree() const
 }
 
 bool
-DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int reconfiguring)
+DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int isaReconfig)
 {
     if (strcmp(name, "Q1") != 0)
         return false;
@@ -448,7 +448,7 @@ DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int reconfig
 
     magic1 = atoi(value);
 
-    if (!reconfiguring)
+    if (!isaReconfig)
         return true;
 
     if (old_magic1 < magic1) {
@@ -478,7 +478,7 @@ DiskdIOStrategy::optionQ1Dump(StoreEntry * e) const
 }
 
 bool
-DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int reconfiguring)
+DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int isaReconfig)
 {
     if (strcmp(name, "Q2") != 0)
         return false;
@@ -487,7 +487,7 @@ DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int reconfig
 
     magic2 = atoi(value);
 
-    if (!reconfiguring)
+    if (!isaReconfig)
         return true;
 
     if (old_magic2 < magic2) {
index 9ae67dcd8908fcbcb0f9571bd27d4a762b5403cc..8b507c183ec9e2795a9b8e8bae98b55ac68c4189 100644 (file)
@@ -139,13 +139,13 @@ DiskThreadsIOStrategy::callback()
         dlinkDelete(&ctrlp->node, &used_list);
 
         if (ctrlp->done_handler) {
-            AIOCB *callback = ctrlp->done_handler;
+            AIOCB *done_callback = ctrlp->done_handler;
             void *cbdata;
             ctrlp->done_handler = NULL;
 
             if (cbdataReferenceValidDone(ctrlp->done_handler_data, &cbdata)) {
                 retval = 1;    /* Return that we've actually done some work */
-                callback(ctrlp->fd, cbdata, ctrlp->bufp,
+                done_callback(ctrlp->fd, cbdata, ctrlp->bufp,
                          ctrlp->result.aio_return, ctrlp->result.aio_errno);
             } else {
                 if (ctrlp->operation == _AIO_OPEN) {
index 72b29313d3a4f555b08f4d0f29a56250790dd81a..50af61ba54c132eeb9c4fbcd1e0ab8df822793ce 100644 (file)
@@ -210,7 +210,7 @@ HttpReply::packed304Reply()
 
 void
 HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason,
-                      const char *ctype, int64_t clen, time_t lmt, time_t expires)
+                      const char *ctype, int64_t clen, time_t lmt, time_t expiresTime)
 {
     HttpHeader *hdr;
     httpStatusLineSet(&sline, ver, status, reason);
@@ -228,8 +228,8 @@ HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason,
     if (clen >= 0)
         hdr->putInt64(HDR_CONTENT_LENGTH, clen);
 
-    if (expires >= 0)
-        hdr->putTime(HDR_EXPIRES, expires);
+    if (expiresTime >= 0)
+        hdr->putTime(HDR_EXPIRES, expiresTime);
 
     if (lmt > 0)               /* this used to be lmt != 0 @?@ */
         hdr->putTime(HDR_LAST_MODIFIED, lmt);
@@ -238,7 +238,7 @@ HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason,
 
     content_length = clen;
 
-    expires = expires;
+    expires = expiresTime;
 
     last_modified = lmt;
 }