summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-08-12 19:36:29 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-08-12 19:36:29 -0400
commit7380a171e933b8690146d2976caf0c5abafbed91 (patch)
tree6f47ff28808fcd197b7f937a010a4dae27167c88
parent2059465b5d9440126d99a78aae7f785d89572194 (diff)
downloadpango-7380a171e933b8690146d2976caf0c5abafbed91.tar.gz
Bug 591511 – hb-blob.c does not compile using mingw on windows
Only call mprotect() when available. For optimal performance, a win32 way to make memory writeable needs to be added.
-rw-r--r--configure.in3
-rw-r--r--pango/opentype/hb-blob.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index 1ba72c87..fb4a7abc 100644
--- a/configure.in
+++ b/configure.in
@@ -602,7 +602,8 @@ AM_CONDITIONAL(DYNAMIC_TIBETAN_FC, echo $dynamic_modules | egrep '(^|,)tibetan-f
# We use flockfile to implement pango_getline() - should be moved to GLib
# strtok_r isn't present on some systems
#
-AC_CHECK_FUNCS(flockfile strtok_r)
+# mprotect is for HarfBuzz
+AC_CHECK_FUNCS(flockfile strtok_r mprotect)
dnl **************************
dnl *** Checks for gtk-doc ***
diff --git a/pango/opentype/hb-blob.c b/pango/opentype/hb-blob.c
index 69390495..178bc8e1 100644
--- a/pango/opentype/hb-blob.c
+++ b/pango/opentype/hb-blob.c
@@ -28,8 +28,12 @@
#include "hb-blob.h"
+#ifdef HAVE_MPROTECT
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
#include <sys/mman.h>
+#endif /* HAVE_MPROTECT */
struct _hb_blob_t {
hb_reference_count_t ref_count;
@@ -240,6 +244,7 @@ hb_blob_try_writeable_inplace (hb_blob_t *blob)
hb_mutex_lock (blob->lock);
+#ifdef HAVE_MPROTECT
if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITEABLE) {
unsigned int pagesize, mask, length;
const char *addr;
@@ -281,6 +286,9 @@ hb_blob_try_writeable_inplace (hb_blob_t *blob)
addr, addr+length, length);
#endif
}
+#else /* !HAVE_MPROTECT */
+#warning "No way to make readonly memory writeable. This is suboptimal."
+#endif
done:
mode = blob->mode;