From 85601f555a3a57db44631706a25e0f933afd8551 Mon Sep 17 00:00:00 2001 From: kartofen Date: Wed, 21 Dec 2022 01:06:18 +0200 Subject: works with different connections --- src/ppm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ppm.c') diff --git a/src/ppm.c b/src/ppm.c index 57a402b..eb309cb 100644 --- a/src/ppm.c +++ b/src/ppm.c @@ -8,12 +8,12 @@ void save_as_ppm(char* file_path, small_t *t, size_t width, size_t height, size_ { FILE *fp = fopen(file_path, "wb"); if(!fp) { - fprintf(stderr, "ERROR: Could not open file: %s\n", file_path); + err("Could not open file: %s\n", file_path); exit(EXIT_FAILURE); } if(scaler == 0) { - fprintf(stderr, "ERROR: Invalid value for scaler %ld\n", scaler); + err("Invalid value for scaler %ld\n", scaler); exit(EXIT_FAILURE); } @@ -33,7 +33,7 @@ char *load_from_ppm(char *file_path, size_t *width, size_t *height) { FILE *fp = fopen(file_path, "rb"); if(!fp) { - fprintf(stderr, "ERROR: Could not open file: %s\n", file_path); + err("Could not open file: %s\n", file_path); exit(EXIT_FAILURE); } @@ -41,7 +41,7 @@ char *load_from_ppm(char *file_path, size_t *width, size_t *height) fgets(line, sizeof(line), fp); if(strncmp(line, "P6", 2) != 0) { - fprintf(stderr, "ERROR: PPM header is not correct of file: %s\n", file_path); + err("PPM header is not correct of file: %s\n", file_path); exit(EXIT_FAILURE); } @@ -51,7 +51,7 @@ char *load_from_ppm(char *file_path, size_t *width, size_t *height) fgets(line, sizeof(line), fp); if(atoi(line) != 255) { - printf("Maximum color value must be 255"); + err("Maximum color value must be 255"); exit(1); } -- cgit v1.2.3