From f4852b11a8553120547db0b0c3fac1a96c981036 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Sat, 31 Dec 2016 10:44:09 +0000 Subject: [PATCH] Calculate addresses correctly if last TIFF strip is full --- backend/tif.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/tif.c b/backend/tif.c index 23a66c30..ec87bd98 100644 --- a/backend/tif.c +++ b/backend/tif.c @@ -94,7 +94,11 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { if (i != (strip_count - 1)) { strip_bytes[i] = rows_per_strip * symbol->bitmap_width * 3; } else { - strip_bytes[i] = (symbol->bitmap_height % rows_per_strip) * symbol->bitmap_width * 3; + if ((symbol->bitmap_height % rows_per_strip) != 0) { + strip_bytes[i] = (symbol->bitmap_height % rows_per_strip) * symbol->bitmap_width * 3; + } else { + strip_bytes[i] = rows_per_strip * symbol->bitmap_width * 3; + } } free_memory += strip_bytes[i]; if ((free_memory % 2) == 1) { @@ -102,8 +106,6 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { } } - printf("Mem%d\n", free_memory); - if (free_memory > 0xffff0000) { #ifdef _MSC_VER free(strip_offset);