[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Oct 27 15:46:07 PDT 2013


 src/test-buffer-serialize.cc |    7 +++++--
 src/test-size-params.cc      |    7 +++++--
 src/test-would-substitute.cc |    7 +++++--
 src/test.cc                  |    7 +++++--
 util/options.cc              |    4 ++--
 util/options.hh              |    4 ++++
 util/view-cairo.hh           |    4 ++++
 7 files changed, 30 insertions(+), 10 deletions(-)

New commits:
commit c2bc818706df56022c8bb922df2b741cb120f7e4
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Oct 27 23:36:35 2013 +0100

    Work with old and new glib
    
    Avoids "deprecated" warnings.

diff --git a/src/test-buffer-serialize.cc b/src/test-buffer-serialize.cc
index 2287b94..18c46e9 100644
--- a/src/test-buffer-serialize.cc
+++ b/src/test-buffer-serialize.cc
@@ -34,7 +34,10 @@
 #endif
 
 #ifdef HAVE_GLIB
-#include <glib.h>
+# include <glib.h>
+# if !GLIB_CHECK_VERSION (2, 22, 0)
+#  define g_mapped_file_unref g_mapped_file_free
+# endif
 #endif
 #include <stdlib.h>
 #include <stdio.h>
@@ -61,7 +64,7 @@ main (int argc, char **argv)
     GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
     font_data = g_mapped_file_get_contents (mf);
     len = g_mapped_file_get_length (mf);
-    destroy = (hb_destroy_func_t) g_mapped_file_free;
+    destroy = (hb_destroy_func_t) g_mapped_file_unref;
     user_data = (void *) mf;
     mm = HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE;
 #else
diff --git a/src/test-size-params.cc b/src/test-size-params.cc
index 7463599..35d9e3c 100644
--- a/src/test-size-params.cc
+++ b/src/test-size-params.cc
@@ -32,7 +32,10 @@
 #include "hb-ot.h"
 
 #ifdef HAVE_GLIB
-#include <glib.h>
+# include <glib.h>
+# if !GLIB_CHECK_VERSION (2, 22, 0)
+#  define g_mapped_file_unref g_mapped_file_free
+# endif
 #endif
 #include <stdlib.h>
 #include <stdio.h>
@@ -59,7 +62,7 @@ main (int argc, char **argv)
     GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
     font_data = g_mapped_file_get_contents (mf);
     len = g_mapped_file_get_length (mf);
-    destroy = (hb_destroy_func_t) g_mapped_file_free;
+    destroy = (hb_destroy_func_t) g_mapped_file_unref;
     user_data = (void *) mf;
     mm = HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE;
 #else
diff --git a/src/test-would-substitute.cc b/src/test-would-substitute.cc
index 6864c22..8ea87cd 100644
--- a/src/test-would-substitute.cc
+++ b/src/test-would-substitute.cc
@@ -32,7 +32,10 @@
 #include "hb-ot.h"
 
 #ifdef HAVE_GLIB
-#include <glib.h>
+# include <glib.h>
+# if !GLIB_CHECK_VERSION (2, 22, 0)
+#  define g_mapped_file_unref g_mapped_file_free
+# endif
 #endif
 #include <stdlib.h>
 #include <stdio.h>
@@ -63,7 +66,7 @@ main (int argc, char **argv)
     GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
     font_data = g_mapped_file_get_contents (mf);
     len = g_mapped_file_get_length (mf);
-    destroy = (hb_destroy_func_t) g_mapped_file_free;
+    destroy = (hb_destroy_func_t) g_mapped_file_unref;
     user_data = (void *) mf;
     mm = HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE;
 #else
diff --git a/src/test.cc b/src/test.cc
index 0546fb7..a8fe046 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -31,7 +31,10 @@
 #include "hb.h"
 
 #ifdef HAVE_GLIB
-#include <glib.h>
+# include <glib.h>
+# if !GLIB_CHECK_VERSION (2, 22, 0)
+#  define g_mapped_file_unref g_mapped_file_free
+# endif
 #endif
 #include <stdlib.h>
 #include <stdio.h>
@@ -62,7 +65,7 @@ main (int argc, char **argv)
     GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
     font_data = g_mapped_file_get_contents (mf);
     len = g_mapped_file_get_length (mf);
-    destroy = (hb_destroy_func_t) g_mapped_file_free;
+    destroy = (hb_destroy_func_t) g_mapped_file_unref;
     user_data = (void *) mf;
     mm = HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE;
 #else
diff --git a/util/options.cc b/util/options.cc
index aa969a6..66b5e15 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -436,11 +436,11 @@ font_options_t::get_font (void) const
 	font_data = g_mapped_file_get_contents (mf);
 	len = g_mapped_file_get_length (mf);
 	if (len) {
-	  destroy = (hb_destroy_func_t) g_mapped_file_free;
+	  destroy = (hb_destroy_func_t) g_mapped_file_unref;
 	  user_data = (void *) mf;
 	  mm = HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE;
 	} else
-	  g_mapped_file_free (mf);
+	  g_mapped_file_unref (mf);
       } else {
 	fail (false, "%s", error->message);
 	//g_error_free (error);
diff --git a/util/options.hh b/util/options.hh
index 075bf8c..e32f9c9 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -54,6 +54,10 @@
 #include <glib.h>
 #include <glib/gprintf.h>
 
+#if !GLIB_CHECK_VERSION (2, 22, 0)
+# define g_mapped_file_unref g_mapped_file_free
+#endif
+
 #undef MIN
 template <typename Type> static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
 
diff --git a/util/view-cairo.hh b/util/view-cairo.hh
index 96a44ff..2c504c1 100644
--- a/util/view-cairo.hh
+++ b/util/view-cairo.hh
@@ -81,7 +81,11 @@ struct view_cairo_t
       helper_cairo_line_t &line = g_array_index (lines, helper_cairo_line_t, i);
       line.finish ();
     }
+#if GLIB_CHECK_VERSION (2, 22, 0)
+    g_array_unref (lines);
+#else
     g_array_free (lines, TRUE);
+#endif
   }
 
   protected:



More information about the HarfBuzz mailing list