commit 6520175e32edefc42a5825518b7504f168a6b218
parent 6c6d1a3d4979b4919e8354cd8e656cc0cea8c7c7
Author: sin <sin@2f30.org>
Date: Tue, 29 Jul 2014 12:18:15 +0100
Fix type inconsistencies and remove hacky compiler options
-Os generates lots of false positives and it is not worth it much
for such a small set of tools.
Diffstat:
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/config.mk b/config.mk
@@ -7,7 +7,7 @@ PREFIX = /usr/local
LIBS = -lpng
# flags
-CFLAGS = -std=c90 -pedantic -ansi -Wall -Wextra -Wno-pointer-sign -Wno-maybe-uninitialized -Wno-clobbered -Os
+CFLAGS = -std=c90 -ansi -pedantic -Wall -Wextra
LDFLAGS = -s ${LIBS}
# compiler and linker
diff --git a/if2png.c b/if2png.c
@@ -26,7 +26,8 @@ main(int argc, char *argv[])
png_structp png_struct_p;
png_infop png_info_p;
uint8_t hdr[17], *png_row;
- uint32_t width, height, png_row_len, i;
+ png_uint_32 width, height, i;
+ png_size_t png_row_len;
ARGBEGIN {
default:
@@ -41,7 +42,7 @@ main(int argc, char *argv[])
fprintf(stderr, "failed to read from stdin or input too short\n");
goto err;
}
- if (strcmp("imagefile", hdr)) {
+ if (memcmp("imagefile", hdr, 9)) {
fprintf(stderr, "invalid header\n");
goto err;
}
diff --git a/png2if.c b/png2if.c
@@ -24,7 +24,10 @@ main(int argc, char *argv[])
png_structp png_struct_p;
png_infop png_info_p;
png_bytepp png_row_p;
- uint32_t width, height, val_be, depth, color, interlace, png_row_len, r;
+ png_uint_32 width, height, i;
+ png_size_t png_row_len;
+ uint32_t val_be;
+ int depth, color, interlace;
ARGBEGIN {
default:
@@ -60,8 +63,8 @@ main(int argc, char *argv[])
fwrite(&val_be, sizeof(uint32_t), 1, stdout);
/* write data */
- for (r = 0; r < height; ++r) {
- if (fwrite(png_row_p[r], 1, (size_t)png_row_len, stdout) != png_row_len) {
+ for (i = 0; i < height; i++) {
+ if (fwrite(png_row_p[i], 1, png_row_len, stdout) != png_row_len) {
fprintf(stderr, "fwrite() failed\n");
goto err;
}