diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-05-20 20:35:49 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-05-20 20:35:49 +0000 |
commit | ba1b2017dbc865735bebe01a0f0da2e97f1dab12 (patch) | |
tree | b8e9ab4de5ffa6b43825b5928ec1e2781bc45808 /src/pugixml.cpp | |
parent | 1f5be930d03c3704a524dad31464220ece1229e4 (diff) |
as_* functions now all use strto*/wcsto* functions; this unifies the behavior and fixes large unsigned integer parsing in as_uint
git-svn-id: http://pugixml.googlecode.com/svn/trunk@438 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r-- | src/pugixml.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 04fb1db..e6784ae 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -3067,7 +3067,7 @@ namespace pugi #ifdef PUGIXML_WCHAR_MODE
return (int)wcstol(_attr->value, 0, 10);
#else
- return atoi(_attr->value);
+ return (int)strtol(_attr->value, 0, 10);
#endif
}
@@ -3076,12 +3076,10 @@ namespace pugi if (!_attr || !_attr->value) return 0;
#ifdef PUGIXML_WCHAR_MODE
- int result = (int)wcstol(_attr->value, 0, 10);
+ return (unsigned int)wcstoul(_attr->value, 0, 10);
#else
- int result = atoi(_attr->value);
+ return (unsigned int)strtoul(_attr->value, 0, 10);
#endif
-
- return result < 0 ? 0 : static_cast<unsigned int>(result);
}
double xml_attribute::as_double() const
@@ -3091,7 +3089,7 @@ namespace pugi #ifdef PUGIXML_WCHAR_MODE
return wcstod(_attr->value, 0);
#else
- return atof(_attr->value);
+ return strtod(_attr->value, 0);
#endif
}
@@ -3102,7 +3100,7 @@ namespace pugi #ifdef PUGIXML_WCHAR_MODE
return (float)wcstod(_attr->value, 0);
#else
- return (float)atof(_attr->value);
+ return (float)strtod(_attr->value, 0);
#endif
}
|