Browse Source

Android doesn’t have locale via NDK, change over to standard Atomic platform define guards

Josh Engebretson 8 years ago
parent
commit
8656e35df9
1 changed files with 16 additions and 11 deletions
  1. 16 11
      Source/Atomic/Core/StringUtils.cpp

+ 16 - 11
Source/Atomic/Core/StringUtils.cpp

@@ -37,43 +37,48 @@
 // which uses a dot as decimal separator.
 // which uses a dot as decimal separator.
 
 
 #include <locale.h>
 #include <locale.h>
-#ifdef __APPLE__
+#ifdef ATOMIC_PLATFORM_OSX
 #include <xlocale.h>
 #include <xlocale.h>
 #endif
 #endif
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-#ifdef _WIN32
+#ifdef ATOMIC_PLATFORM_WINDOWS
 
 
-static
-_locale_t get_c_locale()
+static _locale_t get_c_locale()
 {
 {
     static _locale_t loc = _create_locale(LC_ALL, "C");
     static _locale_t loc = _create_locale(LC_ALL, "C");
     return loc;
     return loc;
 }
 }
 
 
-static
-double strtod_c_locale(const char* nptr, char** endptr)
+static double strtod_c_locale(const char* nptr, char** endptr)
 {
 {
     return _strtod_l(nptr, endptr, get_c_locale());
     return _strtod_l(nptr, endptr, get_c_locale());
 }
 }
 
 
+#elif defined(ATOMIC_PLATFORM_ANDROID)
+
+// Android doesn't do locale via NDK, so just revert to strtod
+
+static double strtod_c_locale(const char* nptr, char** endptr)
+{
+    return strtod(nptr, endptr);
+}
+
 #else
 #else
 
 
-static
-locale_t get_c_locale()
+static locale_t get_c_locale()
 {
 {
     static locale_t loc = newlocale(LC_ALL_MASK, "C", NULL);
     static locale_t loc = newlocale(LC_ALL_MASK, "C", NULL);
     return loc;
     return loc;
 }
 }
 
 
-static
-double strtod_c_locale(const char* nptr, char** endptr)
+static double strtod_c_locale(const char* nptr, char** endptr)
 {
 {
     return strtod_l(nptr, endptr, get_c_locale());
     return strtod_l(nptr, endptr, get_c_locale());
 }
 }
 
 
-#endif // _WIN32
+#endif // ATOMIC_PLATFORM_WINDOWS
 
 
 // ATOMIC END
 // ATOMIC END