diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-10-17 10:14:52 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-10-17 10:14:52 -0700 |
commit | 122157eb0e58977a290f33dcbeff349d6099f925 (patch) | |
tree | d49ac7055a008c8c4b23bcd46903040f4f704291 | |
parent | 4230292830e1eead17c5910dc15e008d0b34d247 (diff) |
Fix argument mismatch in integer parsing
The minneg argument is supposed to be the absolute value of the minimum negative
representable number. In case of two-complement arithmetic, it's the same as the
value itself but it's better to be explicit and negate the argument.
-rw-r--r-- | src/pugixml.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index c7ccaee..8fb3cdc 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4401,7 +4401,7 @@ PUGI__NS_BEGIN PUGI__FN int get_value_int(const char_t* value) { - return string_to_integer<unsigned int>(value, static_cast<unsigned int>(INT_MIN), INT_MAX); + return string_to_integer<unsigned int>(value, 0 - static_cast<unsigned int>(INT_MIN), INT_MAX); } PUGI__FN unsigned int get_value_uint(const char_t* value) @@ -4439,7 +4439,7 @@ PUGI__NS_BEGIN #ifdef PUGIXML_HAS_LONG_LONG PUGI__FN long long get_value_llong(const char_t* value) { - return string_to_integer<unsigned long long>(value, static_cast<unsigned long long>(LLONG_MIN), LLONG_MAX); + return string_to_integer<unsigned long long>(value, 0 - static_cast<unsigned long long>(LLONG_MIN), LLONG_MAX); } PUGI__FN unsigned long long get_value_ullong(const char_t* value) |