summaryrefslogtreecommitdiff
path: root/src/cairo-pattern.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2021-07-25 06:18:37 +0930
committerAdrian Johnson <ajohnson@redneon.com>2021-07-25 11:01:20 +0930
commit9fbf42754899898934bc8bf4f8eeacba37656fdc (patch)
tree71290e364a7dd65973cb0cdcef32615c4c8dc374 /src/cairo-pattern.c
parent099d71fb9f267153da8b45adc288f9715fbb4611 (diff)
downloadcairo-9fbf42754899898934bc8bf4f8eeacba37656fdc.tar.gz
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
Diffstat (limited to 'src/cairo-pattern.c')
-rw-r--r--src/cairo-pattern.c32
1 files changed, 16 insertions, 16 deletions
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;