From 4ddcfb3613e34b1948f74aee2b12de4965e52a8f Mon Sep 17 00:00:00 2001 From: gitlost Date: Tue, 4 Aug 2020 00:36:27 +0100 Subject: [PATCH] dpd/gif suppress warnings; tests refresh svgs, dpd examples --- backend/code128.c | 2 +- backend/gif.c | 2 +- backend/tests/data/print/svg/code128_aim.svg | 2 +- .../tests/data/print/svg/dotcode_aim_fig7.svg | 78 +++++++++---------- backend/tests/data/svg/code128_amperands.svg | 2 +- .../data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg | 8 +- .../data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg | 8 +- backend/tests/data/svg/ean2.svg | 2 +- backend/tests/data/svg/ean5.svg | 2 +- backend/tests/data/svg/ean8_2addon.svg | 6 +- backend/tests/data/svg/ean8_5addon.svg | 6 +- .../data/svg/upca_2addon_ggs_5.2.6.6-5.svg | 10 +-- backend/tests/data/svg/upca_5addon.svg | 10 +-- backend/tests/data/svg/upce_2addon.svg | 8 +- backend/tests/data/svg/upce_5addon.svg | 8 +- backend/tests/test_code128.c | 10 +++ backend/tests/testcommon.c | 2 +- 17 files changed, 88 insertions(+), 78 deletions(-) diff --git a/backend/code128.c b/backend/code128.c index ac597d74..4854b8e7 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -1112,7 +1112,7 @@ INTERNAL int ean_14(struct zint_symbol *symbol, unsigned char source[], int leng INTERNAL int dpd_parcel(struct zint_symbol *symbol, unsigned char source[], int length) { int error_number = 0; int i, p; - char identifier; + unsigned char identifier; const int mod = 36; int cd; // Check digit diff --git a/backend/gif.c b/backend/gif.c index 4a7bf767..9d5c7476 100644 --- a/backend/gif.c +++ b/backend/gif.c @@ -286,7 +286,7 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { int paletteSize; statestruct State; int transparent_index; - int bgindex, fgindex; + int bgindex = -1, fgindex = -1; unsigned char backgroundColourIndex; unsigned char RGBCur[3]; diff --git a/backend/tests/data/print/svg/code128_aim.svg b/backend/tests/data/print/svg/code128_aim.svg index c552746e..dbafcbb1 100644 --- a/backend/tests/data/print/svg/code128_aim.svg +++ b/backend/tests/data/print/svg/code128_aim.svg @@ -28,7 +28,7 @@ + font-family="Helvetica" font-size="18.0" > AIM diff --git a/backend/tests/data/print/svg/dotcode_aim_fig7.svg b/backend/tests/data/print/svg/dotcode_aim_fig7.svg index f07c2d59..6273525f 100644 --- a/backend/tests/data/print/svg/dotcode_aim_fig7.svg +++ b/backend/tests/data/print/svg/dotcode_aim_fig7.svg @@ -8,44 +8,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/tests/data/svg/code128_amperands.svg b/backend/tests/data/svg/code128_amperands.svg index 0c5e1212..071b7c66 100644 --- a/backend/tests/data/svg/code128_amperands.svg +++ b/backend/tests/data/svg/code128_amperands.svg @@ -34,7 +34,7 @@ + font-family="Helvetica" font-size="18.0" > <>"&' diff --git a/backend/tests/data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg b/backend/tests/data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg index 9a2bcc61..27a04678 100644 --- a/backend/tests/data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg +++ b/backend/tests/data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg @@ -46,19 +46,19 @@ + font-family="Helvetica" font-size="22.0" > 9 + font-family="Helvetica" font-size="22.0" > 771384 + font-family="Helvetica" font-size="22.0" > 524017 + font-family="Helvetica" font-size="22.0" > 12 diff --git a/backend/tests/data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg b/backend/tests/data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg index 70e75e89..6865935e 100644 --- a/backend/tests/data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg +++ b/backend/tests/data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg @@ -55,19 +55,19 @@ + font-family="Helvetica" font-size="22.0" > 9 + font-family="Helvetica" font-size="22.0" > 780877 + font-family="Helvetica" font-size="22.0" > 799306 + font-family="Helvetica" font-size="22.0" > 54321 diff --git a/backend/tests/data/svg/ean2.svg b/backend/tests/data/svg/ean2.svg index de4f02d4..25b31406 100644 --- a/backend/tests/data/svg/ean2.svg +++ b/backend/tests/data/svg/ean2.svg @@ -16,7 +16,7 @@ + font-family="Helvetica" font-size="22.0" > 12 diff --git a/backend/tests/data/svg/ean5.svg b/backend/tests/data/svg/ean5.svg index 156038d0..30fd272f 100644 --- a/backend/tests/data/svg/ean5.svg +++ b/backend/tests/data/svg/ean5.svg @@ -25,7 +25,7 @@ + font-family="Helvetica" font-size="22.0" > 12345 diff --git a/backend/tests/data/svg/ean8_2addon.svg b/backend/tests/data/svg/ean8_2addon.svg index 9693a44e..a61763ff 100644 --- a/backend/tests/data/svg/ean8_2addon.svg +++ b/backend/tests/data/svg/ean8_2addon.svg @@ -38,15 +38,15 @@ + font-family="Helvetica" font-size="22.0" > 1234 + font-family="Helvetica" font-size="22.0" > 5670 + font-family="Helvetica" font-size="22.0" > 12 diff --git a/backend/tests/data/svg/ean8_5addon.svg b/backend/tests/data/svg/ean8_5addon.svg index 5d1a2833..4d010166 100644 --- a/backend/tests/data/svg/ean8_5addon.svg +++ b/backend/tests/data/svg/ean8_5addon.svg @@ -47,15 +47,15 @@ + font-family="Helvetica" font-size="22.0" > 1234 + font-family="Helvetica" font-size="22.0" > 5670 + font-family="Helvetica" font-size="22.0" > 12345 diff --git a/backend/tests/data/svg/upca_2addon_ggs_5.2.6.6-5.svg b/backend/tests/data/svg/upca_2addon_ggs_5.2.6.6-5.svg index 6f1dc0b6..f7898ce9 100644 --- a/backend/tests/data/svg/upca_2addon_ggs_5.2.6.6-5.svg +++ b/backend/tests/data/svg/upca_2addon_ggs_5.2.6.6-5.svg @@ -46,23 +46,23 @@ + font-family="Helvetica" font-size="16.0" > 0 + font-family="Helvetica" font-size="22.0" > 12345 + font-family="Helvetica" font-size="22.0" > 67890 + font-family="Helvetica" font-size="16.0" > 5 + font-family="Helvetica" font-size="22.0" > 24 diff --git a/backend/tests/data/svg/upca_5addon.svg b/backend/tests/data/svg/upca_5addon.svg index 218af826..ade5bb02 100644 --- a/backend/tests/data/svg/upca_5addon.svg +++ b/backend/tests/data/svg/upca_5addon.svg @@ -55,23 +55,23 @@ + font-family="Helvetica" font-size="16.0" > 6 + font-family="Helvetica" font-size="22.0" > 14141 + font-family="Helvetica" font-size="22.0" > 23441 + font-family="Helvetica" font-size="16.0" > 7 + font-family="Helvetica" font-size="22.0" > 12345 diff --git a/backend/tests/data/svg/upce_2addon.svg b/backend/tests/data/svg/upce_2addon.svg index 05f298ec..6676ab04 100644 --- a/backend/tests/data/svg/upce_2addon.svg +++ b/backend/tests/data/svg/upce_2addon.svg @@ -33,19 +33,19 @@ + font-family="Helvetica" font-size="16.0" > 1 + font-family="Helvetica" font-size="22.0" > 234567 + font-family="Helvetica" font-size="16.0" > 0 + font-family="Helvetica" font-size="22.0" > 12 diff --git a/backend/tests/data/svg/upce_5addon.svg b/backend/tests/data/svg/upce_5addon.svg index 4aac7c00..8bbec68b 100644 --- a/backend/tests/data/svg/upce_5addon.svg +++ b/backend/tests/data/svg/upce_5addon.svg @@ -42,19 +42,19 @@ + font-family="Helvetica" font-size="16.0" > 1 + font-family="Helvetica" font-size="22.0" > 234567 + font-family="Helvetica" font-size="16.0" > 0 + font-family="Helvetica" font-size="22.0" > 12345 diff --git a/backend/tests/test_code128.c b/backend/tests/test_code128.c index 54b5408f..b59ebb9f 100644 --- a/backend/tests/test_code128.c +++ b/backend/tests/test_code128.c @@ -506,6 +506,7 @@ static void test_encode(int index, int generate, int debug) { char *expected; }; // BARCODE_GS1_128 examples verified manually against GS1 General Specifications 20.0 (GGS) + // BARCODE_DPD examples Specification DPD and primetime Parcel Despatch (DPDAPPD) Version 4.0.2 struct item data[] = { /* 0*/ { BARCODE_CODE128, UNICODE_MODE, "AIM", 0, 1, 68, 1, "ISO/IEC 15417:2007 Figure 1", "11010010000101000110001100010001010111011000101110110001100011101011" @@ -624,6 +625,15 @@ static void test_encode(int index, int generate, int debug) { /* 38*/ { BARCODE_HIBC_128, UNICODE_MODE, "$$52001510X3G", 0, 1, 178, 1, "ANSI/HIBC 2.6 - 2016 Figure 5, same", "1101001000011000100100100100011001001000110010111011110110111000101101100110010111001100110010001001011110111011100010110110010111001101000100010110001000100011110101100011101011" }, + /* 39*/ { BARCODE_DPD, UNICODE_MODE, "%000393206219912345678101040", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustrations 2, 7, 8, same; NOTE: correct HRT given by Illustration 7 only", + "1101001000010001001100100111011001011101111011011001100110100010001100011011010011001000110111001001011101111010110011100100010110001110001011011000010100110010001001100100010011000101000101011110001100011101011" + }, + /* 40*/ { BARCODE_DPD, UNICODE_MODE, "%000393206219912345678101040", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustration 6 **NOT SAME** HRT incorrect, also uses CodeA and inefficient encoding; verified against tec-it", + "1101001000010001001100100111011001011101111011011001100110100010001100011011010011001000110111001001011101111010110011100100010110001110001011011000010100110010001001100100010011000101000101011110001100011101011" + }, + /* 41*/ { BARCODE_DPD, UNICODE_MODE, "0123456789012345678901234567", 0, 1, 189, 1, "DPDAPPD 4.0.2 - Illustration 9, same (allowing for literal HRT)", + "110100111001100110110011101101110101110110001000010110011011011110110011011001110110111010111011000100001011001101101111011001101100111011011101011101100010000101100101011110001100011101011" + }, }; int data_size = sizeof(data) / sizeof(struct item); diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index efbd2c30..267eaecd 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -326,7 +326,7 @@ char *testUtilBarcodeName(int symbology) { { "BARCODE_DAFT", BARCODE_DAFT, 93 }, { "", -1, 94 }, { "", -1, 95 }, - { "", -1, 96 }, + { "BARCODE_DPD", BARCODE_DPD, 96 }, { "BARCODE_MICROQR", BARCODE_MICROQR, 97 }, { "BARCODE_HIBC_128", BARCODE_HIBC_128, 98 }, { "BARCODE_HIBC_39", BARCODE_HIBC_39, 99 },