From cfeb58fa4694a133e3037b6eccf526389cbffda2 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Wed, 19 Aug 2009 18:57:19 +0200 Subject: Cast pointers to unsigned long to avoid truncation. In these two places, a pointer's alignment was checked by casting it to an unsigned in and then masking off all but the last low two bits. This method generates a warning on LP64 systems like Linux x86_64 since the pointer must be truncated. This is fine as far as the algorithm is concerned, but gcc generates a warning which we would like to remove. Casting to (unsigned long) resolves the warning, since this is the same width as a pointer on Linux x86_64. On 32 bit machines, it is generally also the same width as a pointer, and as the previous (unsigned) cast. However, it won't help on Windows x86_64, where long is still 32 bits. --- fitzdraw/imageunpack.c | 2 +- fitzdraw/render.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'fitzdraw') diff --git a/fitzdraw/imageunpack.c b/fitzdraw/imageunpack.c index dd80ede7..15730479 100644 --- a/fitzdraw/imageunpack.c +++ b/fitzdraw/imageunpack.c @@ -48,7 +48,7 @@ static void decodetile(fz_pixmap *pix, int skip, float *decode) if (justinvert) { unsigned *wp = (unsigned *)p; - if ((((unsigned)wp) & 3) == 0) { + if (((unsigned long)wp & 3) == 0) { int hwh = wh / 2; wh = wh - 2 * hwh; while(hwh--) { diff --git a/fitzdraw/render.c b/fitzdraw/render.c index 91c6fdc2..da06ed83 100644 --- a/fitzdraw/render.c +++ b/fitzdraw/render.c @@ -153,7 +153,7 @@ DEBUG("solid %s [%d %d %d %d];\n", solid->cs->name, gc->argb[0], gc->argb[1], gc r = gc->argb[1]; g = gc->argb[2]; b = gc->argb[3]; - if (((unsigned)p & 3)) { + if ((unsigned long)p & 3) { while (n--) { p[0] = a; -- cgit v1.2.3