------------------------------------------------------------ revno: 13039 revision-id: squid3@treenet.co.nz-20131007112358-os42jrv7gl0mv77k parent: squid3@treenet.co.nz-20131007103647-qesndbp86iodh4fn committer: Amos Jeffries branch nick: trunk timestamp: Mon 2013-10-07 05:23:58 -0600 message: Fix more signedness comparisons in SBuf ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20131007112358-os42jrv7gl0mv77k # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 408623b8264d854cc88a5e805c0c0acad8cfc03d # timestamp: 2013-10-07 11:57:07 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20131007103647-\ # qesndbp86iodh4fn # # Begin patch === modified file 'src/SBuf.cc' --- src/SBuf.cc 2013-10-05 00:14:03 +0000 +++ src/SBuf.cc 2013-10-07 11:23:58 +0000 @@ -558,10 +558,6 @@ if (startPos > length()) return npos; - // ignore invalid startPos - if (startPos < 0) - startPos = 0; - const void *i = memchr(buf()+startPos, (int)c, (size_type)length()-startPos); if (i == NULL) @@ -578,9 +574,6 @@ return npos; } - if (startPos < 0) - startPos = 0; - // std::string allows needle to overhang hay but not start outside if (startPos > length()) { ++stats.find; @@ -673,8 +666,6 @@ // on npos input std::string compares last octet of hay if (endPos == npos || endPos >= length()) { endPos = length(); - } else if (endPos < 0) { - return npos; } else { // NP: off-by-one weirdness: // endPos is an offset ... 0-based @@ -709,9 +700,6 @@ if (startPos >= length()) return npos; - if (startPos < 0) - startPos = 0; - if (set.length() == 0) return npos; @@ -813,8 +801,6 @@ void SBuf::checkAccessBounds(size_type pos) const { - if (pos < 0) - throw OutOfBoundsException(*this, pos, __FILE__, __LINE__); if (pos >= length()) throw OutOfBoundsException(*this, pos, __FILE__, __LINE__); }