diff options
| author | comex <comexk@gmail.com> | 2013-08-30 00:35:36 -0400 |
|---|---|---|
| committer | comex <comexk@gmail.com> | 2013-09-01 22:59:32 -0400 |
| commit | 4f5729dd59bb3db74f889feeb673b22a3f2c3059 (patch) | |
| tree | af09473c9b7c44947968ec9ee7934d3ca023193c /Source/Core/Common/Src/StringUtil.cpp | |
| parent | de0a5fdfbb744c74bf5ce79ba1728d70c6af0ae2 (diff) | |
MSVC warnings.
Diffstat (limited to 'Source/Core/Common/Src/StringUtil.cpp')
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 3c0c01b25f..5d8a26446d 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -164,12 +164,11 @@ bool TryParse(const std::string &str, u32 *const output) if (errno == ERANGE) return false; - if (ULONG_MAX > UINT_MAX) { - // Note: The typecasts avoid GCC warnings when long is 32 bits wide. - if (value >= static_cast<unsigned long>(0x100000000ull) - && value <= static_cast<unsigned long>(0xFFFFFFFF00000000ull)) - return false; - } +#if ULONG_MAX > UINT_MAX + if (value >= 0x100000000ull + && value <= 0xFFFFFFFF00000000ull) + return false; +#endif *output = static_cast<u32>(value); return true; @@ -270,7 +269,7 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st { while(1) { - const int pos = result.find(src); + size_t pos = result.find(src); if (pos == -1) break; result.replace(pos, src.size(), dest); } @@ -317,7 +316,7 @@ std::string UriDecode(const std::string & sSrc) // for future extension" const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); - const int SRC_LEN = sSrc.length(); + const size_t SRC_LEN = sSrc.length(); const unsigned char * const SRC_END = pSrc + SRC_LEN; const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%' @@ -379,7 +378,7 @@ std::string UriEncode(const std::string & sSrc) { const char DEC2HEX[16 + 1] = "0123456789ABCDEF"; const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); - const int SRC_LEN = sSrc.length(); + const size_t SRC_LEN = sSrc.length(); unsigned char * const pStart = new unsigned char[SRC_LEN * 3]; unsigned char * pEnd = pStart; const unsigned char * const SRC_END = pSrc + SRC_LEN; |
