Fix clang warnings

This commit is contained in:
Howard Hinnant
2014-02-25 15:49:27 -05:00
committed by Vinnie Falco
parent 8eddcfd3d5
commit bb02112752
10 changed files with 41 additions and 14 deletions

View File

@@ -343,9 +343,9 @@ public:
const beast_wchar c = src.getAndAdvance();
const size_t bytesNeeded = DestCharPointerType::getBytesRequiredFor (c);
maxBytes -= bytesNeeded;
if (c == 0 || maxBytes < 0)
if (c == 0 || maxBytes < bytesNeeded)
break;
maxBytes -= bytesNeeded;
dest.write (c);
}

View File

@@ -64,6 +64,9 @@ public:
#pragma warning (push)
#pragma warning (disable: 4127) // conditional expression is constant
#pragma warning (disable: 4146) // unary minus operator applied to unsigned type, result still unsigned
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
#endif
// pass in a pointer to the END of a buffer..
template <typename IntegerType>
@@ -86,6 +89,8 @@ public:
}
#ifdef _MSC_VER
#pragma warning (pop)
#elif defined(__clang__)
#pragma clang diagnostic pop
#endif
struct StackArrayStream : public std::basic_streambuf <char, std::char_traits <char> >