]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Coverity fixes 1980/head
authorAki Tuomi <cmouse@desteem.org>
Tue, 23 Dec 2014 16:31:41 +0000 (18:31 +0200)
committerAki Tuomi <cmouse@desteem.org>
Tue, 23 Dec 2014 16:31:41 +0000 (18:31 +0200)
pdns/ext/yahttp/yahttp/reqresp.hpp
pdns/ext/yahttp/yahttp/utility.hpp

index 17ee9f52ebc9628a793c3669d67d284a0c316c88..0643c4e72dbd6d32eaea4bc7d5bb1287f318f223 100644 (file)
@@ -52,7 +52,7 @@ namespace YaHTTP {
           std::string::size_type i,cl;
           for(i=0;i<doc->body.length();i+=1024) {
             cl = std::min(static_cast<std::string::size_type>(1024), doc->body.length()-i); // for less than 1k blocks
-            os << std::hex << cl << "\r\n";
+            os << std::hex << cl << std::dec << "\r\n";
             os << doc->body.substr(i, cl) << "\r\n";
           }
           os << 0 << "\r\n\r\n"; // last chunk
@@ -82,7 +82,7 @@ namespace YaHTTP {
           ifs.read(buf, sizeof buf);
           n += (k = ifs.gcount());
           if (k) {
-            if (chunked) os << std::hex << k << "\r\n";
+            if (chunked) os << std::hex << k << std::dec << "\r\n";
             os.write(buf, k);
             if (chunked) os << "\r\n"; 
           }
index 03fc4833b5d5ec665fc88b4dd2b2930d71ea83a9..3b0a8d1d9ad19cd51619ee0de05d8bd55e8854d9 100644 (file)
@@ -12,8 +12,10 @@ namespace YaHTTP {
       std::string::const_iterator lhi = lhs.begin();
       std::string::const_iterator rhi = rhs.begin();
       for(;lhi != lhs.end() && rhi != rhs.end(); lhi++, rhi++)
-        if ((v = ::tolower(*lhi) - ::tolower(*rhi)) != 0) return v<0;
-      return (::tolower(*lhi) - ::tolower(*rhi))<0;
+        if ((v = ::tolower(*lhi) - ::tolower(*rhi)) != 0) return v<0; 
+      if (lhi == lhs.end() && rhi != rhs.end()) return true;
+      if (lhi != lhs.end() && rhi == rhs.end()) return false;
+      return false; // they are equal
     }
   };