| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrAutoLocaleSetter_DEFINED | 8 #ifndef GrAutoLocaleSetter_DEFINED |
| 9 #define GrAutoLocaleSetter_DEFINED | 9 #define GrAutoLocaleSetter_DEFINED |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Helper class for ensuring that we don't use the wrong locale when building sh
aders. Android | 32 * Helper class for ensuring that we don't use the wrong locale when building sh
aders. Android |
| 33 * doesn't support locale in the NDK, so this is a no-op there. | 33 * doesn't support locale in the NDK, so this is a no-op there. |
| 34 */ | 34 */ |
| 35 class GrAutoLocaleSetter : public SkNoncopyable { | 35 class GrAutoLocaleSetter : public SkNoncopyable { |
| 36 public: | 36 public: |
| 37 GrAutoLocaleSetter (const char* name) { | 37 GrAutoLocaleSetter (const char* name) { |
| 38 #if defined(SK_BUILD_FOR_WIN) | 38 #if defined(SK_BUILD_FOR_WIN) |
| 39 fOldPerThreadLocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
| 39 fOldPerThreadLocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); |
| 40 char* oldLocale = setlocale(LC_ALL, name); | 40 char* oldLocale = setlocale(LC_ALL, name); |
| 41 if (oldLocale) { | 41 if (oldLocale) { |
| 42 fOldLocale = oldLocale; | 42 fOldLocale = oldLocale; |
| 43 fShouldRestoreLocale = true; | 43 fShouldRestoreLocale = true; |
| 44 } else { | 44 } else { |
| 45 fShouldRestoreLocale = false; | 45 fShouldRestoreLocale = false; |
| 46 } | 46 } |
| 47 #elif HAVE_LOCALE_T | 47 #elif HAVE_LOCALE_T |
| 48 fLocale = newlocale(LC_ALL, name, 0); | 48 fLocale = newlocale(LC_ALL, name, 0); |
| 49 if (fLocale) { | 49 if (fLocale) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 77 SkString fOldLocale; | 77 SkString fOldLocale; |
| 78 #elif HAVE_LOCALE_T | 78 #elif HAVE_LOCALE_T |
| 79 locale_t fOldLocale; | 79 locale_t fOldLocale; |
| 80 locale_t fLocale; | 80 locale_t fLocale; |
| 81 #endif | 81 #endif |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 #undef HAVE_LOCALE_T | 84 #undef HAVE_LOCALE_T |
| 85 | 85 |
| 86 #endif | 86 #endif |
| 87 | |
| OLD | NEW |