From fd2ea36e0848223b58c09c292a551b696a955585 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Wed, 19 Aug 2009 19:22:22 +0200 Subject: More portable fix for pointer alignments. The previous patch cast the pointer to (unsigned long) which fixed a truncation warning on 64 bit Linux, but didn't help on Win64. Casting to (size_t) is a little more portable, but mupdf doesn't use that type. Casting to (char*) and substractiong (char*)0 is the best solution for this. It looks a little messy; if more such checks are added, I suggest moving to a macro: #define PTR_ALIGN4(ptr) (!((char *)(ptr) - (char *)0) & 3)) However, the pointer in rendersolid() is already an (unsigned) char pointer. The check in decodetile() is actually checking an unsigned int pointer for 4-octet alignment, so I don't see how that can ever fail. --- fitzdraw/render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fitzdraw/render.c') diff --git a/fitzdraw/render.c b/fitzdraw/render.c index da06ed83..97941d95 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 long)p & 3) { + if ((p - (unsigned char *)0) & 3) { while (n--) { p[0] = a; -- cgit v1.2.3