Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(720)

Side by Side Diff: src/gpu/GrAutoLocaleSetter.h

Issue 1162953003: Fix build for UCLIBC platforms (newlocale/freelocale) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 /** 21 /**
22 * Helper class for ensuring that we don't use the wrong locale when building sh aders. Android 22 * Helper class for ensuring that we don't use the wrong locale when building sh aders. Android
23 * doesn't support locale in the NDK, so this is a no-op there. 23 * doesn't support locale in the NDK, so this is a no-op there.
24 */ 24 */
25 class GrAutoLocaleSetter { 25 class GrAutoLocaleSetter {
26 public: 26 public:
27 GrAutoLocaleSetter (const char* name) { 27 GrAutoLocaleSetter (const char* name) {
28 #if defined(SK_BUILD_FOR_WIN) 28 #if defined(SK_BUILD_FOR_WIN)
29 fOldPerThreadLocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); 29 fOldPerThreadLocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
30 fOldLocale = setlocale(LC_ALL, name); 30 fOldLocale = setlocale(LC_ALL, name);
31 #elif !defined(SK_BUILD_FOR_ANDROID) 31 #elif !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
32 fLocale = newlocale(LC_ALL, name, 0); 32 fLocale = newlocale(LC_ALL, name, 0);
33 if (fLocale) { 33 if (fLocale) {
34 fOldLocale = uselocale(fLocale); 34 fOldLocale = uselocale(fLocale);
35 } 35 }
36 #else 36 #else
37 (void) name; // suppress unused param warning. 37 (void) name; // suppress unused param warning.
38 #endif 38 #endif
39 } 39 }
40 40
41 ~GrAutoLocaleSetter () { 41 ~GrAutoLocaleSetter () {
42 #if defined(SK_BUILD_FOR_WIN) 42 #if defined(SK_BUILD_FOR_WIN)
43 setlocale(LC_ALL, fOldLocale); 43 setlocale(LC_ALL, fOldLocale);
44 _configthreadlocale(fOldPerThreadLocale); 44 _configthreadlocale(fOldPerThreadLocale);
45 #elif !defined(SK_BUILD_FOR_ANDROID) 45 #elif !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
46 if (fLocale) { 46 if (fLocale) {
47 uselocale(fOldLocale); 47 uselocale(fOldLocale);
48 freelocale(fLocale); 48 freelocale(fLocale);
49 } 49 }
50 #endif 50 #endif
51 } 51 }
52 52
53 private: 53 private:
54 #if defined(SK_BUILD_FOR_WIN) 54 #if defined(SK_BUILD_FOR_WIN)
55 int fOldPerThreadLocale; 55 int fOldPerThreadLocale;
56 const char* fOldLocale; 56 const char* fOldLocale;
57 #elif !defined(SK_BUILD_FOR_ANDROID) 57 #elif !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
58 locale_t fOldLocale; 58 locale_t fOldLocale;
59 locale_t fLocale; 59 locale_t fLocale;
60 #endif 60 #endif
61 }; 61 };
62 62
63 #endif 63 #endif
64 64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698