diff --git a/src/test-buffer-serialize.cc b/src/test-buffer-serialize.cc index 2287b940656f01638714663c014cb00f1f04c1ee..18c46e9524b69dd12b972c7fa63c4b4210d397c1 100644 --- a/src/test-buffer-serialize.cc +++ b/src/test-buffer-serialize.cc @@ -34,7 +34,10 @@ #endif #ifdef HAVE_GLIB -#include +# include +# if !GLIB_CHECK_VERSION (2, 22, 0) +# define g_mapped_file_unref g_mapped_file_free +# endif #endif #include #include @@ -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 7463599a1e1e3eb5223771035eb175b46ba48675..35d9e3c8e2579816fee7c711888f7f5764fd073d 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 +# include +# if !GLIB_CHECK_VERSION (2, 22, 0) +# define g_mapped_file_unref g_mapped_file_free +# endif #endif #include #include @@ -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 6864c223e300b232e7098d18941331bb9d928581..8ea87cdf39716f05930a95cea220412066f5149d 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 +# include +# if !GLIB_CHECK_VERSION (2, 22, 0) +# define g_mapped_file_unref g_mapped_file_free +# endif #endif #include #include @@ -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 0546fb76602bba2c29a5f65070dc01fc388d890a..a8fe046f34c8ee1c4adcf2ed5e3ad1b17211bb53 100644 --- a/src/test.cc +++ b/src/test.cc @@ -31,7 +31,10 @@ #include "hb.h" #ifdef HAVE_GLIB -#include +# include +# if !GLIB_CHECK_VERSION (2, 22, 0) +# define g_mapped_file_unref g_mapped_file_free +# endif #endif #include #include @@ -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 aa969a69f28f0de08a370d3ca1728e84e05dd314..66b5e151cafcf283db4536ee380c074313d354b6 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 075bf8c8f297b195fa510c054bacea3f8fb6118f..e32f9c98ded79369323dfdc5af011c5c37c908ff 100644 --- a/util/options.hh +++ b/util/options.hh @@ -54,6 +54,10 @@ #include #include +#if !GLIB_CHECK_VERSION (2, 22, 0) +# define g_mapped_file_unref g_mapped_file_free +#endif + #undef MIN template 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 96a44ff3d82e4749209ffc50896cba287a916b03..2c504c1b488a791756769cdf66ad8f3c9f020b85 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: