]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ICC support: code polish to reduce compile warnings
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 24 Feb 2011 10:18:58 +0000 (23:18 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 24 Feb 2011 10:18:58 +0000 (23:18 +1300)
13 files changed:
src/BodyPipe.cc
src/HttpRequest.h
src/HttpRequestMethod.h
src/acl/DomainData.cc
src/auth/digest/auth_digest.cc
src/auth/digest/auth_digest.h
src/client_side.cc
src/client_side_request.cci
src/dns_internal.cc
src/hier_code.h
src/ip/Address.cc
src/ipc/Kids.cc
src/ipc/TypedMsgHdr.cc

index 31922952b166efd2d868cd4fe283ca4e8917ea25..461cdd24c94b829e80e335fb2b55efd0f897ba69 100644 (file)
@@ -148,7 +148,6 @@ BodyPipe::~BodyPipe()
 void BodyPipe::setBodySize(uint64_t aBodySize)
 {
     assert(!bodySizeKnown());
-    assert(aBodySize >= 0);
     assert(thePutSize <= aBodySize);
 
     // If this assert fails, we need to add code to check for eof and inform
index 0002c092f3ff04b67d143f28a9102b7ec8960e44..1baa1488b1c4e3ada45bfd4da7996050f238fe53 100644 (file)
@@ -111,7 +111,7 @@ public:
         }
     };
     inline const char* GetHost(void) const { return host; };
-    inline const int GetHostIsNumeric(void) const { return host_is_numeric; };
+    inline int GetHostIsNumeric(void) const { return host_is_numeric; };
 
 #if USE_ADAPTATION
     /// Returns possibly nil history, creating it if adapt. logging is enabled
index 03c91c7a2b694c2a44cf88c548ffb37f37c75ccb..873aabcc249924a67999e7c8232170ce0f22fc14 100644 (file)
@@ -137,10 +137,10 @@ public:
      \retval METHOD_OTHER  the method is not recognized and has no unique ID
      \retval *             the method is on of the recognized HTTP methods.
      */
-    _method_t const id() const { return theMethod; }
+    _method_t id() const { return theMethod; }
 
     /** Get a char string representation of the method. */
-    char const* image() const;
+    char const * image() const;
 
     bool isCacheble() const;
     bool purgesOthers() const;
index 320d42ed17bf2d927eca3b69c260044a748cbca4..386ac467c308de7beba25676a9f11c5ee20ed1a1 100644 (file)
@@ -74,8 +74,8 @@ splaystrcmp (T&l, T&r)
 static int
 aclHostDomainCompare( char *const &a, char * const &b)
 {
-    const char *h = (const char *)a;
-    const char *d = (const char *)b;
+    const char *h = static_cast<const char *>(a);
+    const char *d = static_cast<const char *>(b);
     return matchDomainName(h, d);
 }
 
@@ -86,8 +86,8 @@ template<class T>
 int
 aclDomainCompare(T const &a, T const &b)
 {
-    char * const d1 = (char *const)b;
-    char * const d2 = (char *const )a;
+    char * const d1 = static_cast<char *>(b);
+    char * const d2 = static_cast<char *>(a);
     int ret;
     ret = aclHostDomainCompare(d1, d2);
 
index 47c22a4f3fb9619e4a8c72255607ec3b6c414c36..e095fe686f58eb726469c966221ab0815dbc5982 100644 (file)
@@ -443,7 +443,7 @@ authDigestNonceIsStale(digest_nonce_h * nonce)
  * \retval  0    the digest is not stale yet
  * \retval -1    the digest will be stale on the next request
  */
-const int
+int
 authDigestNonceLastRequest(digest_nonce_h * nonce)
 {
     if (!nonce)
index de67901043edec8773b547f24a2313e0ff577352..d1fc220f599fb7edfb0b1089ecf4a0366fd9c1f6 100644 (file)
@@ -73,7 +73,7 @@ struct _digest_nonce_h : public hash_link {
 extern void authDigestNonceUnlink(digest_nonce_h * nonce);
 extern int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]);
 extern const char *authenticateDigestNonceNonceb64(const digest_nonce_h * nonce);
-extern const int authDigestNonceLastRequest(digest_nonce_h * nonce);
+extern int authDigestNonceLastRequest(digest_nonce_h * nonce);
 
 /* configuration runtime data */
 
index 5dbe5d29163ed7b3d9a6bddc48714d10da8935ed..0fcd5bd20e5f6291a2cf4863d03d3817947e1d9c 100644 (file)
@@ -1090,11 +1090,6 @@ ClientSocketContext::packRange(StoreIOBuffer const &source, MemBuf * mb)
 
         }
 
-        /*
-         * paranoid check
-         */
-        assert((available.size() >= 0 && i->debt() >= 0) || i->debt() == -1);
-
         if (!canPackMoreRanges()) {
             debugs(33, 3, "clientPackRange: Returning because !canPackMoreRanges.");
 
index a9a043853efe3426bcd2cbe5784b59e9a7d8e5fb..bf13b01d744b064ed4c65eb30141ced79409b5c3 100644 (file)
@@ -58,7 +58,7 @@ ClientHttpRequest::getConn()
     return conn_;
 }
 
-ConnStateData * const
+ConnStateData const *
 ClientHttpRequest::getConn() const
 {
     if (!cbdataReferenceValid(conn_))
index 4e16c7274bccd50003f26148ac969db57c94bac2..3efcdb97f667a02051cff88f6763f29bd97ffc47 100644 (file)
@@ -1659,11 +1659,9 @@ idnsALookup(const char *name, IDNSCB * callback, void *data)
            ", id = 0x" << std::hex << q->msg_id);
 
     q->callback = callback;
-
     q->callback_data = cbdataReference(data);
 
     idnsCacheQuery(q);
-
     idnsSendQuery(q);
 }
 
@@ -1711,11 +1709,9 @@ idnsPTRLookup(const Ip::Address &addr, IDNSCB * callback, void *data)
            ", id = 0x" << std::hex << q->msg_id);
 
     q->callback = callback;
-
     q->callback_data = cbdataReference(data);
 
     idnsCacheQuery(q);
-
     idnsSendQuery(q);
 }
 
index 38adaac798208f35d235b2d76f2387a961104231..23225c376047e4fdaf8e43d0ee15f1c367f9651b 100644 (file)
@@ -30,6 +30,6 @@ typedef enum {
 
 extern const char *hier_code_str[];
 
-inline const hier_code operator++(hier_code &i) { return (hier_code)(i+1); }
+inline hier_code operator++(hier_code &i) { return (hier_code)(i+1); }
 
 #endif /* SQUID__HIER_CODE_H */
index bfee8064521b885b2963c7c1966e3dd64fad669b..2ba98bf8ec969af4f41b47122210d530d85f6263 100644 (file)
@@ -822,7 +822,7 @@ Ip::Address::NtoA(char* buf, const unsigned int blen, int force) const
     /* some external code may have blindly memset a parent. */
     /* thats okay, our default is known */
     if ( IsAnyAddr() ) {
-        memcpy(buf,"::\0", min((const unsigned int)3,blen));
+        memcpy(buf,"::\0", min(static_cast<unsigned int>(3),blen));
         return buf;
     }
 
@@ -832,7 +832,7 @@ Ip::Address::NtoA(char* buf, const unsigned int blen, int force) const
     /* However IPv4 CAN. */
     if ( force == AF_INET && !IsIPv4() ) {
         if ( IsIPv6() ) {
-            memcpy(buf, "{!IPv4}\0", min((const unsigned int)8,blen));
+            memcpy(buf, "{!IPv4}\0", min(static_cast<unsigned int>(8),blen));
         }
         return buf;
     }
@@ -851,7 +851,7 @@ Ip::Address::NtoA(char* buf, const unsigned int blen, int force) const
                force << "). accepted={" << AF_UNSPEC << "," << AF_INET << "," << AF_INET6 << "}");
         fprintf(stderr,"WARNING: Corrupt IP Address details OR required to display in unknown format (%d). accepted={%d,%d,%d} ",
                 force, AF_UNSPEC, AF_INET, AF_INET6);
-        memcpy(buf,"dead:beef::\0", min((const unsigned int)13,blen));
+        memcpy(buf,"dead:beef::\0", min(static_cast<unsigned int>(13),blen));
         assert(false);
     }
 
index 7e15ceb7d6e6a2ca320c679273d7abe16e6fcd9d..1f1af2e4d6c0521ff6a441d41a31166c177a1491 100644 (file)
@@ -56,7 +56,7 @@ Kid* Kids::find(pid_t pid)
 /// returns the kid by index, useful for kids iteration
 Kid& Kids::get(size_t i)
 {
-    assert(i >= 0 && i < count());
+    assert(i < count());
     return storage[i];
 }
 
index 0f2116cc72d3e105ae4ccf86d491544e6aa06fb1..2ccb0be8dda729ce2e7f941775491d78ef2ec43d 100644 (file)
@@ -153,7 +153,6 @@ Ipc::TypedMsgHdr::putFixed(const void *raw, size_t size)
 void
 Ipc::TypedMsgHdr::getRaw(void *raw, size_t size) const
 {
-    Must(size >= 0);
     if (size > 0) {
         Must(size <= data.size - offset);
         memcpy(raw, data.raw + offset, size);
@@ -165,7 +164,6 @@ Ipc::TypedMsgHdr::getRaw(void *raw, size_t size) const
 void
 Ipc::TypedMsgHdr::putRaw(const void *raw, size_t size)
 {
-    Must(size >= 0);
     if (size > 0) {
         Must(size <= sizeof(data.raw) - data.size);
         memcpy(data.raw + data.size, raw, size);