[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Nov 13 23:04:56 UTC 2017


 src/hb-common.cc |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 7f39f576148643b4790fd70361e328b4b4da3149
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Nov 13 15:04:13 2017 -0800

    Implement strtod_l() on MSVC
    
    Patch from Jean Ghali on mailing list.

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 5c4a2c76..92720d9e 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -699,34 +699,43 @@ parse_uint32 (const char **pp, const char *end, uint32_t *pv)
 
 #if defined (HAVE_NEWLOCALE) && defined (HAVE_STRTOD_L)
 #define USE_XLOCALE 1
+#define HB_LOCALE_T locale_t
+#define HB_CREATE_LOCALE(locName) newlocale (LC_ALL_MASK, locName, nullptr)
+#define HB_FREE_LOCALE(loc) freelocale (loc)
+#elif defined(_MSC_VER)
+#define USE_XLOCALE 1
+#define HB_LOCALE_T _locale_t
+#define HB_CREATE_LOCALE(locName) _create_locale (LC_ALL, locName)
+#define HB_FREE_LOCALE(loc) _free_locale (loc)
+#define strtod_l(a, b, c) _strtod_l ((a), (b), (c))
 #endif
 
 #ifdef USE_XLOCALE
 
-static locale_t C_locale;
+static HB_LOCALE_T C_locale;
 
 #ifdef HB_USE_ATEXIT
 static void
 free_C_locale (void)
 {
   if (C_locale)
-    freelocale (C_locale);
+    HB_FREE_LOCALE (C_locale);
 }
 #endif
 
-static locale_t
+static HB_LOCALE_T
 get_C_locale (void)
 {
 retry:
-  locale_t C = (locale_t) hb_atomic_ptr_get (&C_locale);
+  HB_LOCALE_T C = (HB_LOCALE_T) hb_atomic_ptr_get (&C_locale);
 
   if (unlikely (!C))
   {
-    C = newlocale (LC_ALL_MASK, "C", nullptr);
+    C = HB_CREATE_LOCALE ("C");
 
     if (!hb_atomic_ptr_cmpexch (&C_locale, nullptr, C))
     {
-      freelocale (C_locale);
+      HB_FREE_LOCALE (C_locale);
       goto retry;
     }
 


More information about the HarfBuzz mailing list