From: Amos Jeffries Date: Thu, 24 Feb 2011 10:18:58 +0000 (+1300) Subject: ICC support: code polish to reduce compile warnings X-Git-Tag: take06~27^2~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1dc746da7fe77b094ba16bb4e0eb72408d74b0b4;p=thirdparty%2Fsquid.git ICC support: code polish to reduce compile warnings --- diff --git a/src/BodyPipe.cc b/src/BodyPipe.cc index 31922952b1..461cdd24c9 100644 --- a/src/BodyPipe.cc +++ b/src/BodyPipe.cc @@ -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 diff --git a/src/HttpRequest.h b/src/HttpRequest.h index 0002c092f3..1baa1488b1 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -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 diff --git a/src/HttpRequestMethod.h b/src/HttpRequestMethod.h index 03c91c7a2b..873aabcc24 100644 --- a/src/HttpRequestMethod.h +++ b/src/HttpRequestMethod.h @@ -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; diff --git a/src/acl/DomainData.cc b/src/acl/DomainData.cc index 320d42ed17..386ac467c3 100644 --- a/src/acl/DomainData.cc +++ b/src/acl/DomainData.cc @@ -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(a); + const char *d = static_cast(b); return matchDomainName(h, d); } @@ -86,8 +86,8 @@ template 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(b); + char * const d2 = static_cast(a); int ret; ret = aclHostDomainCompare(d1, d2); diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index 47c22a4f3f..e095fe686f 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -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) diff --git a/src/auth/digest/auth_digest.h b/src/auth/digest/auth_digest.h index de67901043..d1fc220f59 100644 --- a/src/auth/digest/auth_digest.h +++ b/src/auth/digest/auth_digest.h @@ -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 */ diff --git a/src/client_side.cc b/src/client_side.cc index 5dbe5d2916..0fcd5bd20e 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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."); diff --git a/src/client_side_request.cci b/src/client_side_request.cci index a9a043853e..bf13b01d74 100644 --- a/src/client_side_request.cci +++ b/src/client_side_request.cci @@ -58,7 +58,7 @@ ClientHttpRequest::getConn() return conn_; } -ConnStateData * const +ConnStateData const * ClientHttpRequest::getConn() const { if (!cbdataReferenceValid(conn_)) diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 4e16c7274b..3efcdb97f6 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -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); } diff --git a/src/hier_code.h b/src/hier_code.h index 38adaac798..23225c3760 100644 --- a/src/hier_code.h +++ b/src/hier_code.h @@ -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 */ diff --git a/src/ip/Address.cc b/src/ip/Address.cc index bfee806452..2ba98bf8ec 100644 --- a/src/ip/Address.cc +++ b/src/ip/Address.cc @@ -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(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(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(13),blen)); assert(false); } diff --git a/src/ipc/Kids.cc b/src/ipc/Kids.cc index 7e15ceb7d6..1f1af2e4d6 100644 --- a/src/ipc/Kids.cc +++ b/src/ipc/Kids.cc @@ -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]; } diff --git a/src/ipc/TypedMsgHdr.cc b/src/ipc/TypedMsgHdr.cc index 0f2116cc72..2ccb0be8dd 100644 --- a/src/ipc/TypedMsgHdr.cc +++ b/src/ipc/TypedMsgHdr.cc @@ -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);