CMakeLists.txt: cmake min required 3.13 -> 3.5 using CMAKE_REQUIRED_LIBRARIES; add ZINT_COVERAGE option

bmp/emf/ps.c: allow for foreground colour in ULTRA
bmp/gif/pcx.c: allow for BARCODE_STDOUT (fflush/fclose)
emf.c: hexagon rotation field not used; dont't use float index in font loop; Windows stdout binary mode
png.c: remove unused 8-bit; simplify libpng error handling and fclose outfile on error
ps.c: fix buffer overflow on colour_to_pscolor() CMYK
tif.c: fix BLACKISZERO indexes
CODE39: simplify check digit setting
reedsol.c: rs_uint_init_gf() log/alog tables must be zeroed
ZBarcode_Encode: debug: fix access out-of-bounds on non-NUL-terminated source if length < 10
manual.txt/zint.h: document NUL-terminated strings
tests: cover further cases for output (bmp/emf/etc), eci/gb18030/gb2312/sjis, reedsol, AZTEC, CODE39
This commit is contained in:
gitlost 2021-07-26 15:29:05 +01:00
parent 059abdf6a1
commit 3f33ed3eb9
90 changed files with 3754 additions and 863 deletions

View file

@ -51,6 +51,7 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
pcx_header_t header;
int bytes_per_line = symbol->bitmap_width + (symbol->bitmap_width & 1); // Must be even
unsigned char previous;
const int output_to_stdout = symbol->output_options & BARCODE_STDOUT; /* Suppress gcc -fanalyzer warning */
#ifdef _MSC_VER
unsigned char *rle_row;
#endif
@ -99,17 +100,17 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
}
/* Open output file in binary mode */
if (symbol->output_options & BARCODE_STDOUT) {
if (output_to_stdout) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
sprintf(symbol->errtxt, "620: Can't open output file (%d: %.30s)", errno, strerror(errno));
sprintf(symbol->errtxt, "620: Could not set stdout to binary (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_ACCESS;
}
#endif
pcx_file = stdout;
} else {
if (!(pcx_file = fopen(symbol->outfile, "wb"))) {
sprintf(symbol->errtxt, "621: Can't open output file (%d: %.30s)", errno, strerror(errno));
sprintf(symbol->errtxt, "621: Could not open output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_ACCESS;
}
}
@ -215,7 +216,11 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
}
}
fclose(pcx_file);
if (output_to_stdout) {
fflush(pcx_file);
} else {
fclose(pcx_file);
}
return 0;
}