aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrAutoLocaleSetter.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-01-05 10:37:24 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-05 17:26:43 +0000
commit4d5e65d19a82bf993e95f9986ce1d2b84cf22ff7 (patch)
tree2ce0e9945f2e48dc07d74aa054b9314ef22d4983 /src/gpu/GrAutoLocaleSetter.h
parent70120c778abc42ce754fb8178aa49bf8ce95a5c3 (diff)
Use nullptr to indicate C locale when using xlocale
BUG=chromium:666228 Change-Id: I951102eba2b79ddaa5eb134834471a4a3ec8aed7 Reviewed-on: https://skia-review.googlesource.com/6603 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrAutoLocaleSetter.h')
-rw-r--r--src/gpu/GrAutoLocaleSetter.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gpu/GrAutoLocaleSetter.h b/src/gpu/GrAutoLocaleSetter.h
index 564abd917f..cec041e086 100644
--- a/src/gpu/GrAutoLocaleSetter.h
+++ b/src/gpu/GrAutoLocaleSetter.h
@@ -20,6 +20,9 @@
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
#include <xlocale.h>
+#define HAVE_XLOCALE 1
+#else
+#define HAVE_XLOCALE 0
#endif
#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION)
@@ -45,6 +48,12 @@ public:
fShouldRestoreLocale = false;
}
#elif HAVE_LOCALE_T
+#if HAVE_XLOCALE
+ // In xlocale nullptr means the C locale.
+ if (0 == strcmp(name, "C")) {
+ name = nullptr;
+ }
+#endif
fLocale = newlocale(LC_ALL, name, 0);
if (fLocale) {
fOldLocale = uselocale(fLocale);
@@ -82,5 +91,6 @@ private:
};
#undef HAVE_LOCALE_T
+#undef HAVE_XLOCALE
#endif