From 49a7334fd76570895c3ca053507b2e1fb34f5ce7 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 9 Feb 2010 19:44:42 +0100 Subject: [PATCH] Fix compilation without HAVE_MMAP. --- util/cairo-script/cairo-script-operators.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c index 91188d9..6c5cfc7 100644 --- a/util/cairo-script/cairo-script-operators.c +++ b/util/cairo-script/cairo-script-operators.c @@ -1751,8 +1751,10 @@ _ft_create_for_source (csi_t *ctx, FT_Error err; cairo_font_face_t *font_face; csi_status_t status; +#ifdef HAVE_MMAP struct mmap_vec vec[2]; int vec_count; +#endif void *bytes; int len; @@ -1779,23 +1781,15 @@ _ft_create_for_source (csi_t *ctx, data->bytes = NULL; data->source = source; - vec[0].bytes = tmpl.bytes; - vec[0].num_bytes = tmpl.len; - if (source->deflate) { len = source->deflate; bytes = inflate_string (ctx, source); if (_csi_unlikely (bytes == NULL)) return _csi_error (CSI_STATUS_NO_MEMORY); - - vec[1].bytes = bytes; - vec[1].num_bytes = len; data->bytes = bytes; - vec_count = 2; } else { bytes = tmpl.bytes; len = tmpl.len; - vec_count = 1; } data->face = NULL; @@ -1804,6 +1798,15 @@ _ft_create_for_source (csi_t *ctx, data->blob.hash = tmpl.hash; data->blob.len = tmpl.len; #ifdef HAVE_MMAP + vec[0].bytes = tmpl.bytes; + vec[0].num_bytes = tmpl.len; + if (source->deflate) { + vec[1].bytes = bytes; + vec[1].num_bytes = len; + vec_count = 2; + } else { + vec_count = 1; + } data->blob.bytes = _mmap_bytes (vec, vec_count); if (data->blob.bytes != MAP_FAILED) { if (--source->base.ref == 0) @@ -1864,7 +1867,9 @@ _ft_create_for_pattern (csi_t *ctx, cairo_font_face_t *font_face; FcPattern *pattern, *resolved; csi_status_t status; +#ifdef HAVE_MMAP struct mmap_vec vec; +#endif void *bytes; _csi_blob_init (&tmpl, (uint8_t *) string->string, string->len); -- 1.6.3.3