From ef8f53fd64eebca831548c3a3d92932746970b16 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Mar 2026 22:47:41 -0300 Subject: [PATCH] vector: gate localeconv_l and fall back to localeconv Fixes https://github.com/harfbuzz/harfbuzz/issues/5791 --- meson.build | 1 + src/hb-vector-svg-utils.cc | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 15adc6ba3..fb297e618 100644 --- a/meson.build +++ b/meson.build @@ -101,6 +101,7 @@ check_funcs = [ ['isatty', {'prefix': '#include '}], ['uselocale', {'prefix': '#include '}], ['newlocale', {'prefix': '#include '}], + ['localeconv_l', {'prefix': '#include '}], ['sincos', {'prefix': '#define _GNU_SOURCE\n#include '}], ['sincosf', {'prefix': '#define _GNU_SOURCE\n#include '}], ] diff --git a/src/hb-vector-svg-utils.cc b/src/hb-vector-svg-utils.cc index 5a6ce5580..766b98e7f 100644 --- a/src/hb-vector-svg-utils.cc +++ b/src/hb-vector-svg-utils.cc @@ -53,17 +53,19 @@ static struct hb_svg_decimal_point_lazy_loader_t p->value[1] = '\0'; #ifndef HB_NO_SETLOCALE -#if defined(HAVE_XLOCALE_H) lconv *lc = nullptr; +#ifdef HAVE_LOCALECONV_L hb_locale_t current_locale = hb_uselocale ((hb_locale_t) 0); if (current_locale) lc = localeconv_l (current_locale); +#endif + if (!lc) + lc = localeconv (); if (lc && lc->decimal_point && lc->decimal_point[0]) { strncpy (p->value, lc->decimal_point, sizeof (p->value) - 1); p->value[sizeof (p->value) - 1] = '\0'; } -#endif #endif hb_atexit (free_static_svg_decimal_point);