Skip to content

Instantly share code, notes, and snippets.

@Alexpux
Created July 31, 2019 18:18
Show Gist options
  • Save Alexpux/956d82734481e519f5d07292a4455a47 to your computer and use it in GitHub Desktop.
Save Alexpux/956d82734481e519f5d07292a4455a47 to your computer and use it in GitHub Desktop.
--- oiio-Release-2.0.9/src/libutil/strutil.cpp.orig 2019-07-31 21:11:04.159918000 +0300
+++ oiio-Release-2.0.9/src/libutil/strutil.cpp 2019-07-31 21:13:44.496999600 +0300
@@ -53,6 +53,15 @@
#ifdef _WIN32
# include <shellapi.h>
+# define locale_t _locale_t
+#if defined(__MINGW32__)
+inline locale_t createlocale(int _Category,const char *_Locale) {
+ locale_t loc;
+ return loc;
+}
+#else
+# define createlocale _create_locale
+#endif
#endif
@@ -1227,9 +1236,9 @@
# else
return strtof_l(nptr, endptr, c_loc);
# endif
-#elif defined (_MSC_VER)
+#elif defined (_WIN32)
// Windows has _strtod_l
- static _locale_t c_loc = _create_locale(LC_ALL, "C");
+ static _locale_t c_loc = createlocale(LC_ALL, "C");
return static_cast<float>(_strtod_l(nptr, endptr, c_loc));
#else
// On platforms without strtof_l...
@@ -1265,9 +1274,9 @@
// static initialization inside function is thread-safe by C++11 rules!
static locale_t c_loc = newlocale(LC_ALL_MASK, "C", nullptr);
return strtod_l(nptr, endptr, c_loc);
-#elif defined (_MSC_VER)
+#elif defined (_WIN32)
// Windows has _strtod_l
- static _locale_t c_loc = _create_locale(LC_ALL, "C");
+ static _locale_t c_loc = createlocale(LC_ALL, "C");
return _strtod_l(nptr, endptr, c_loc);
#else
// On platforms without strtod_l...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment