diff options
author | Martin Ebourne <martin@ebourne.me.uk> | 2005-12-14 23:19:45 +0000 |
---|---|---|
committer | Martin Ebourne <martin@ebourne.me.uk> | 2005-12-14 23:19:45 +0000 |
commit | ba4d99e2ec8765bfe15623ca79469b175e9856e8 (patch) | |
tree | 602e340897e6a78e9d04e0f132b979d3f8335f25 | |
parent | 47154e8adeb55a719c09c4f496bab713a19d2e42 (diff) |
Fix assert on 64 bit
-rw-r--r-- | lib/common/ConversionString.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/common/ConversionString.cpp b/lib/common/ConversionString.cpp index 9e237a77..b86bad4f 100644 --- a/lib/common/ConversionString.cpp +++ b/lib/common/ConversionString.cpp @@ -72,11 +72,17 @@ int32_t BoxConvert::_ConvertStringToInt(const char *pString, int Size) { case 32: { - // No extra checking needed, if this assert holds true - ASSERT(sizeof(long) == sizeof(int32_t)); + // No extra checking needed if long is an int32 + if(sizeof(long) > sizeof(int32_t)) + { + if(r <= (0 - 0x7fffffffL) || r > 0x7fffffffL) + { + THROW_EXCEPTION(ConversionException, IntOverflowInConvertFromString) + } + } + break; } - break; - + case 16: { if(r <= (0 - 0x7fff) || r > 0x7fff) |