summaryrefslogtreecommitdiff
path: root/fitzdraw
diff options
context:
space:
mode:
authorRalph Giles <giles@ghostscript.com>2009-08-19 18:57:19 +0200
committerRalph Giles <giles@ghostscript.com>2009-08-19 18:57:19 +0200
commitcfeb58fa4694a133e3037b6eccf526389cbffda2 (patch)
treed9870bb3ae9a5f6ada24aca4c9a23be3dc17b2f3 /fitzdraw
parente3e42a06b2226beadfa8c9a471753d464e5e5aa8 (diff)
downloadmupdf-cfeb58fa4694a133e3037b6eccf526389cbffda2.tar.xz
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.
Diffstat (limited to 'fitzdraw')
-rw-r--r--fitzdraw/imageunpack.c2
-rw-r--r--fitzdraw/render.c2
2 files changed, 2 insertions, 2 deletions
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;