From 0b6c8aa1e030fe671ea9759a37fcc4c81c241f06 Mon Sep 17 00:00:00 2001 From: Aleksandar Fabijanic Date: Sat, 13 Oct 2012 05:10:49 +0000 Subject: [PATCH] use signed char for sign; silence clang warnings --- Foundation/include/Poco/NumericString.h | 2 +- Foundation/testsuite/src/StringTest.h | 38 ++++++++++++------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Foundation/include/Poco/NumericString.h b/Foundation/include/Poco/NumericString.h index 765a014b0..61b64f7dd 100644 --- a/Foundation/include/Poco/NumericString.h +++ b/Foundation/include/Poco/NumericString.h @@ -91,7 +91,7 @@ bool strToInt(const char* pStr, I& result, short base, char thSep = ',') if (!pStr) return false; while (isspace(*pStr)) ++pStr; if (*pStr == '\0') return false; - I sign = 1; + char sign = 1; if ((base == 10) && (*pStr == '-')) { sign = -1; diff --git a/Foundation/testsuite/src/StringTest.h b/Foundation/testsuite/src/StringTest.h index 6d5d19248..0e8cf305d 100644 --- a/Foundation/testsuite/src/StringTest.h +++ b/Foundation/testsuite/src/StringTest.h @@ -82,42 +82,42 @@ private: { T result = 0; if (123 <= std::numeric_limits::max()) - assert(strToInt("123", result, 10)); assert(result == 123); + assert(Poco::strToInt("123", result, 10)); assert(result == 123); - assert(strToInt("0", result, 10)); assert(result == 0); - assert(strToInt("000", result, 10)); assert(result == 0); + assert(Poco::strToInt("0", result, 10)); assert(result == 0); + assert(Poco::strToInt("000", result, 10)); assert(result == 0); if (123 < std::numeric_limits::max()) - { assert(strToInt(" 123 ", result, 10)); assert(result == 123); } + { assert(Poco::strToInt(" 123 ", result, 10)); assert(result == 123); } if (123 < std::numeric_limits::max()) - { assert(strToInt(" 123", result, 10)); assert(result == 123); } + { assert(Poco::strToInt(" 123", result, 10)); assert(result == 123); } if (123 < std::numeric_limits::max()) - { assert(strToInt("123 ", result, 10)); assert(result == 123); } + { assert(Poco::strToInt("123 ", result, 10)); assert(result == 123); } if (std::numeric_limits::is_signed && (-123 > std::numeric_limits::min())) - { assert(strToInt("-123", result, 10)); assert(result == -123); } + { assert(Poco::strToInt("-123", result, 10)); assert(result == -123); } if (0x123 < std::numeric_limits::max()) - { assert(strToInt("123", result, 0x10)); assert(result == 0x123); } + { assert(Poco::strToInt("123", result, 0x10)); assert(result == 0x123); } if (0x12ab < std::numeric_limits::max()) - { assert(strToInt("12AB", result, 0x10)); assert(result == 0x12ab); } + { assert(Poco::strToInt("12AB", result, 0x10)); assert(result == 0x12ab); } if (0x12ab < std::numeric_limits::max()) - { assert(strToInt("0X12AB", result, 0x10)); assert(result == 0x12ab); } + { assert(Poco::strToInt("0X12AB", result, 0x10)); assert(result == 0x12ab); } if (0x12ab < std::numeric_limits::max()) - { assert(strToInt("0x12AB", result, 0x10)); assert(result == 0x12ab); } + { assert(Poco::strToInt("0x12AB", result, 0x10)); assert(result == 0x12ab); } if (0x12ab < std::numeric_limits::max()) - { assert(strToInt("0x12aB", result, 0x10)); assert(result == 0x12ab); } + { assert(Poco::strToInt("0x12aB", result, 0x10)); assert(result == 0x12ab); } if (0x98fe < std::numeric_limits::max()) - { assert(strToInt("0X98Fe", result, 0x10)); assert(result == 0x98fe); } + { assert(Poco::strToInt("0X98Fe", result, 0x10)); assert(result == 0x98fe); } if (123 < std::numeric_limits::max()) - { assert(strToInt("0x0", result, 0x10)); assert(result == 0); } + { assert(Poco::strToInt("0x0", result, 0x10)); assert(result == 0); } if (123 < std::numeric_limits::max()) - { assert(strToInt("00", result, 0x10)); assert(result == 0); } + { assert(Poco::strToInt("00", result, 0x10)); assert(result == 0); } if (0123 < std::numeric_limits::max()) - { assert(strToInt("123", result, 010)); assert(result == 0123); } + { assert(Poco::strToInt("123", result, 010)); assert(result == 0123); } if (0123 < std::numeric_limits::max()) - { assert(strToInt("0123", result, 010)); assert(result == 0123); } + { assert(Poco::strToInt("0123", result, 010)); assert(result == 0123); } - assert(strToInt("0", result, 010)); assert(result == 0); - assert(strToInt("000", result, 010)); assert(result == 0); + assert(Poco::strToInt("0", result, 010)); assert(result == 0); + assert(Poco::strToInt("000", result, 010)); assert(result == 0); } template