8#ifndef GrAutoLocaleSetter_DEFINED
9#define GrAutoLocaleSetter_DEFINED
14#if defined(SK_BUILD_FOR_WIN)
18#if !defined(SK_BUILD_FOR_ANDROID)
22#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
30#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION)
31#define HAVE_LOCALE_T 0
33#define HAVE_LOCALE_T 1
43#if defined(SK_BUILD_FOR_WIN)
44 fOldPerThreadLocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
45 char* oldLocale = setlocale(LC_ALL,
name);
47 fOldLocale = oldLocale;
48 fShouldRestoreLocale =
true;
50 fShouldRestoreLocale =
false;
55 if (0 == strcmp(
name,
"C")) {
59 fLocale = newlocale(LC_ALL_MASK,
name,
nullptr);
61 fOldLocale = uselocale(fLocale);
63 fOldLocale =
static_cast<locale_t
>(
nullptr);
71#if defined(SK_BUILD_FOR_WIN)
72 if (fShouldRestoreLocale) {
73 setlocale(LC_ALL, fOldLocale.c_str());
75 _configthreadlocale(fOldPerThreadLocale);
78 uselocale(fOldLocale);
85#if defined(SK_BUILD_FOR_WIN)
86 int fOldPerThreadLocale;
87 bool fShouldRestoreLocale;
GrAutoLocaleSetter(const char *name)
DEF_SWITCHES_START aot vmservice shared library name