[cairo-commit] 4 commits - perf/cairo-perf-report.c src/cairo-cache.c src/cairo-cache-private.h src/cairo-cogl-gradient.c src/cairo-cogl-surface.c src/cairo-compiler-private.h src/cairo-ft-font.c src/cairo-gl-gradient.c src/cairo-image-compositor.c src/cairoint.h src/cairo-mempool.c src/cairo-misc.c src/cairo-path-fixed.c src/cairo-path-fixed-private.h src/cairo-pattern.c src/cairo-pattern-private.h src/cairo-scaled-font.c src/cairo-scaled-font-subsets.c src/cairo-script-surface.c src/cairo-svg-surface.c src/cairo-toy-font-face.c src/cairo-types-private.h src/cairo-vg-surface.c src/drm src/win32 util/cairo-script util/cairo-trace

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 27 15:53:05 UTC 2021


 perf/cairo-perf-report.c                 |    5 ++++
 src/cairo-cache-private.h                |    2 -
 src/cairo-cache.c                        |    8 +++----
 src/cairo-cogl-gradient.c                |    6 ++---
 src/cairo-cogl-surface.c                 |    8 +++----
 src/cairo-compiler-private.h             |    1 
 src/cairo-ft-font.c                      |    8 +++----
 src/cairo-gl-gradient.c                  |    6 ++---
 src/cairo-image-compositor.c             |    4 +--
 src/cairo-mempool.c                      |    6 ++---
 src/cairo-misc.c                         |    3 ++
 src/cairo-path-fixed-private.h           |    2 -
 src/cairo-path-fixed.c                   |    4 +--
 src/cairo-pattern-private.h              |   10 ++++-----
 src/cairo-pattern.c                      |   32 +++++++++++++++----------------
 src/cairo-scaled-font-subsets.c          |    4 +--
 src/cairo-scaled-font.c                  |   24 +++++++++++------------
 src/cairo-script-surface.c               |   10 ++++-----
 src/cairo-svg-surface.c                  |    1 
 src/cairo-toy-font-face.c                |    6 ++---
 src/cairo-types-private.h                |    2 -
 src/cairo-vg-surface.c                   |    6 ++---
 src/cairoint.h                           |    6 ++---
 src/drm/cairo-drm-intel.c                |    2 -
 src/win32/cairo-win32-font.c             |    2 -
 util/cairo-script/cairo-script-private.h |    2 -
 util/cairo-trace/lookup-symbol.c         |    2 -
 util/cairo-trace/trace.c                 |    2 -
 28 files changed, 92 insertions(+), 82 deletions(-)

New commits:
commit 220222c5ff5efcabd13c63ec288ff38111a1e7b7
Merge: d6fefd315 62681fe05
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Jul 27 15:53:03 2021 +0000

    Merge branch 'issue-263' into 'master'
    
    Win 64-bit fix pointer to long cast size mismatch
    
    Closes #263
    
    See merge request cairo/cairo!216

commit 62681fe0523ae96a29e2ff9c080a4c0f4ad40d4c
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Jul 25 06:24:34 2021 +0930

    Change FNV hash to 64-bit
    
    Most builds are 64-bit where the uintptr_t type of the hash value and the font
    face pointer that is being hashed are 64-bit.

diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 9a6270df3..65c1d2595 100755
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -598,25 +598,25 @@ _cairo_scaled_font_placeholder_wait_for_creation_to_finish (cairo_scaled_font_t
  * well tested with binary data.
  */
 
-#define FNV_32_PRIME ((uint32_t)0x01000193)
-#define FNV1_32_INIT ((uint32_t)0x811c9dc5)
+#define FNV_64_PRIME ((uint64_t)0x00000100000001B3)
+#define FNV1_64_INIT ((uint64_t)0xcbf29ce484222325)
 
-static uint32_t
+static uint64_t
 _hash_matrix_fnv (const cairo_matrix_t	*matrix,
-		  uint32_t		 hval)
+		  uint64_t		 hval)
 {
     const uint8_t *buffer = (const uint8_t *) matrix;
     int len = sizeof (cairo_matrix_t);
     do {
-	hval *= FNV_32_PRIME;
+	hval *= FNV_64_PRIME;
 	hval ^= *buffer++;
     } while (--len);
 
     return hval;
 }
 
-static uint32_t
-_hash_mix_bits (uint32_t hash)
+static uint64_t
+_hash_mix_bits (uint64_t hash)
 {
     hash += hash << 12;
     hash ^= hash >> 7;
@@ -629,7 +629,7 @@ _hash_mix_bits (uint32_t hash)
 static uintptr_t
 _cairo_scaled_font_compute_hash (cairo_scaled_font_t *scaled_font)
 {
-    uintptr_t hash = FNV1_32_INIT;
+    uintptr_t hash = FNV1_64_INIT;
 
     /* We do a bytewise hash on the font matrices */
     hash = _hash_matrix_fnv (&scaled_font->font_matrix, hash);
commit 8d14a20a0009a8e832cb87fd9cf829bd399aa692
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Jul 25 06:22:24 2021 +0930

    Fix some win32 compile warnings

diff --git a/perf/cairo-perf-report.c b/perf/cairo-perf-report.c
index 5a1e25441..64a680242 100644
--- a/perf/cairo-perf-report.c
+++ b/perf/cairo-perf-report.c
@@ -45,10 +45,12 @@
 #endif
 
 #ifdef _MSC_VER
+#if _MSC_VER < 1800
 static long long
 strtoll (const char  *nptr,
 	 char	    **endptr,
 	 int	      base);
+#endif
 
 static char *
 basename (char *path);
@@ -221,6 +223,8 @@ test_report_parse (test_report_t *report,
  * The basename function is fully compliant to its GNU specs.
  */
 #ifdef _MSC_VER
+
+#if _MSC_VER < 1800
 long long
 strtoll (const char  *nptr,
 	 char	    **endptr,
@@ -228,6 +232,7 @@ strtoll (const char  *nptr,
 {
     return _atoi64(nptr);
 }
+#endif
 
 static char *
 basename (char *path)
diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index 00703c584..e95658105 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -195,6 +195,7 @@
 
 #if (defined(__WIN32__) && !defined(__WINE__)) || defined(_MSC_VER)
 #define access _access
+#define R_OK 0
 #define fdopen _fdopen
 #define hypot _hypot
 #define pclose _pclose
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index fca24b3cd..2adc979bc 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -69,7 +69,7 @@
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
-#else
+#elif !defined(access)
 #define access(p, m) 0
 #endif
 
diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index bd1f30627..3dc1570b5 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -404,6 +404,7 @@ _cairo_operator_bounded_by_mask (cairo_operator_t op)
 	return FALSE;
     default:
 	ASSERT_NOT_REACHED;
+	return FALSE; /* squelch warning */
     }
 }
 
@@ -458,6 +459,7 @@ _cairo_operator_bounded_by_source (cairo_operator_t op)
 	return FALSE;
     default:
 	ASSERT_NOT_REACHED;
+	return FALSE; /* squelch warning */
     }
 }
 
@@ -499,6 +501,7 @@ _cairo_operator_bounded_by_either (cairo_operator_t op)
 	return 0;
     default:
 	ASSERT_NOT_REACHED;
+	return FALSE; /* squelch warning */
     }
 
 }
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 8baeecfc2..6d5572cd8 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1731,6 +1731,7 @@ _cairo_svg_surface_emit_static_filter (cairo_svg_document_t *document, enum cair
 	return "color-to-alpha";
     default:
 	ASSERT_NOT_REACHED;
+	return FALSE; /* squelch warning */
     }
 }
 
commit 9fbf42754899898934bc8bf4f8eeacba37656fdc
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Jul 25 06:18:37 2021 +0930

    Use uintptr_t for all casts between pointer and integer
    
    On 64-bit windows, long is 32-bit. When compiling there are a large
    number of warnings about mismatched sizes when casting long to/from a
    pointer.
    
    Use the (u)intptr_t type for any integer that will have a pointer stored
    in it. Use a (u)intptr_t cast when integers are stored in pointers to
    silence warnings.
    
    Fixes #263

diff --git a/src/cairo-cache-private.h b/src/cairo-cache-private.h
index 24b6d0b20..03e2bbf31 100644
--- a/src/cairo-cache-private.h
+++ b/src/cairo-cache-private.h
@@ -84,7 +84,7 @@
  * not be initialized if so desired.
  **/
 typedef struct _cairo_cache_entry {
-    unsigned long hash;
+    uintptr_t hash;
     unsigned long size;
 } cairo_cache_entry_t;
 
diff --git a/src/cairo-cache.c b/src/cairo-cache.c
index 5c4e4caa3..96809b585 100644
--- a/src/cairo-cache.c
+++ b/src/cairo-cache.c
@@ -315,18 +315,18 @@ _cairo_cache_foreach (cairo_cache_t		      *cache,
 			       closure);
 }
 
-unsigned long
+uintptr_t
 _cairo_hash_string (const char *c)
 {
     /* This is the djb2 hash. */
-    unsigned long hash = _CAIRO_HASH_INIT_VALUE;
+    uintptr_t hash = _CAIRO_HASH_INIT_VALUE;
     while (c && *c)
 	hash = ((hash << 5) + hash) + *c++;
     return hash;
 }
 
-unsigned long
-_cairo_hash_bytes (unsigned long hash,
+uintptr_t
+_cairo_hash_bytes (uintptr_t hash,
 		   const void *ptr,
 		   unsigned int length)
 {
diff --git a/src/cairo-cogl-gradient.c b/src/cairo-cogl-gradient.c
index cdb4cae82..9fb5ce740 100644
--- a/src/cairo-cogl-gradient.c
+++ b/src/cairo-cogl-gradient.c
@@ -39,7 +39,7 @@
 
 //#define DUMP_GRADIENTS_TO_PNG
 
-static unsigned long
+static uintptr_t
 _cairo_cogl_linear_gradient_hash (unsigned int                  n_stops,
 				  const cairo_gradient_stop_t  *stops)
 {
@@ -49,7 +49,7 @@ _cairo_cogl_linear_gradient_hash (unsigned int                  n_stops,
 
 static cairo_cogl_linear_gradient_t *
 _cairo_cogl_linear_gradient_lookup (cairo_cogl_device_t          *ctx,
-				    unsigned long                 hash,
+				    uintptr_t                     hash,
 				    unsigned int                  n_stops,
 				    const cairo_gradient_stop_t  *stops)
 {
@@ -359,7 +359,7 @@ _cairo_cogl_get_linear_gradient (cairo_cogl_device_t           *device,
 				 const cairo_bool_t             need_mirrored_gradient,
 				 cairo_cogl_linear_gradient_t **gradient_out)
 {
-    unsigned long hash;
+    uintptr_t hash;
     cairo_cogl_linear_gradient_t *gradient;
     cairo_cogl_linear_texture_entry_t *entry;
     cairo_gradient_stop_t *internal_stops;
diff --git a/src/cairo-cogl-surface.c b/src/cairo-cogl-surface.c
index 36e5f77d8..f4eee091c 100644
--- a/src/cairo-cogl-surface.c
+++ b/src/cairo-cogl-surface.c
@@ -700,7 +700,7 @@ _cairo_cogl_fill_to_primitive (cairo_cogl_surface_t	*surface,
     cairo_cogl_path_fill_meta_t *acquired_meta;
     cairo_cogl_path_fill_meta_t *insert_meta = NULL;
     cairo_cogl_device_t *dev = to_device (surface->base.device);
-    unsigned long hash;
+    uintptr_t hash;
 
     *primitive = NULL;
 
@@ -842,8 +842,8 @@ _cairo_cogl_path_stroke_meta_destroy (cairo_cogl_path_stroke_meta_t *meta)
     _cairo_freelist_free (meta->freelist, meta);
 }
 
-static unsigned long
-_cairo_cogl_stroke_style_hash (unsigned long               hash,
+static uintptr_t
+_cairo_cogl_stroke_style_hash (uintptr_t                   hash,
 			       const cairo_stroke_style_t *style)
 {
     unsigned int i;
@@ -874,7 +874,7 @@ _cairo_cogl_stroke_to_primitive (cairo_cogl_surface_t	    *surface,
     cairo_cogl_path_stroke_meta_t *insert_meta = NULL;
     cairo_matrix_t identity;
     cairo_cogl_device_t *dev = to_device (surface->base.device);
-    unsigned long hash;
+    uintptr_t hash;
 
     *primitive = NULL;
 
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 1f5befec3..fca24b3cd 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -397,7 +397,7 @@ _cairo_ft_unscaled_font_init_key (cairo_ft_unscaled_font_t *key,
 				  int			    id,
 				  FT_Face		    face)
 {
-    unsigned long hash;
+    uintptr_t hash;
 
     key->from_face = from_face;
     key->filename = filename;
@@ -406,8 +406,8 @@ _cairo_ft_unscaled_font_init_key (cairo_ft_unscaled_font_t *key,
 
     hash = _cairo_hash_string (filename);
     /* the constants are just arbitrary primes */
-    hash += ((unsigned long) id) * 1607;
-    hash += ((unsigned long) face) * 2137;
+    hash += ((uintptr_t) id) * 1607;
+    hash += ((uintptr_t) face) * 2137;
 
     key->base.hash_entry.hash = hash;
 }
diff --git a/src/cairo-gl-gradient.c b/src/cairo-gl-gradient.c
index 1bbd8dd0e..293d4e30e 100644
--- a/src/cairo-gl-gradient.c
+++ b/src/cairo-gl-gradient.c
@@ -188,7 +188,7 @@ _cairo_gl_gradient_render (const cairo_gl_context_t    *ctx,
     return CAIRO_STATUS_SUCCESS;
 }
 
-static unsigned long
+static uintptr_t
 _cairo_gl_gradient_hash (unsigned int                  n_stops,
 			 const cairo_gradient_stop_t  *stops)
 {
@@ -199,7 +199,7 @@ _cairo_gl_gradient_hash (unsigned int                  n_stops,
 
 static cairo_gl_gradient_t *
 _cairo_gl_gradient_lookup (cairo_gl_context_t           *ctx,
-			   unsigned long                 hash,
+			   uintptr_t                     hash,
 			   unsigned int                  n_stops,
 			   const cairo_gradient_stop_t  *stops)
 {
@@ -230,7 +230,7 @@ _cairo_gl_gradient_create (cairo_gl_context_t           *ctx,
 			   const cairo_gradient_stop_t  *stops,
 			   cairo_gl_gradient_t         **gradient_out)
 {
-    unsigned long hash;
+    uintptr_t hash;
     cairo_gl_gradient_t *gradient;
     cairo_status_t status;
     int tex_width;
diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 8bf3fd4b1..0ded5388e 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -898,7 +898,7 @@ composite_glyphs (void				*_dst,
 
 	index = index | (xphase << 24) | (yphase << 26);
 
-	glyph = pixman_glyph_cache_lookup (glyph_cache, info->font, (void *)index);
+	glyph = pixman_glyph_cache_lookup (glyph_cache, info->font, (void *)(uintptr_t)index);
 	if (!glyph) {
 	    cairo_scaled_glyph_t *scaled_glyph;
 	    cairo_image_surface_t *glyph_surface;
@@ -916,7 +916,7 @@ composite_glyphs (void				*_dst,
 		goto out_thaw;
 
 	    glyph_surface = scaled_glyph->surface;
-	    glyph = pixman_glyph_cache_insert (glyph_cache, info->font, (void *)index,
+	    glyph = pixman_glyph_cache_insert (glyph_cache, info->font, (void *)(uintptr_t)index,
 					       glyph_surface->base.device_transform.x0,
 					       glyph_surface->base.device_transform.y0,
 					       glyph_surface->pixman_image);
diff --git a/src/cairo-mempool.c b/src/cairo-mempool.c
index ce40ce521..6ba254690 100644
--- a/src/cairo-mempool.c
+++ b/src/cairo-mempool.c
@@ -284,19 +284,19 @@ _cairo_mempool_init (cairo_mempool_t *pool,
 		      void *base, size_t bytes,
 		      int min_bits, int num_sizes)
 {
-    unsigned long tmp;
+    uintptr_t tmp;
     int num_blocks;
     int i;
 
     /* Align the start to an integral chunk */
-    tmp = ((unsigned long) base) & ((1 << min_bits) - 1);
+    tmp = ((uintptr_t) base) & ((1 << min_bits) - 1);
     if (tmp) {
 	tmp = (1 << min_bits) - tmp;
 	base = (char *)base + tmp;
 	bytes -= tmp;
     }
 
-    assert ((((unsigned long) base) & ((1 << min_bits) - 1)) == 0);
+    assert ((((uintptr_t) base) & ((1 << min_bits) - 1)) == 0);
     assert (num_sizes < ARRAY_LENGTH (pool->free));
 
     pool->base = base;
diff --git a/src/cairo-path-fixed-private.h b/src/cairo-path-fixed-private.h
index cf7cd0836..e49906344 100644
--- a/src/cairo-path-fixed-private.h
+++ b/src/cairo-path-fixed-private.h
@@ -126,7 +126,7 @@ _cairo_path_fixed_append (cairo_path_fixed_t		    *path,
 			  cairo_fixed_t			     tx,
 			  cairo_fixed_t			     ty);
 
-cairo_private unsigned long
+cairo_private uintptr_t
 _cairo_path_fixed_hash (const cairo_path_fixed_t *path);
 
 cairo_private unsigned long
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index d74182346..a6ab4e389 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -172,10 +172,10 @@ _cairo_path_fixed_init_copy (cairo_path_fixed_t *path,
     return CAIRO_STATUS_SUCCESS;
 }
 
-unsigned long
+uintptr_t
 _cairo_path_fixed_hash (const cairo_path_fixed_t *path)
 {
-    unsigned long hash = _CAIRO_HASH_INIT_VALUE;
+    uintptr_t hash = _CAIRO_HASH_INIT_VALUE;
     const cairo_path_buf_t *buf;
     unsigned int count;
 
diff --git a/src/cairo-pattern-private.h b/src/cairo-pattern-private.h
index 26d584e68..f03dedd9e 100644
--- a/src/cairo-pattern-private.h
+++ b/src/cairo-pattern-private.h
@@ -308,15 +308,15 @@ cairo_private cairo_int_status_t
 _cairo_pattern_get_ink_extents (const cairo_pattern_t	    *pattern,
 				cairo_rectangle_int_t       *extents);
 
-cairo_private unsigned long
+cairo_private uintptr_t
 _cairo_pattern_hash (const cairo_pattern_t *pattern);
 
-cairo_private unsigned long
-_cairo_linear_pattern_hash (unsigned long hash,
+cairo_private uintptr_t
+_cairo_linear_pattern_hash (uintptr_t hash,
 			    const cairo_linear_pattern_t *linear);
 
-cairo_private unsigned long
-_cairo_radial_pattern_hash (unsigned long hash,
+cairo_private uintptr_t
+_cairo_radial_pattern_hash (uintptr_t hash,
 			    const cairo_radial_pattern_t *radial);
 
 cairo_private cairo_bool_t
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 32811af59..e7af5ff5e 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -3863,8 +3863,8 @@ _cairo_pattern_get_ink_extents (const cairo_pattern_t         *pattern,
     return CAIRO_STATUS_SUCCESS;
 }
 
-static unsigned long
-_cairo_solid_pattern_hash (unsigned long hash,
+static uintptr_t
+_cairo_solid_pattern_hash (uintptr_t hash,
 			   const cairo_solid_pattern_t *solid)
 {
     hash = _cairo_hash_bytes (hash, &solid->color, sizeof (solid->color));
@@ -3872,8 +3872,8 @@ _cairo_solid_pattern_hash (unsigned long hash,
     return hash;
 }
 
-static unsigned long
-_cairo_gradient_color_stops_hash (unsigned long hash,
+static uintptr_t
+_cairo_gradient_color_stops_hash (uintptr_t hash,
 				  const cairo_gradient_pattern_t *gradient)
 {
     unsigned int n;
@@ -3894,8 +3894,8 @@ _cairo_gradient_color_stops_hash (unsigned long hash,
     return hash;
 }
 
-unsigned long
-_cairo_linear_pattern_hash (unsigned long hash,
+uintptr_t
+_cairo_linear_pattern_hash (uintptr_t hash,
 			    const cairo_linear_pattern_t *linear)
 {
     hash = _cairo_hash_bytes (hash, &linear->pd1, sizeof (linear->pd1));
@@ -3904,8 +3904,8 @@ _cairo_linear_pattern_hash (unsigned long hash,
     return _cairo_gradient_color_stops_hash (hash, &linear->base);
 }
 
-unsigned long
-_cairo_radial_pattern_hash (unsigned long hash,
+uintptr_t
+_cairo_radial_pattern_hash (uintptr_t hash,
 			    const cairo_radial_pattern_t *radial)
 {
     hash = _cairo_hash_bytes (hash, &radial->cd1.center, sizeof (radial->cd1.center));
@@ -3916,8 +3916,8 @@ _cairo_radial_pattern_hash (unsigned long hash,
     return _cairo_gradient_color_stops_hash (hash, &radial->base);
 }
 
-static unsigned long
-_cairo_mesh_pattern_hash (unsigned long hash, const cairo_mesh_pattern_t *mesh)
+static uintptr_t
+_cairo_mesh_pattern_hash (uintptr_t hash, const cairo_mesh_pattern_t *mesh)
 {
     const cairo_mesh_patch_t *patch = _cairo_array_index_const (&mesh->patches, 0);
     unsigned int i, n = _cairo_array_num_elements (&mesh->patches);
@@ -3928,8 +3928,8 @@ _cairo_mesh_pattern_hash (unsigned long hash, const cairo_mesh_pattern_t *mesh)
     return hash;
 }
 
-static unsigned long
-_cairo_surface_pattern_hash (unsigned long hash,
+static uintptr_t
+_cairo_surface_pattern_hash (uintptr_t hash,
 			     const cairo_surface_pattern_t *surface)
 {
     hash ^= surface->surface->unique_id;
@@ -3937,8 +3937,8 @@ _cairo_surface_pattern_hash (unsigned long hash,
     return hash;
 }
 
-static unsigned long
-_cairo_raster_source_pattern_hash (unsigned long hash,
+static uintptr_t
+_cairo_raster_source_pattern_hash (uintptr_t hash,
 				   const cairo_raster_source_pattern_t *raster)
 {
     hash ^= (uintptr_t)raster->user_data;
@@ -3946,10 +3946,10 @@ _cairo_raster_source_pattern_hash (unsigned long hash,
     return hash;
 }
 
-unsigned long
+uintptr_t
 _cairo_pattern_hash (const cairo_pattern_t *pattern)
 {
-    unsigned long hash = _CAIRO_HASH_INIT_VALUE;
+    uintptr_t hash = _CAIRO_HASH_INIT_VALUE;
 
     if (pattern->status)
 	return 0;
diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index 1f0e53577..0ae41aebe 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -255,12 +255,12 @@ _cairo_sub_font_init_key (cairo_sub_font_t	*sub_font,
 {
     if (sub_font->is_scaled)
     {
-        sub_font->base.hash = (unsigned long) scaled_font;
+        sub_font->base.hash = (uintptr_t) scaled_font;
         sub_font->scaled_font = scaled_font;
     }
     else
     {
-        sub_font->base.hash = (unsigned long) scaled_font->font_face;
+        sub_font->base.hash = (uintptr_t) scaled_font->font_face;
         sub_font->scaled_font = scaled_font;
     }
 }
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 4f979c5db..9a6270df3 100755
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -56,7 +56,7 @@
  * size and transformation and a certain set of font options.
  **/
 
-static uint32_t
+static uintptr_t
 _cairo_scaled_font_compute_hash (cairo_scaled_font_t *scaled_font);
 
 /* Global Glyph Cache
@@ -626,17 +626,17 @@ _hash_mix_bits (uint32_t hash)
     return hash;
 }
 
-static uint32_t
+static uintptr_t
 _cairo_scaled_font_compute_hash (cairo_scaled_font_t *scaled_font)
 {
-    uint32_t hash = FNV1_32_INIT;
+    uintptr_t hash = FNV1_32_INIT;
 
     /* We do a bytewise hash on the font matrices */
     hash = _hash_matrix_fnv (&scaled_font->font_matrix, hash);
     hash = _hash_matrix_fnv (&scaled_font->ctm, hash);
     hash = _hash_mix_bits (hash);
 
-    hash ^= (unsigned long) scaled_font->original_font_face;
+    hash ^= (uintptr_t) scaled_font->original_font_face;
     hash ^= cairo_font_options_hash (&scaled_font->options);
 
     /* final mixing of bits */
@@ -2879,7 +2879,7 @@ _cairo_scaled_font_allocate_glyph (cairo_scaled_font_t *scaled_font,
     if (unlikely (page == NULL))
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
-    page->cache_entry.hash = (unsigned long) scaled_font;
+    page->cache_entry.hash = (uintptr_t) scaled_font;
     page->scaled_font = scaled_font;
     page->cache_entry.size = 1; /* XXX occupancy weighting? */
     page->num_glyphs = 0;
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c
index 4d7778b99..800db0780 100644
--- a/src/cairo-script-surface.c
+++ b/src/cairo-script-surface.c
@@ -3047,7 +3047,7 @@ _emit_scaled_glyph_vector (cairo_script_surface_t *surface,
 
     index = ++font_private->subset_glyph_index;
     scaled_glyph->dev_private_key = ctx;
-    scaled_glyph->dev_private = (void *) index;
+    scaled_glyph->dev_private = (void *)(uintptr_t)index;
 
     _cairo_output_stream_printf (ctx->stream,
 				 "%lu <<\n"
@@ -3095,7 +3095,7 @@ _emit_scaled_glyph_bitmap (cairo_script_surface_t *surface,
 
     index = ++font_private->subset_glyph_index;
     scaled_glyph->dev_private_key = ctx;
-    scaled_glyph->dev_private = (void *) index;
+    scaled_glyph->dev_private = (void *)(uintptr_t)index;
 
     _cairo_output_stream_printf (ctx->stream,
 				 "%lu <<\n"
@@ -3395,7 +3395,7 @@ _cairo_script_surface_show_text_glyphs (void			    *abstract_surface,
 		goto BAIL;
 	    }
 
-	    if ((long unsigned) scaled_glyph->dev_private > 256)
+	    if ((uintptr_t)scaled_glyph->dev_private > 256)
 		break;
 	}
     }
@@ -3466,7 +3466,7 @@ _cairo_script_surface_show_text_glyphs (void			    *abstract_surface,
 	    if (font_private->has_sfnt)
 		c = glyphs[n].index;
 	    else
-		c = (uint8_t) (long unsigned) scaled_glyph->dev_private;
+		c = (uint8_t) (uintptr_t) scaled_glyph->dev_private;
 
 	    _cairo_output_stream_write (base85_stream, &c, 1);
 	} else {
@@ -3475,7 +3475,7 @@ _cairo_script_surface_show_text_glyphs (void			    *abstract_surface,
 					     glyphs[n].index);
 	    else
 		_cairo_output_stream_printf (ctx->stream, " %lu",
-					     (long unsigned) scaled_glyph->dev_private);
+					     (long unsigned) (uintptr_t)scaled_glyph->dev_private);
 	}
 
         dx = scaled_glyph->metrics.x_advance;
diff --git a/src/cairo-toy-font-face.c b/src/cairo-toy-font-face.c
index f51dab5ab..ef7122609 100644
--- a/src/cairo-toy-font-face.c
+++ b/src/cairo-toy-font-face.c
@@ -135,7 +135,7 @@ _cairo_toy_font_face_init_key (cairo_toy_font_face_t *key,
 			       cairo_font_slant_t     slant,
 			       cairo_font_weight_t    weight)
 {
-    unsigned long hash;
+    uintptr_t hash;
 
     key->family = family;
     key->owns_family = FALSE;
@@ -145,8 +145,8 @@ _cairo_toy_font_face_init_key (cairo_toy_font_face_t *key,
 
     /* 1607 and 1451 are just a couple of arbitrary primes. */
     hash = _cairo_hash_string (family);
-    hash += ((unsigned long) slant) * 1607;
-    hash += ((unsigned long) weight) * 1451;
+    hash += ((uintptr_t) slant) * 1607;
+    hash += ((uintptr_t) weight) * 1451;
 
     key->base.hash_entry.hash = hash;
 }
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index da373030c..0f46214ed 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -147,7 +147,7 @@ struct _cairo_observer {
  * the entry need not be initialized if so desired.
  **/
 struct _cairo_hash_entry {
-    unsigned long hash;
+    uintptr_t hash;
 };
 
 struct _cairo_array {
diff --git a/src/cairo-vg-surface.c b/src/cairo-vg-surface.c
index cbff748fe..6e1f11e2d 100644
--- a/src/cairo-vg-surface.c
+++ b/src/cairo-vg-surface.c
@@ -67,7 +67,7 @@ struct _cairo_vg_context {
     cairo_status_t status;
     cairo_reference_count_t ref_count;
 
-    unsigned long target_id;
+    uintptr_t           target_id;
 
     VGPaint		paint;
     cairo_vg_surface_t *source;
@@ -100,7 +100,7 @@ struct _cairo_vg_surface {
 
     cairo_surface_clipper_t clipper;
 
-    unsigned long target_id;
+    uintptr_t target_id;
 };
 
 static const cairo_surface_backend_t cairo_vg_surface_backend;
@@ -1782,7 +1782,7 @@ egl_create_target (cairo_vg_context_t *context,
 					  (EGLClientBuffer) surface->image,
 					  config,
 					  NULL);
-    surface->target_id = (unsigned long) egl_surface;
+    surface->target_id = (uintptr_t) egl_surface;
 
     return CAIRO_STATUS_SUCCESS;
 }
diff --git a/src/cairoint.h b/src/cairoint.h
index 4dbb7f917..64ed2aa4d 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -424,11 +424,11 @@ _cairo_user_data_array_foreach (cairo_user_data_array_t     *array,
 
 #define _CAIRO_HASH_INIT_VALUE 5381
 
-cairo_private unsigned long
+cairo_private uintptr_t
 _cairo_hash_string (const char *c);
 
-cairo_private unsigned long
-_cairo_hash_bytes (unsigned long hash,
+cairo_private uintptr_t
+_cairo_hash_bytes (uintptr_t hash,
 		   const void *bytes,
 		   unsigned int length);
 
diff --git a/src/drm/cairo-drm-intel.c b/src/drm/cairo-drm-intel.c
index e6fb83dd5..e45f999ec 100644
--- a/src/drm/cairo-drm-intel.c
+++ b/src/drm/cairo-drm-intel.c
@@ -1126,7 +1126,7 @@ intel_snapshot_cache_insert (intel_device_t *device,
     if (device->snapshot_cache.freeze_count == 0)
 	_cairo_cache_freeze (&device->snapshot_cache);
 
-    surface->snapshot_cache_entry.hash = (unsigned long) surface;
+    surface->snapshot_cache_entry.hash = (uintptr_t) surface;
     status = _cairo_cache_insert (&device->snapshot_cache,
 	                          &surface->snapshot_cache_entry);
     if (unlikely (status)) {
diff --git a/src/win32/cairo-win32-font.c b/src/win32/cairo-win32-font.c
index d0bb09e1a..792e329d4 100644
--- a/src/win32/cairo-win32-font.c
+++ b/src/win32/cairo-win32-font.c
@@ -1960,7 +1960,7 @@ _cairo_win32_font_face_init_key (cairo_win32_font_face_t *key,
 				 LOGFONTW                *logfont,
 				 HFONT                    font)
 {
-    unsigned long hash = _CAIRO_HASH_INIT_VALUE;
+    uintptr_t hash = _CAIRO_HASH_INIT_VALUE;
 
     key->logfont = *logfont;
     key->hfont = font;
diff --git a/util/cairo-script/cairo-script-private.h b/util/cairo-script/cairo-script-private.h
index 7ae8be925..b1b4aed0e 100644
--- a/util/cairo-script/cairo-script-private.h
+++ b/util/cairo-script/cairo-script-private.h
@@ -284,7 +284,7 @@ typedef cairo_bool_t csi_boolean_t;
 typedef csi_status_t (*csi_operator_t) (csi_t *);
 typedef float csi_real_t;
 typedef long csi_integer_t;
-typedef long csi_name_t;
+typedef intptr_t csi_name_t;
 typedef struct _csi_array csi_array_t;
 typedef struct _csi_buffer csi_buffer_t;
 typedef struct _csi_compound_object csi_compound_object_t;
diff --git a/util/cairo-trace/lookup-symbol.c b/util/cairo-trace/lookup-symbol.c
index 4bc1fac1a..3934066b9 100644
--- a/util/cairo-trace/lookup-symbol.c
+++ b/util/cairo-trace/lookup-symbol.c
@@ -262,7 +262,7 @@ lookup_symbol (char *buf, int buflen, const void *ptr)
     int bucket;
     int len;
 
-    bucket = (unsigned long) ptr % (sizeof (symbol_cache_hash) / sizeof (symbol_cache_hash[0]));
+    bucket = (uintptr_t) ptr % (sizeof (symbol_cache_hash) / sizeof (symbol_cache_hash[0]));
     pthread_mutex_lock (&symbol_cache_mutex);
     for (cache = symbol_cache_hash[bucket];
 	 cache != NULL;
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index babcc06fa..cc4b18c0d 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -134,7 +134,7 @@ static void *_dlhandle = RTLD_NEXT;
 #else
 #error Unexpected pointer size
 #endif
-#define BUCKET(b, ptr) (((unsigned long) (ptr) >> PTR_SHIFT) % ARRAY_LENGTH (b))
+#define BUCKET(b, ptr) (((uintptr_t) (ptr) >> PTR_SHIFT) % ARRAY_LENGTH (b))
 
 #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
 #define _BOOLEAN_EXPR(expr)                   \


More information about the cairo-commit mailing list