From 7ffed930aba6f84eb48c8f7f925e59247b8b1dc3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 25 Jun 2019 21:38:56 +0100 Subject: Add another raw_convert type. --- src/locale_convert.cc | 13 +++++++++++++ src/locale_convert.h | 4 ++++ src/raw_convert.cc | 7 +++++++ src/raw_convert.h | 4 ++++ 4 files changed, 28 insertions(+) (limited to 'src') diff --git a/src/locale_convert.cc b/src/locale_convert.cc index 46d5507f..915cac82 100644 --- a/src/locale_convert.cc +++ b/src/locale_convert.cc @@ -268,6 +268,19 @@ dcp::locale_convert (string x, int, bool) return y; } +template<> +unsigned long long +dcp::locale_convert (string x, int, bool) +{ + unsigned long long y = 0; +#ifdef LIBDCP_WINDOWS + __mingw_sscanf (x.c_str(), "%llud", &y); +#else + sscanf (x.c_str(), "%llud", &y); +#endif + return y; +} + template<> float dcp::locale_convert (string x, int, bool) diff --git a/src/locale_convert.h b/src/locale_convert.h index d8d84711..aaf0dd6e 100644 --- a/src/locale_convert.h +++ b/src/locale_convert.h @@ -143,6 +143,10 @@ template <> long long locale_convert (std::string x, int, bool); +template <> +unsigned long long +locale_convert (std::string x, int, bool); + template <> float locale_convert (std::string x, int, bool); diff --git a/src/raw_convert.cc b/src/raw_convert.cc index 7b4e6c6d..b4dcb5be 100644 --- a/src/raw_convert.cc +++ b/src/raw_convert.cc @@ -210,6 +210,13 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert (make_local (v), precision, fixed); } +template <> +unsigned long long +dcp::raw_convert (string v, int precision, bool fixed) +{ + return locale_convert (make_local (v), precision, fixed); +} + template <> int dcp::raw_convert (char const * v, int precision, bool fixed) diff --git a/src/raw_convert.h b/src/raw_convert.h index c7b04823..fb3c7954 100644 --- a/src/raw_convert.h +++ b/src/raw_convert.h @@ -136,6 +136,10 @@ template <> long long raw_convert (std::string v, int, bool); +template <> +unsigned long long +raw_convert (std::string v, int, bool); + template <> int raw_convert (char const * v, int, bool); -- cgit v1.2.3