From 87e6a3501a7487605af7fd9ec63f9e52f6578a05 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Thu, 11 Sep 2014 18:47:28 +0200 Subject: [PATCH] Added checktype.cpp to VS solution; Fixed MSVC warning about signed/unsigned mismatch --- lib/checktype.cpp | 10 +++++----- lib/cppcheck.vcxproj | 2 ++ lib/cppcheck.vcxproj.filters | 6 ++++++ test/testrunner.vcxproj | 1 + test/testrunner.vcxproj.filters | 3 +++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/checktype.cpp b/lib/checktype.cpp index 2ce684b84..23dccb713 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -30,7 +30,7 @@ namespace { CheckType instance; } -static bool astGetSizeSign(const Settings *settings, const Token *tok, int *size, char *sign) +static bool astGetSizeSign(const Settings *settings, const Token *tok, unsigned int *size, char *sign) { if (!tok) return false; @@ -43,7 +43,7 @@ static bool astGetSizeSign(const Settings *settings, const Token *tok, int *size if (tok->str().find("L") != std::string::npos) return false; MathLib::bigint value = MathLib::toLongNumber(tok->str()); - int sz; + unsigned int sz; if (value >= -(1<<7) && value <= (1<<7)-1) sz = 8; else if (value >= -(1<<15) && value <= (1<<15)-1) @@ -66,7 +66,7 @@ static bool astGetSizeSign(const Settings *settings, const Token *tok, int *size const Variable *var = tok->variable(); if (!var) return false; - int sz = 0; + unsigned int sz = 0; for (const Token *type = var->typeStartToken(); type; type = type->next()) { if (type->str() == "*") return false; // <- FIXME: handle pointers @@ -185,7 +185,7 @@ void CheckType::checkIntegerOverflow() continue; // get size and sign of result.. - int size = 0; + unsigned int size = 0; char sign = 0; if (!astGetSizeSign(_settings, tok, &size, &sign)) continue; @@ -228,7 +228,7 @@ void CheckType::checkSignConversion() if (!tok->isArithmeticalOp()) continue; - int size = 0; + unsigned int size = 0; char sign = 0; if (!astGetSizeSign(_settings, tok, &size, &sign)) continue; diff --git a/lib/cppcheck.vcxproj b/lib/cppcheck.vcxproj index 880ece4c0..2f00f9012 100644 --- a/lib/cppcheck.vcxproj +++ b/lib/cppcheck.vcxproj @@ -58,6 +58,7 @@ + @@ -103,6 +104,7 @@ + diff --git a/lib/cppcheck.vcxproj.filters b/lib/cppcheck.vcxproj.filters index 710361524..c56e34c29 100644 --- a/lib/cppcheck.vcxproj.filters +++ b/lib/cppcheck.vcxproj.filters @@ -140,6 +140,9 @@ Source Files + + Source Files + @@ -277,6 +280,9 @@ Header Files + + Header Files + diff --git a/test/testrunner.vcxproj b/test/testrunner.vcxproj index e1da25e88..36e80e7ea 100644 --- a/test/testrunner.vcxproj +++ b/test/testrunner.vcxproj @@ -80,6 +80,7 @@ + diff --git a/test/testrunner.vcxproj.filters b/test/testrunner.vcxproj.filters index 5b1700cd0..b92e8aaff 100644 --- a/test/testrunner.vcxproj.filters +++ b/test/testrunner.vcxproj.filters @@ -190,6 +190,9 @@ Source Files + + Source Files +