From 4fa8274be83aeaa0c9503a778b2b17f673570723 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 12 Jun 2019 16:08:25 +0100 Subject: Add another type to raw/locale convert. --- 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 5164f89f..46d5507f 100644 --- a/src/locale_convert.cc +++ b/src/locale_convert.cc @@ -242,6 +242,19 @@ dcp::locale_convert (string x, int, bool) return y; } +template<> +unsigned long +dcp::locale_convert (string x, int, bool) +{ + unsigned long y = 0; +#ifdef LIBDCP_WINDOWS + __mingw_sscanf (x.c_str(), "%lud", &y); +#else + sscanf (x.c_str(), "%lud", &y); +#endif + return y; +} + template<> long long dcp::locale_convert (string x, int, bool) diff --git a/src/locale_convert.h b/src/locale_convert.h index 7d09c8e7..d8d84711 100644 --- a/src/locale_convert.h +++ b/src/locale_convert.h @@ -135,6 +135,10 @@ template <> long locale_convert (std::string x, int, bool); +template <> +unsigned long +locale_convert (std::string x, int, bool); + template <> long long locale_convert (std::string x, int, bool); diff --git a/src/raw_convert.cc b/src/raw_convert.cc index f51a10f6..7b4e6c6d 100644 --- a/src/raw_convert.cc +++ b/src/raw_convert.cc @@ -196,6 +196,13 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert (make_local (v), precision, fixed); } +template <> +unsigned long +dcp::raw_convert (string v, int precision, bool fixed) +{ + return locale_convert (make_local (v), precision, fixed); +} + template <> long long dcp::raw_convert (string v, int precision, bool fixed) diff --git a/src/raw_convert.h b/src/raw_convert.h index 4945c7f8..c7b04823 100644 --- a/src/raw_convert.h +++ b/src/raw_convert.h @@ -128,6 +128,10 @@ template <> long raw_convert (std::string v, int, bool); +template <> +unsigned long +raw_convert (std::string v, int, bool); + template <> long long raw_convert (std::string v, int, bool); -- cgit v1.2.3