diff options
Diffstat (limited to 'src/lib/util/xmlfile.cpp')
-rw-r--r-- | src/lib/util/xmlfile.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp index 445c3fbb4f7..2ef0acfcf0c 100644 --- a/src/lib/util/xmlfile.cpp +++ b/src/lib/util/xmlfile.cpp @@ -8,13 +8,12 @@ ***************************************************************************/ -#include <cassert> - #include "xmlfile.h" #include <expat.h> #include <algorithm> +#include <cassert> #include <cctype> #include <cstdlib> #include <cstring> @@ -582,7 +581,7 @@ const char *data_node::get_attribute_string(const char *attribute, const char *d found, return = the provided default -------------------------------------------------*/ -int data_node::get_attribute_int(const char *attribute, int defvalue) const +long long data_node::get_attribute_int(const char *attribute, long long defvalue) const { char const *const string = get_attribute_string(attribute, nullptr); if (!string) @@ -590,20 +589,20 @@ int data_node::get_attribute_int(const char *attribute, int defvalue) const std::istringstream stream; stream.imbue(f_portable_locale); - int result; + long long result; if (string[0] == '$') { stream.str(&string[1]); - unsigned uvalue; + unsigned long long uvalue; stream >> std::hex >> uvalue; - result = int(uvalue); + result = static_cast<long long>(uvalue); } else if ((string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X'))) { stream.str(&string[2]); - unsigned uvalue; + unsigned long long uvalue; stream >> std::hex >> uvalue; - result = int(uvalue); + result = static_cast<long long>(uvalue); } else if (string[0] == '#') { @@ -690,7 +689,7 @@ void data_node::set_attribute(const char *name, const char *value) integer value on the node -------------------------------------------------*/ -void data_node::set_attribute_int(const char *name, int value) +void data_node::set_attribute_int(const char *name, long long value) { set_attribute(name, string_format(f_portable_locale, "%d", value).c_str()); } |