From 547d3e94b2641d54e710ab8041cef2659ca1ec07 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 16 Sep 2012 16:41:15 +0200 Subject: [PATCH] Fixed some sign conversion messages from clang. --- lib/checkbufferoverrun.cpp | 2 +- lib/checknullpointer.cpp | 2 +- lib/preprocessor.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 30b63ba39..723879c98 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -1279,7 +1279,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable() for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { if (Token::Match(tok, "%str% [ %num% ]")) { std::string str = tok->strValue(); - std::size_t index = std::atoi(tok->strAt(2).c_str()); + std::size_t index = (std::size_t)std::atoi(tok->strAt(2).c_str()); if (index > str.length()) { bufferOverrunError(tok, tok->str()); } diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index 48422adbd..e6cbcc9d0 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -377,7 +377,7 @@ bool CheckNullPointer::CanFunctionAssignPointer(const Token *functiontoken, unsi if (Token::Match(functiontoken, "if|while|for|switch|sizeof|catch")) return false; - int argumentNumber = 0; + unsigned int argumentNumber = 0; for (const Token *arg = functiontoken->tokAt(2); arg; arg = arg->nextArgument()) { if (Token::Match(arg, "%varid% [,)]", varid)) { const Function* func = _tokenizer->getSymbolDatabase()->findFunctionByName(functiontoken->str(), functiontoken->scope()); diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 3c6ae34eb..d5f897e45 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -128,9 +128,9 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename) // The UTF-16 BOM is 0xfffe or 0xfeff. unsigned int bom = 0; if (istr.peek() >= 0xfe) { - bom = (istr.get() << 8); + bom = ((unsigned int)istr.get() << 8); if (istr.peek() >= 0xfe) - bom |= istr.get(); + bom |= (unsigned int)istr.get(); } // ------------------------------------------------------------------------------------------