Calculate addresses correctly if last TIFF strip is full

This commit is contained in:
Robin Stuart 2016-12-31 10:44:09 +00:00
parent ec8cfcbb76
commit f4852b11a8

View file

@ -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);