mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-22 03:05:11 -04:00
general: reenable -Wpedantic for gcc by using __extension__
(ZEXT)
to suppress warnings about `errtxtf` operand number "%<n>$" args; enable some further warnings test suite: enable -Wpedantic and fix/suppress any warnings
This commit is contained in:
parent
a4b557786f
commit
b377b14360
93 changed files with 1397 additions and 1370 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
@ -38,12 +38,12 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
int option_1;
|
||||
int option_2;
|
||||
int option_3;
|
||||
char *pattern;
|
||||
const char *pattern;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *expected_errtxt;
|
||||
const char *expected_errtxt;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
|
@ -96,7 +96,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_HANXIN, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
|
||||
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
|
||||
|
||||
|
@ -129,7 +129,7 @@ static void test_options(const testCtx *const p_ctx) {
|
|||
struct item {
|
||||
int option_1;
|
||||
int option_2;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret_encode;
|
||||
int ret_vector;
|
||||
int expected_size;
|
||||
|
@ -170,7 +170,7 @@ static void test_options(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_HANXIN, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
|
||||
|
||||
if (data[i].ret_vector != -1) {
|
||||
|
@ -206,13 +206,13 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int input_mode;
|
||||
int eci;
|
||||
int option_3;
|
||||
char *data;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
char *expected;
|
||||
const char *expected;
|
||||
int zxingcpp_cmp;
|
||||
char *comment;
|
||||
const char *comment;
|
||||
};
|
||||
/*
|
||||
é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, in GB 18030 0xA8A6, UTF-8 C3A9
|
||||
|
@ -338,7 +338,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_HANXIN, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, data[i].option_3, -1 /*output_options*/, data[i].data, data[i].length, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
|
@ -387,14 +387,14 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
int option_1;
|
||||
int option_2;
|
||||
int option_3;
|
||||
char *data;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *comment;
|
||||
char *expected;
|
||||
const char *comment;
|
||||
const char *expected;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, -1, -1, "1234", -1, 0, 23, 23, "Mode nnnn, mask 10",
|
||||
|
@ -3187,7 +3187,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/,
|
||||
data[i].data, data[i].length, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
|
@ -3240,8 +3240,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *comment;
|
||||
char *expected;
|
||||
const char *comment;
|
||||
const char *expected;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 23, 23, "Standard example",
|
||||
|
@ -3542,11 +3542,11 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
int option_1;
|
||||
int option_2;
|
||||
int option_3;
|
||||
char *data;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int bwipp_cmp;
|
||||
char *comment;
|
||||
const char *comment;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
|
@ -3567,7 +3567,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, data[i].length, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
@ -3589,12 +3589,12 @@ static void test_perf(const testCtx *const p_ctx) {
|
|||
int input_mode;
|
||||
int option_1;
|
||||
int option_2;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *comment;
|
||||
const char *comment;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_HANXIN, UNICODE_MODE, -1, -1,
|
||||
|
@ -3653,7 +3653,7 @@ static void test_perf(const testCtx *const p_ctx) {
|
|||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
|
||||
start = clock();
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
diff_encode += clock() - start;
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue