From 556189ee3aee9db6372444cc1bcb01c29c7b4094 Mon Sep 17 00:00:00 2001 From: Lennart Buhl Date: Sat, 2 Nov 2013 23:14:08 +0100 Subject: [PATCH] image.c: use MAX --- src/display.c | 2 +- src/image.c | 10 +++++++++- src/image.h | 6 ------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/display.c b/src/display.c index 423971e..70abff4 100644 --- a/src/display.c +++ b/src/display.c @@ -46,7 +46,7 @@ statisch nichts print_current_image(konstant struktur message* msg, zahl start, void prntscreen(const struct message *msg, const struct prog_info *pinfo); void callback(const struct message *msg, const struct prog_info *pinfo) { -// printf("in callback, tst=%d\n", msg->timestamp); + //printf("in callback, tst=%d\n", msg->timestamp); // calculate the actual offset to use //int start = msg->timestamp % msg->width + pinfo->client_offset; diff --git a/src/image.c b/src/image.c index 2362efc..1840c58 100644 --- a/src/image.c +++ b/src/image.c @@ -1,5 +1,12 @@ +#include +#include +#include +#include // MAX + #include "image.h" +#define LINELEN 20000 + char *readImage(const char* filename, int *cols, int *rows) { FILE *f = fopen(filename, "r"); @@ -11,7 +18,7 @@ char *readImage(const char* filename, int *cols, int *rows) { if (!f) { while (fgets(linebuf, LINELEN, f)) { int len = strlen(linebuf); - *cols = len>*cols?len:*cols; + *cols = MAX(len, *cols); (*rows)++; } @@ -29,3 +36,4 @@ char *readImage(const char* filename, int *cols, int *rows) { return ret; } + diff --git a/src/image.h b/src/image.h index 4735e46..b3b7ba0 100644 --- a/src/image.h +++ b/src/image.h @@ -1,12 +1,6 @@ #ifndef __IMAGE #define __IMAGE -#include -#include -#include - -#define LINELEN 20000 - char *readImage(const char* filename, int *cols, int *rows); #endif