aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrAutoLocaleSetter.h
diff options
context:
space:
mode:
authorGravatar smklein <smklein@chromium.org>2015-12-15 10:52:51 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-15 10:52:51 -0800
commitdb284c52e62e8d16708e2065495a3b693b238771 (patch)
tree9d47ad06540b992da797bfb6d0a18ebf8262f9bb /src/gpu/GrAutoLocaleSetter.h
parent4541f6e2e3a4fc0d85d77d8b983d23f36e85daa1 (diff)
Porting Skia for newlib compatibility.
"locale_t" is not defined for Newlib. BUG=https://github.com/domokit/mojo/issues/431 Review URL: https://codereview.chromium.org/1526703003
Diffstat (limited to 'src/gpu/GrAutoLocaleSetter.h')
-rw-r--r--src/gpu/GrAutoLocaleSetter.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gpu/GrAutoLocaleSetter.h b/src/gpu/GrAutoLocaleSetter.h
index 08196debf6..6bfff0cd89 100644
--- a/src/gpu/GrAutoLocaleSetter.h
+++ b/src/gpu/GrAutoLocaleSetter.h
@@ -22,6 +22,12 @@
#include <xlocale.h>
#endif
+#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION)
+#define HAVE_LOCALE_T 0
+#else
+#define HAVE_LOCALE_T 1
+#endif
+
/**
* Helper class for ensuring that we don't use the wrong locale when building shaders. Android
* doesn't support locale in the NDK, so this is a no-op there.
@@ -38,7 +44,7 @@ public:
} else {
fShouldRestoreLocale = false;
}
-#elif !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
+#elif HAVE_LOCALE_T
fLocale = newlocale(LC_ALL, name, 0);
if (fLocale) {
fOldLocale = uselocale(fLocale);
@@ -56,7 +62,7 @@ public:
setlocale(LC_ALL, fOldLocale.c_str());
}
_configthreadlocale(fOldPerThreadLocale);
-#elif !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
+#elif HAVE_LOCALE_T
if (fLocale) {
uselocale(fOldLocale);
freelocale(fLocale);
@@ -69,11 +75,13 @@ private:
int fOldPerThreadLocale;
bool fShouldRestoreLocale;
SkString fOldLocale;
-#elif !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
+#elif HAVE_LOCALE_T
locale_t fOldLocale;
locale_t fLocale;
#endif
};
+#undef HAVE_LOCALE_T
+
#endif