From 994c5adb10da5707761b3de0c03c5e302b4eefff Mon Sep 17 00:00:00 2001 From: Harald Oehlmann Date: Tue, 18 Aug 2015 14:17:59 +0200 Subject: [PATCH] Fix batch bugs: 1) interpretation of former code included in next if shorter, wrong eof detection issed wrong warning --- backend/library.c | 2 +- frontend/main.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/library.c b/backend/library.c index 68a9ab61..467e471d 100755 --- a/backend/library.c +++ b/backend/library.c @@ -88,7 +88,7 @@ void ZBarcode_Clear(struct zint_symbol *symbol) } symbol->rows = 0; symbol->width = 0; - symbol->text[0] = '\0'; + memset(symbol->text,0,128); symbol->errtxt[0] = '\0'; if (symbol->bitmap != NULL) { diff --git a/frontend/main.c b/frontend/main.c index afdd3426..95f8a58c 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -223,7 +223,12 @@ int batch_process(struct zint_symbol *symbol, char *filename) } do { - character = fgetc(file); + int intChar; + intChar = fgetc(file); + if (intChar == EOF) { + break; + } + character = (unsigned char) intChar; if(character == '\n') { if(buffer[posn - 1] == '\r') { /* CR+LF - assume Windows formatting and remove CR */