http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65528
Revision: 65528 Author: platonides Date: 2010-04-25 22:23:45 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Follow up r65512 supporting all architectures again while not reading 1 byte a time. You only have to take into account that these chars have to be unsigned. Added requisites to the Makefile. Modified Paths: -------------- trunk/pngds/Makefile trunk/pngds/pngutil.c Modified: trunk/pngds/Makefile =================================================================== --- trunk/pngds/Makefile 2010-04-25 21:02:19 UTC (rev 65527) +++ trunk/pngds/Makefile 2010-04-25 22:23:45 UTC (rev 65528) @@ -5,11 +5,11 @@ all: pngds -pngreader: +pngreader: $(SRCS) $(CC) $(CFLAGS) $(SRCS) -o pngreader -DPNGREADER -pngresize: +pngresize: $(SRCS) $(CC) $(CFLAGS) $(SRCS) -o pngresize -DPNGRESIZE -pngds: +pngds: $(SRCS) $(CC) $(CFLAGS) $(SRCS) -o pngds -DPNGDS clean: Modified: trunk/pngds/pngutil.c =================================================================== --- trunk/pngds/pngutil.c 2010-04-25 21:02:19 UTC (rev 65527) +++ trunk/pngds/pngutil.c 2010-04-25 22:23:45 UTC (rev 65528) @@ -6,9 +6,6 @@ #include "pngutil.h" #include "pngcmd.h" -// TODO: support other architectures -#define SWAP_BYTES(x) ((((x) & 0x000000FF) << 24) | (((x) & 0x0000FF00) << 8) | (((x) & 0x00FF0000) >> 8) | ((x) >> 24)) - void png_die(char *msg, void *data) { if (strcmp(msg, "critical_chunk") == 0) @@ -22,9 +19,9 @@ uint32_t png_read_int(FILE *stream, uint32_t *crc) { - uint32_t result = 0; - png_fread(&result, 4, stream, crc); - return SWAP_BYTES(result); + unsigned char bytes[4]; + png_fread(bytes, 4, stream, crc); + return (((((bytes[0] << 8) | bytes[1]) << 8) | bytes[2]) << 8) | bytes[3]; } unsigned int png_fread(void *ptr, unsigned int size, _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs