mirror of
https://git.code.sf.net/p/zint/code
synced 2026-01-08 04:21:59 +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:
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "testcommon.h"
|
||||
|
||||
INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
|
||||
INTERNAL int zint_gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
|
||||
|
||||
static void test_pixel_plot(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
@@ -86,20 +86,21 @@ 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 gif_pixel_plot size %d < sizeof(data_buf) %d\n", i, size, (int) sizeof(data_buf));
|
||||
assert_nonzero(size < (int) sizeof(data_buf), "i:%d zint_gif_pixel_plot size %d < sizeof(data_buf) %d\n",
|
||||
i, size, (int) sizeof(data_buf));
|
||||
|
||||
if (data[i].repeat) {
|
||||
testUtilStrCpyRepeat(data_buf, data[i].pattern, size);
|
||||
} else {
|
||||
strcpy(data_buf, data[i].pattern);
|
||||
}
|
||||
assert_equal(size, (int) strlen(data_buf), "i:%d gif_pixel_plot size %d != strlen(data_buf) %d\n",
|
||||
assert_equal(size, (int) strlen(data_buf), "i:%d zint_gif_pixel_plot size %d != strlen(data_buf) %d\n",
|
||||
i, size, (int) strlen(data_buf));
|
||||
|
||||
symbol->bitmap = (unsigned char *) data_buf;
|
||||
|
||||
ret = gif_pixel_plot(symbol, (unsigned char *) data_buf);
|
||||
assert_equal(ret, data[i].ret, "i:%d gif_pixel_plot ret %d != %d (%s)\n",
|
||||
ret = zint_gif_pixel_plot(symbol, (unsigned char *) data_buf);
|
||||
assert_equal(ret, data[i].ret, "i:%d zint_gif_pixel_plot ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
@@ -335,13 +336,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),
|
||||
"gif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
|
||||
"zint_gif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
|
||||
symbol.outfile, errno, strerror(errno));
|
||||
|
||||
ret = gif_pixel_plot(&symbol, data);
|
||||
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "gif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
|
||||
ret = zint_gif_pixel_plot(&symbol, data);
|
||||
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "zint_gif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
|
||||
ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
|
||||
assert_zero(testUtilRmROFile(symbol.outfile), "gif_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
|
||||
assert_zero(testUtilRmROFile(symbol.outfile), "zint_gif_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);
|
||||
@@ -349,9 +350,9 @@ static void test_outfile(const testCtx *const p_ctx) {
|
||||
|
||||
symbol.output_options |= BARCODE_STDOUT;
|
||||
|
||||
ret = gif_pixel_plot(&symbol, data);
|
||||
ret = zint_gif_pixel_plot(&symbol, data);
|
||||
printf(" - ignore (GIF to stdout)\n"); fflush(stdout);
|
||||
assert_zero(ret, "gif_pixel_plot ret %d != 0 (%s)\n", ret, symbol.errtxt);
|
||||
assert_zero(ret, "zint_gif_pixel_plot ret %d != 0 (%s)\n", ret, symbol.errtxt);
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user