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>
This commit is contained in:
Brian Salomon 2017-01-05 10:37:24 -05:00 committed by Skia Commit-Bot
parent 70120c778a
commit 4d5e65d19a

View File

@ -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