r65528 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65527‎ | r65528 | r65529 >
Date:22:23, 25 April 2010
Author:platonides
Status:deferred
Tags:
Comment:
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 (modified) (history)
  • /trunk/pngds/pngutil.c (modified) (history)

Diff [purge]

Index: trunk/pngds/pngutil.c
@@ -6,9 +6,6 @@
77 #include "pngutil.h"
88 #include "pngcmd.h"
99
10 -// TODO: support other architectures
11 -#define SWAP_BYTES(x) ((((x) & 0x000000FF) << 24) | (((x) & 0x0000FF00) << 8) | (((x) & 0x00FF0000) >> 8) | ((x) >> 24))
12 -
1310 void png_die(char *msg, void *data)
1411 {
1512 if (strcmp(msg, "critical_chunk") == 0)
@@ -22,9 +19,9 @@
2320
2421 uint32_t png_read_int(FILE *stream, uint32_t *crc)
2522 {
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];
2926 }
3027
3128 unsigned int png_fread(void *ptr, unsigned int size,
Index: trunk/pngds/Makefile
@@ -5,11 +5,11 @@
66
77 all: pngds
88
9 -pngreader:
 9+pngreader: $(SRCS)
1010 $(CC) $(CFLAGS) $(SRCS) -o pngreader -DPNGREADER
11 -pngresize:
 11+pngresize: $(SRCS)
1212 $(CC) $(CFLAGS) $(SRCS) -o pngresize -DPNGRESIZE
13 -pngds:
 13+pngds: $(SRCS)
1414 $(CC) $(CFLAGS) $(SRCS) -o pngds -DPNGDS
1515
1616 clean:

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r65512pngds: killed a couple of unneeded mallocs, one of which wasn't even accompan...maxsem18:11, 24 April 2010

Status & tagging log