summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-03-23 21:37:17 +0000
committerCarl Hetherington <cth@carlh.net>2019-03-23 21:37:17 +0000
commitcaa3f20cd224f88f7a785618b63000f44a06da3a (patch)
treea7003375ace7992848d5b9eb9be20f44bd7cc90d /src
parent3c371e9aead80bfed91ae208e2ce782c7bf4901b (diff)
Add string -> long long conversion for OS X.
Diffstat (limited to 'src')
-rw-r--r--src/cxml.cc20
-rw-r--r--src/cxml.h4
2 files changed, 24 insertions, 0 deletions
diff --git a/src/cxml.cc b/src/cxml.cc
index f667584..3fa3d94 100644
--- a/src/cxml.cc
+++ b/src/cxml.cc
@@ -349,6 +349,19 @@ locale_convert (string x)
}
template<>
+long long
+locale_convert (string x)
+{
+ long long y = 0;
+#ifdef LIBCXML_WINDOWS
+ __mingw_sscanf (x.c_str(), "%lld", &y);
+#else
+ sscanf (x.c_str(), "%lld", &y);
+#endif
+ return y;
+}
+
+template<>
float
locale_convert (string x)
{
@@ -381,6 +394,13 @@ cxml::raw_convert (string v)
}
template <>
+long long
+cxml::raw_convert (string v)
+{
+ return locale_convert<long long> (make_local(v));
+}
+
+template <>
unsigned int
cxml::raw_convert (string v)
{
diff --git a/src/cxml.h b/src/cxml.h
index 20a948a..bd04af1 100644
--- a/src/cxml.h
+++ b/src/cxml.h
@@ -91,6 +91,10 @@ long int
raw_convert (std::string v);
template <>
+long long
+raw_convert (std::string v);
+
+template <>
float
raw_convert (std::string v);