aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2016-05-16 21:36:17 +1200
committerDavid Phillips <dbphillipsnz@gmail.com>2016-05-16 21:36:17 +1200
commitbb55d36f2924fb93a67c89adf0f8316f7d47a1ba (patch)
tree543e2992015499c4b4fbc20057c3209a8d15c259
parent1637ea7c6439ac88c88bb5d84c764d493aea3093 (diff)
downloadpgm-interlace-bb55d36f2924fb93a67c89adf0f8316f7d47a1ba.tar.xz
Begin style clean-up: initialise everything. Everything.
-rw-r--r--pgm-interlace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pgm-interlace.c b/pgm-interlace.c
index db7ea2b..8c95a09 100644
--- a/pgm-interlace.c
+++ b/pgm-interlace.c
@@ -75,6 +75,7 @@ int check_sanity(long width, long height, long white, unsigned int clust_total)
void eat_whitespace(FILE *fd)
{
int c = '\0';
+
do
{
c = fgetc(fd);
@@ -161,6 +162,7 @@ int read_non_negative_int(FILE *fd, char *token, size_t token_size)
int parse_header(FILE *fd, char *magic, size_t magic_len, long *width, long *height, int *white)
{
char token[32];
+
if (read_token(fd, magic, magic_len, NULL))
{
fprintf(stderr, "parse_header: failed to read magic number\n");
@@ -208,6 +210,7 @@ int parse_header(FILE *fd, char *magic, size_t magic_len, long *width, long *hei
return 0;
}
+/**/
void close_all(FILE **f, size_t f_len)
{
size_t i = 0;
@@ -264,7 +267,8 @@ int main(int argc, char **argv)
long size = 0;
long new_height = 0;
long new_size = 0;
- int white, new_white;
+ int white = 0;
+ int new_white = 0;
int clust_total = argc-1;
FILE **f = NULL;
char magic[3];