mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-20 18:25:12 -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
|
||||
|
@ -36,10 +36,10 @@ static void test_upce_input(const testCtx *const p_ctx) {
|
|||
|
||||
struct item {
|
||||
int symbology;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret;
|
||||
|
||||
char *hrt;
|
||||
const char *hrt;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
|
@ -116,7 +116,7 @@ static void test_upce_input(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -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, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
|
@ -155,7 +155,7 @@ static void test_upca_print(const testCtx *const p_ctx) {
|
|||
|
||||
struct item {
|
||||
int symbology;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
|
@ -177,7 +177,7 @@ static void test_upca_print(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -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, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
strcpy(symbol->outfile, "out.gif");
|
||||
|
@ -197,9 +197,9 @@ static void test_upca_input(const testCtx *const p_ctx) {
|
|||
|
||||
struct item {
|
||||
int symbology;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret;
|
||||
char *expected_errtxt;
|
||||
const char *expected_errtxt;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
|
@ -297,7 +297,7 @@ static void test_upca_input(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -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, "i:%d 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);
|
||||
|
||||
|
@ -312,10 +312,10 @@ static void test_eanx_input(const testCtx *const p_ctx) {
|
|||
|
||||
struct item {
|
||||
int symbology;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret;
|
||||
char *ret_errtxt;
|
||||
char *comment;
|
||||
const char *ret_errtxt;
|
||||
const char *comment;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
|
@ -469,7 +469,7 @@ static void test_eanx_input(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -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);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, \"%s\", %s, \"%s\", \"%s\" },\n",
|
||||
|
@ -491,11 +491,11 @@ static void test_isbn_input(const testCtx *const p_ctx) {
|
|||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret_encode;
|
||||
int ret_vector;
|
||||
char *ret_errtxt;
|
||||
char *comment;
|
||||
const char *ret_errtxt;
|
||||
const char *comment;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
|
@ -622,7 +622,7 @@ static void test_isbn_input(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_ISBNX, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -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);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { \"%s\", %s, %d, \"%s\", \"%s\" },\n",
|
||||
|
@ -650,9 +650,9 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
struct item {
|
||||
int symbology;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret;
|
||||
char *expected;
|
||||
const char *expected;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
|
@ -729,7 +729,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -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, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
|
||||
|
@ -745,7 +745,7 @@ static void test_vector_same(const testCtx *const p_ctx) {
|
|||
|
||||
struct item {
|
||||
int symbology;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret_encode;
|
||||
int ret_vector;
|
||||
};
|
||||
|
@ -773,7 +773,7 @@ static void test_vector_same(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -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);
|
||||
|
||||
ret = ZBarcode_Buffer_Vector(symbol, 0);
|
||||
|
@ -808,13 +808,13 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
struct item {
|
||||
int symbology;
|
||||
int option_2;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *comment;
|
||||
char *expected;
|
||||
const char *comment;
|
||||
const char *expected;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_UPCA, -1, "01234567890", 0, 1, 95, "GGS Figure 5.1-1 UPC-A (also Figure 5.2.2.3-1., 5.2.6.6-2., 6.4.9-1. and BS EN 797:1996 Figure 3)",
|
||||
|
@ -948,7 +948,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*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, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
|
@ -1000,7 +1000,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
|
||||
struct item {
|
||||
int symbology;
|
||||
char *data;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
};
|
||||
|
@ -1033,7 +1033,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -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 ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
@ -1055,12 +1055,12 @@ static void test_perf(const testCtx *const p_ctx) {
|
|||
struct item {
|
||||
int symbology;
|
||||
int option_2;
|
||||
char *data;
|
||||
const char *data;
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *comment;
|
||||
const char *comment;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
|
@ -1108,7 +1108,7 @@ static void test_perf(const testCtx *const p_ctx) {
|
|||
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*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