1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-01-09 04:51:58 +00:00

general: prefix all INTERNAL funcs/tables with zint_, except

those in "backend/common.h", which are prefixed by `z_` - makes
  symbol clashes more unlikely when zint is statically linked
  (ticket #337, props Ulrich Becker)
DOTCODE: fix padding allowance (10 -> 52 - probable max 35) to
  cover cases with large no. of columns requested and little data,
  to prevent `codeword_array` buffer overflow
AZTEC/CODEONE: some code fiddling
general_field: prefix defines with `GF_`, shorten static funcs
  prefix `general_field_` -> `gf_`
This commit is contained in:
gitlost
2025-08-26 23:48:00 +01:00
parent e18b047a45
commit 39380d6767
106 changed files with 4477 additions and 4360 deletions

View File

@@ -34,7 +34,7 @@
#include <zlib.h> /* For ZLIBNG_VERSION define (if any) */
#include <sys/stat.h>
INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
INTERNAL int zint_png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
static void test_pixel_plot(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
@@ -83,7 +83,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->debug |= debug;
size = data[i].width * data[i].height;
assert_nonzero(size < (int) sizeof(data_buf), "i:%d png_pixel_plot size %d < sizeof(data_buf) %d\n",
assert_nonzero(size < (int) sizeof(data_buf), "i:%d zint_png_pixel_plot size %d < sizeof(data_buf) %d\n",
i, size, (int) sizeof(data_buf));
if (data[i].repeat) {
@@ -91,13 +91,13 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
} else {
strcpy(data_buf, data[i].pattern);
}
assert_equal(size, (int) strlen(data_buf), "i:%d png_pixel_plot size %d != strlen(data_buf) %d\n",
assert_equal(size, (int) strlen(data_buf), "i:%d zint_png_pixel_plot size %d != strlen(data_buf) %d\n",
i, size, (int) strlen(data_buf));
symbol->bitmap = (unsigned char *) data_buf;
ret = png_pixel_plot(symbol, (unsigned char *) data_buf);
assert_equal(ret, data[i].ret, "i:%d png_pixel_plot ret %d != %d (%s)\n",
ret = zint_png_pixel_plot(symbol, (unsigned char *) data_buf);
assert_equal(ret, data[i].ret, "i:%d zint_png_pixel_plot ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@@ -438,13 +438,13 @@ static void test_outfile(const testCtx *const p_ctx) {
(void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
assert_nonzero(testUtilCreateROFile(symbol.outfile),
"png_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
"zint_png_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
ret = png_pixel_plot(&symbol, data);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "png_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
ret = zint_png_pixel_plot(&symbol, data);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "zint_png_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
assert_zero(testUtilRmROFile(symbol.outfile), "png_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
assert_zero(testUtilRmROFile(symbol.outfile), "zint_png_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n",
symbol.errtxt, expected_errtxt);
@@ -453,9 +453,9 @@ static void test_outfile(const testCtx *const p_ctx) {
symbol.output_options |= BARCODE_STDOUT;
printf(">>>Begin ignore (PNG to stdout)\n"); fflush(stdout);
ret = png_pixel_plot(&symbol, data);
ret = zint_png_pixel_plot(&symbol, data);
printf("\n<<<End ignore (PNG to stdout)\n"); fflush(stdout);
assert_zero(ret, "png_pixel_plot ret %d != 0 (%s)\n", ret, symbol.errtxt);
assert_zero(ret, "zint_png_pixel_plot ret %d != 0 (%s)\n", ret, symbol.errtxt);
testFinish();
}
@@ -468,7 +468,7 @@ struct wpng_error_type {
jmp_buf jmpbuf;
};
INTERNAL void wpng_error_handler_test(png_structp png_ptr, png_const_charp msg);
INTERNAL void zint_test_wpng_error_handler(png_structp png_ptr, png_const_charp msg);
static void test_wpng_error_handler(const testCtx *const p_ctx) {
int ret;
@@ -496,7 +496,7 @@ static void test_wpng_error_handler(const testCtx *const p_ctx) {
fp = testUtilOpen(filename, "r");
assert_nonnull(fp, "testUtilOpen(%s) for read failed\n", filename);
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, &wpng_error, wpng_error_handler_test, NULL);
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, &wpng_error, zint_test_wpng_error_handler, NULL);
assert_nonnull(png_ptr, "png_create_write_struct failed\n");
info_ptr = png_create_info_struct(png_ptr);