Ticket #21907: 0001-Bug-21907-fix-runtime-error-on-CentOS-6-v3.patch

File 0001-Bug-21907-fix-runtime-error-on-CentOS-6-v3.patch, 4.0 KB (added by boklm, 3 years ago)
  • gfx/harfbuzz/src/hb-glib.cc

    From 227375b072f4b5d215466db26a7370cee8a3dbe5 Mon Sep 17 00:00:00 2001
    From: Nicolas Vigier <boklm@torproject.org>
    Date: Mon, 10 Apr 2017 16:07:23 +0200
    Subject: [PATCH] Bug 21907: fix runtime error on CentOS 6
    
    In Mozilla bug 1324780, support for building with glib 2.28 (the version
    available in CentOS 6) was added. However we are building on Debian
    Wheezy which has glib 2.32. We fix that by backing out all glib > 2.28
    code paths.
    ---
     gfx/harfbuzz/src/hb-glib.cc | 41 -----------------------------------------
     gfx/harfbuzz/src/hb-glib.h  |  5 -----
     2 files changed, 46 deletions(-)
    
    diff --git a/gfx/harfbuzz/src/hb-glib.cc b/gfx/harfbuzz/src/hb-glib.cc
    index 2b91b5b..0971ca2 100644
    a b  
    3333#include "hb-unicode-private.hh"
    3434
    3535
    36 #if !GLIB_CHECK_VERSION(2,29,14)
    3736static const hb_script_t
    3837glib_script_to_script[] =
    3938{
    glib_script_to_script[] = 
    155154  HB_SCRIPT_SORA_SOMPENG,
    156155  HB_SCRIPT_TAKRI
    157156};
    158 #endif
    159157
    160158hb_script_t
    161159hb_glib_script_to_script (GUnicodeScript script)
    162160{
    163 #if GLIB_CHECK_VERSION(2,29,14)
    164   return (hb_script_t) g_unicode_script_to_iso15924 (script);
    165 #else
    166161  if (likely ((unsigned int) script < ARRAY_LENGTH (glib_script_to_script)))
    167162    return glib_script_to_script[script];
    168163
    hb_glib_script_to_script (GUnicodeScript script) 
    170165    return HB_SCRIPT_INVALID;
    171166
    172167  return HB_SCRIPT_UNKNOWN;
    173 #endif
    174168}
    175169
    176170GUnicodeScript
    177171hb_glib_script_from_script (hb_script_t script)
    178172{
    179 #if GLIB_CHECK_VERSION(2,29,14)
    180   return g_unicode_script_from_iso15924 (script);
    181 #else
    182173  unsigned int count = ARRAY_LENGTH (glib_script_to_script);
    183174  for (unsigned int i = 0; i < count; i++)
    184175    if (glib_script_to_script[i] == script)
    hb_glib_script_from_script (hb_script_t script) 
    188179    return G_UNICODE_SCRIPT_INVALID_CODE;
    189180
    190181  return G_UNICODE_SCRIPT_UNKNOWN;
    191 #endif
    192182}
    193183
    194184
    hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, 
    243233                         hb_codepoint_t     *ab,
    244234                         void               *user_data HB_UNUSED)
    245235{
    246 #if GLIB_CHECK_VERSION(2,29,12)
    247   return g_unichar_compose (a, b, ab);
    248 #endif
    249 
    250236  /* We don't ifdef-out the fallback code such that compiler always
    251237   * sees it and makes sure it's compilable. */
    252238
    hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, 
    280266                           hb_codepoint_t     *b,
    281267                           void               *user_data HB_UNUSED)
    282268{
    283 #if GLIB_CHECK_VERSION(2,29,12)
    284   return g_unichar_decompose (ab, a, b);
    285 #endif
    286 
    287269  /* We don't ifdef-out the fallback code such that compiler always
    288270   * sees it and makes sure it's compilable. */
    289271
    hb_glib_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED, 
    339321                                         hb_codepoint_t     *decomposed,
    340322                                         void               *user_data HB_UNUSED)
    341323{
    342 #if GLIB_CHECK_VERSION(2,29,12)
    343   return g_unichar_fully_decompose (u, true, decomposed, HB_UNICODE_MAX_DECOMPOSITION_LEN);
    344 #endif
    345 
    346324  /* If the user doesn't have GLib >= 2.29.12 we have to perform
    347325   * a round trip to UTF-8 and the associated memory management dance. */
    348326  gchar utf8[6];
    hb_glib_get_unicode_funcs (void) 
    381359
    382360  return const_cast<hb_unicode_funcs_t *> (&_hb_glib_unicode_funcs);
    383361}
    384 
    385 #if GLIB_CHECK_VERSION(2,31,10)
    386 /**
    387  * hb_glib_blob_create:
    388  *
    389  * Since: 0.9.38
    390  **/
    391 hb_blob_t *
    392 hb_glib_blob_create (GBytes *gbytes)
    393 {
    394   gsize size = 0;
    395   gconstpointer data = g_bytes_get_data (gbytes, &size);
    396   return hb_blob_create ((const char *) data,
    397                          size,
    398                          HB_MEMORY_MODE_READONLY,
    399                          g_bytes_ref (gbytes),
    400                          (hb_destroy_func_t) g_bytes_unref);
    401 }
    402 #endif
  • gfx/harfbuzz/src/hb-glib.h

    diff --git a/gfx/harfbuzz/src/hb-glib.h b/gfx/harfbuzz/src/hb-glib.h
    index 5f04183..4adbd7c 100644
    a b hb_glib_script_from_script (hb_script_t script); 
    4646HB_EXTERN hb_unicode_funcs_t *
    4747hb_glib_get_unicode_funcs (void);
    4848
    49 #if GLIB_CHECK_VERSION(2,31,10)
    50 HB_EXTERN hb_blob_t *
    51 hb_glib_blob_create (GBytes *gbytes);
    52 #endif
    53 
    5449HB_END_DECLS
    5550
    5651#endif /* HB_GLIB_H */