diff --git a/Startcode/imageInput.c b/Startcode/imageInput.c index 20e4acf..31b24c9 100644 --- a/Startcode/imageInput.c +++ b/Startcode/imageInput.c @@ -45,15 +45,16 @@ ending_openAndCheck: static int getUShort(FILE **fd, unsigned short *bilderAnzahl) { - if (!fread(bilderAnzahl, (size_t)sizeof(unsigned short), 1, *fd)) + size_t bytes = 0; + if (!(bytes = fread(bilderAnzahl, (size_t)sizeof(unsigned short), 1, *fd)) || bytes != 1) return 1; return 0; } static int getUChar(FILE **fd, unsigned char *dest) { - // unsigned short lab = '0'; - if (!fread(dest, sizeof(*dest), 1, *fd)) + size_t bytes = 0; + if (!(bytes = fread(dest, sizeof(*dest), 1, *fd)) || bytes != 1) return 1; // printf("Read Label: %d\n", *dest); return 0;