Further adjust setlocale
Fixes https://github.com/harfbuzz/harfbuzz/issues/3375#issuecomment-1013783496
This commit is contained in:
parent
63affc4eae
commit
b97e4f7084
|
@ -41,17 +41,18 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
using hb_locale_t = _locale_t;
|
#define hb_locale_t _locale_t;
|
||||||
#else
|
#else
|
||||||
using hb_locale_t = locale_t;
|
#define hb_locale_t locale_t;
|
||||||
#endif
|
#endif
|
||||||
|
#define hb_setlocale setlocale
|
||||||
|
#define hb_uselocale uselocale
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
using hb_locale_t = void *;
|
|
||||||
#define hb_locale_t void *
|
#define hb_locale_t void *
|
||||||
#define setlocale(Category, Locale) "C"
|
#define hb_setlocale(Category, Locale) "C"
|
||||||
#define uselocale(Locale) ((hb_locale_t) 0)
|
#define hb_uselocale(Locale) ((hb_locale_t) 0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -433,7 +434,7 @@ hb_language_get_default ()
|
||||||
hb_language_t language = default_language;
|
hb_language_t language = default_language;
|
||||||
if (unlikely (language == HB_LANGUAGE_INVALID))
|
if (unlikely (language == HB_LANGUAGE_INVALID))
|
||||||
{
|
{
|
||||||
language = hb_language_from_string (setlocale (LC_CTYPE, nullptr), -1);
|
language = hb_language_from_string (hb_setlocale (LC_CTYPE, nullptr), -1);
|
||||||
(void) default_language.cmpexch (HB_LANGUAGE_INVALID, language);
|
(void) default_language.cmpexch (HB_LANGUAGE_INVALID, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1127,9 +1128,9 @@ hb_variation_to_string (hb_variation_t *variation,
|
||||||
s[len++] = '=';
|
s[len++] = '=';
|
||||||
|
|
||||||
hb_locale_t oldlocale HB_UNUSED;
|
hb_locale_t oldlocale HB_UNUSED;
|
||||||
oldlocale = uselocale (get_C_locale ());
|
oldlocale = hb_uselocale (get_C_locale ());
|
||||||
len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", (double) variation->value));
|
len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", (double) variation->value));
|
||||||
(void) uselocale (oldlocale);
|
(void) hb_uselocale (oldlocale);
|
||||||
|
|
||||||
assert (len < ARRAY_LENGTH (s));
|
assert (len < ARRAY_LENGTH (s));
|
||||||
len = hb_min (len, size - 1);
|
len = hb_min (len, size - 1);
|
||||||
|
|
Loading…
Reference in New Issue