Hi, here are a some fixes for xloadimage that I've had in the OpenBSD package for a long time and that Debian might want to pick up:
(1) cmuwmraster.c The image header fields have a fixed width, see cmuwmraster.h, so they need to be accessed with this width and not with architecture-dependent sizes like sizeof(long). (2) image.h The C integer promotion rules are tricky. Arithmetic on unsigned chars is done at type int, which is sign-extended when cast to unsigned long (on LP64 platforms). Insert a cast to unsigned int to prevent, say, 0x88664422 from ending up as 0xFFFFFFFF88664422. (3) uufilter.c Include <stdlib.h> to fetch the prototype for exit(). --- cmuwmraster.c.orig Wed Jul 16 16:22:59 2008 +++ cmuwmraster.c Wed Jul 16 16:23:21 2008 @@ -22,9 +22,9 @@ struct cmuwm_header *headerp; { printf("%s is a %ldx%ld %ld plane CMU WM raster\n", name, - memToVal(headerp->width, sizeof(long)), - memToVal(headerp->height, sizeof(long)), - memToVal(headerp->depth, sizeof(short))); + memToVal(headerp->width, 4), + memToVal(headerp->height, 4), + memToVal(headerp->depth, 2)); } int cmuwmIdent(fullname, name) @@ -48,7 +48,7 @@ char *fullname, *name; break; case sizeof(struct cmuwm_header): - if (memToVal(header.magic, sizeof(long)) != CMUWM_MAGIC) + if (memToVal(header.magic, 4) != CMUWM_MAGIC) { r = 0; break; @@ -91,7 +91,7 @@ unsigned int verbose; exit(1); case sizeof(struct cmuwm_header): - if (memToVal(header.magic, sizeof(long)) != CMUWM_MAGIC) + if (memToVal(header.magic, 4) != CMUWM_MAGIC) { zclose(zf); return(NULL); @@ -104,16 +104,16 @@ unsigned int verbose; return(NULL); } - if (memToVal(header.depth, sizeof(short)) != 1) + if (memToVal(header.depth, 2) != 1) { fprintf(stderr,"CMU WM raster %s is of depth %d, must be 1", name, - (int) header.depth); + memToVal(header.depth, 2)); return(NULL); } - image = newBitImage(width = memToVal(header.width, sizeof(long)), - height = memToVal(header.height, sizeof(long))); + image = newBitImage(width = memToVal(header.width, 4), + height = memToVal(header.height, 4)); linelen = (width / 8) + (width % 8 ? 1 : 0); lineptr = image->data; --- image.h.orig Fri Apr 13 12:46:25 2012 +++ image.h Fri Apr 13 12:47:21 2012 @@ -163,7 +163,7 @@ typedef struct { ((LEN) == 2 ? ((unsigned long) \ (*(byte *)(PTR) << 8) | \ (*((byte *)(PTR) + 1))) : \ - ((unsigned long)((*(byte *)(PTR) << 24) | \ + ((unsigned long)(unsigned int)((*(byte *)(PTR) << 24) | \ (*((byte *)(PTR) + 1) << 16) | \ (*((byte *)(PTR) + 2) << 8) | \ (*((byte *)(PTR) + 3))))))) @@ -176,7 +176,7 @@ typedef struct { (*((byte *)(PTR) + 2) << 16)) : \ ((LEN) == 2 ? ((unsigned long) \ (*(byte *)(PTR)) | (*((byte *)(PTR) + 1) << 8)) : \ - ((unsigned long)((*(byte *)(PTR)) | \ + ((unsigned long)(unsigned int)((*(byte *)(PTR)) | \ (*((byte *)(PTR) + 1) << 8) | \ (*((byte *)(PTR) + 2) << 16) | \ (*((byte *)(PTR) + 3) << 24)))))) --- uufilter.c.orig Tue Oct 26 18:48:44 2010 +++ uufilter.c Tue Oct 26 18:48:59 2010 @@ -11,6 +11,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <string.h> int main(argc, argv) -- Christian "naddy" Weisgerber na...@mips.inka.de -- To UNSUBSCRIBE, email to debian-qa-packages-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120413105252.ga48...@lorvorc.mips.inka.de