Index: trunk/pngds/pngutil.c |
— | — | @@ -6,9 +6,6 @@ |
7 | 7 | #include "pngutil.h" |
8 | 8 | #include "pngcmd.h" |
9 | 9 | |
10 | | -// TODO: support other architectures |
11 | | -#define SWAP_BYTES(x) ((((x) & 0x000000FF) << 24) | (((x) & 0x0000FF00) << 8) | (((x) & 0x00FF0000) >> 8) | ((x) >> 24)) |
12 | | - |
13 | 10 | void png_die(char *msg, void *data) |
14 | 11 | { |
15 | 12 | if (strcmp(msg, "critical_chunk") == 0) |
— | — | @@ -22,9 +19,9 @@ |
23 | 20 | |
24 | 21 | uint32_t png_read_int(FILE *stream, uint32_t *crc) |
25 | 22 | { |
26 | | - uint32_t result = 0; |
27 | | - png_fread(&result, 4, stream, crc); |
28 | | - return SWAP_BYTES(result); |
| 23 | + unsigned char bytes[4]; |
| 24 | + png_fread(bytes, 4, stream, crc); |
| 25 | + return (((((bytes[0] << 8) | bytes[1]) << 8) | bytes[2]) << 8) | bytes[3]; |
29 | 26 | } |
30 | 27 | |
31 | 28 | unsigned int png_fread(void *ptr, unsigned int size, |
Index: trunk/pngds/Makefile |
— | — | @@ -5,11 +5,11 @@ |
6 | 6 | |
7 | 7 | all: pngds |
8 | 8 | |
9 | | -pngreader: |
| 9 | +pngreader: $(SRCS) |
10 | 10 | $(CC) $(CFLAGS) $(SRCS) -o pngreader -DPNGREADER |
11 | | -pngresize: |
| 11 | +pngresize: $(SRCS) |
12 | 12 | $(CC) $(CFLAGS) $(SRCS) -o pngresize -DPNGRESIZE |
13 | | -pngds: |
| 13 | +pngds: $(SRCS) |
14 | 14 | $(CC) $(CFLAGS) $(SRCS) -o pngds -DPNGDS |
15 | 15 | |
16 | 16 | clean: |