testcommon: fix sizeof bug; AZTEC/QR: suppress cppcheck warnings (#233)

This commit is contained in:
gitlost 2021-07-06 12:13:34 +01:00
parent 9b02cd5221
commit 4d3aae45d0
13 changed files with 184 additions and 110 deletions

View File

@ -1485,7 +1485,7 @@ INTERNAL int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int
for (x = 8; x < 19; x++) { for (x = 8; x < 19; x++) {
if (CompactAztecMap[r + x] == 1) { if (CompactAztecMap[r + x] == 1) {
set_module(symbol, y - 8, x - 8); set_module(symbol, y - 8, x - 8);
} else if (CompactAztecMap[r + x] >= 2 && binary_string[CompactAztecMap[r + x] - 2000] == '1') { } else if (CompactAztecMap[r + x] && binary_string[CompactAztecMap[r + x] - 2000] == '1') {
set_module(symbol, y - 8, x - 8); set_module(symbol, y - 8, x - 8);
} }
} }

View File

@ -35,33 +35,34 @@
static const short CompactAztecMap[] = { static const short CompactAztecMap[] = {
/* 27 x 27 data grid */ /* 27 x 27 data grid */
609, 608, 411, 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459, 609, 608, 411, 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459, // 0
607, 606, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 607, 606, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, // 1
605, 604, 409, 408, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 460, 461, 605, 604, 409, 408, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 460, 461, // 2
603, 602, 407, 406, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 462, 463, 603, 602, 407, 406, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 462, 463, // 3
601, 600, 405, 404, 241, 240, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 284, 285, 464, 465, 601, 600, 405, 404, 241, 240, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 284, 285, 464, 465, // 4
599, 598, 403, 402, 239, 238, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 286, 287, 466, 467, 599, 598, 403, 402, 239, 238, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 286, 287, 466, 467, // 5
597, 596, 401, 400, 237, 236, 105, 104, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 140, 141, 288, 289, 468, 469, 597, 596, 401, 400, 237, 236, 105, 104, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 140, 141, 288, 289, 468, 469, // 6
595, 594, 399, 398, 235, 234, 103, 102, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 142, 143, 290, 291, 470, 471, 595, 594, 399, 398, 235, 234, 103, 102, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 142, 143, 290, 291, 470, 471, // 7
593, 592, 397, 396, 233, 232, 101, 100, 1, 1, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 0, 1, 28, 29, 144, 145, 292, 293, 472, 473, 593, 592, 397, 396, 233, 232, 101, 100, 1, 1, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 0, 1, 28, 29, 144, 145, 292, 293, 472, 473, // 8
591, 590, 395, 394, 231, 230, 99, 98, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 30, 31, 146, 147, 294, 295, 474, 475, 591, 590, 395, 394, 231, 230, 99, 98, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 30, 31, 146, 147, 294, 295, 474, 475, // 9
589, 588, 393, 392, 229, 228, 97, 96, 2027, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2007, 32, 33, 148, 149, 296, 297, 476, 477, 589, 588, 393, 392, 229, 228, 97, 96, 2027, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2007, 32, 33, 148, 149, 296, 297, 476, 477, // 10
587, 586, 391, 390, 227, 226, 95, 94, 2026, 1, 0, 1, 1, 1, 1, 1, 0, 1, 2008, 34, 35, 150, 151, 298, 299, 478, 479, 587, 586, 391, 390, 227, 226, 95, 94, 2026, 1, 0, 1, 1, 1, 1, 1, 0, 1, 2008, 34, 35, 150, 151, 298, 299, 478, 479, // 11
585, 584, 389, 388, 225, 224, 93, 92, 2025, 1, 0, 1, 0, 0, 0, 1, 0, 1, 2009, 36, 37, 152, 153, 300, 301, 480, 481, 585, 584, 389, 388, 225, 224, 93, 92, 2025, 1, 0, 1, 0, 0, 0, 1, 0, 1, 2009, 36, 37, 152, 153, 300, 301, 480, 481, // 12
583, 582, 387, 386, 223, 222, 91, 90, 2024, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2010, 38, 39, 154, 155, 302, 303, 482, 483, 583, 582, 387, 386, 223, 222, 91, 90, 2024, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2010, 38, 39, 154, 155, 302, 303, 482, 483, // 13
581, 580, 385, 384, 221, 220, 89, 88, 2023, 1, 0, 1, 0, 0, 0, 1, 0, 1, 2011, 40, 41, 156, 157, 304, 305, 484, 485, 581, 580, 385, 384, 221, 220, 89, 88, 2023, 1, 0, 1, 0, 0, 0, 1, 0, 1, 2011, 40, 41, 156, 157, 304, 305, 484, 485, // 14
579, 578, 383, 382, 219, 218, 87, 86, 2022, 1, 0, 1, 1, 1, 1, 1, 0, 1, 2012, 42, 43, 158, 159, 306, 307, 486, 487, 579, 578, 383, 382, 219, 218, 87, 86, 2022, 1, 0, 1, 1, 1, 1, 1, 0, 1, 2012, 42, 43, 158, 159, 306, 307, 486, 487, // 15
577, 576, 381, 380, 217, 216, 85, 84, 2021, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2013, 44, 45, 160, 161, 308, 309, 488, 489, 577, 576, 381, 380, 217, 216, 85, 84, 2021, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2013, 44, 45, 160, 161, 308, 309, 488, 489, // 16
575, 574, 379, 378, 215, 214, 83, 82, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 46, 47, 162, 163, 310, 311, 490, 491, 575, 574, 379, 378, 215, 214, 83, 82, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 46, 47, 162, 163, 310, 311, 490, 491, // 17
573, 572, 377, 376, 213, 212, 81, 80, 0, 0, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 0, 0, 48, 49, 164, 165, 312, 313, 492, 493, 573, 572, 377, 376, 213, 212, 81, 80, 0, 0, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 0, 0, 48, 49, 164, 165, 312, 313, 492, 493, // 18
571, 570, 375, 374, 211, 210, 78, 76, 74, 72, 70, 68, 66, 64, 62, 60, 58, 56, 54, 50, 51, 166, 167, 314, 315, 494, 495, 571, 570, 375, 374, 211, 210, 78, 76, 74, 72, 70, 68, 66, 64, 62, 60, 58, 56, 54, 50, 51, 166, 167, 314, 315, 494, 495, // 19
569, 568, 373, 372, 209, 208, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59, 57, 55, 52, 53, 168, 169, 316, 317, 496, 497, 569, 568, 373, 372, 209, 208, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59, 57, 55, 52, 53, 168, 169, 316, 317, 496, 497, // 20
567, 566, 371, 370, 206, 204, 202, 200, 198, 196, 194, 192, 190, 188, 186, 184, 182, 180, 178, 176, 174, 170, 171, 318, 319, 498, 499, 567, 566, 371, 370, 206, 204, 202, 200, 198, 196, 194, 192, 190, 188, 186, 184, 182, 180, 178, 176, 174, 170, 171, 318, 319, 498, 499, // 21
565, 564, 369, 368, 207, 205, 203, 201, 199, 197, 195, 193, 191, 189, 187, 185, 183, 181, 179, 177, 175, 172, 173, 320, 321, 500, 501, 565, 564, 369, 368, 207, 205, 203, 201, 199, 197, 195, 193, 191, 189, 187, 185, 183, 181, 179, 177, 175, 172, 173, 320, 321, 500, 501, // 22
563, 562, 366, 364, 362, 360, 358, 356, 354, 352, 350, 348, 346, 344, 342, 340, 338, 336, 334, 332, 330, 328, 326, 322, 323, 502, 503, 563, 562, 366, 364, 362, 360, 358, 356, 354, 352, 350, 348, 346, 344, 342, 340, 338, 336, 334, 332, 330, 328, 326, 322, 323, 502, 503, // 23
561, 560, 367, 365, 363, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 337, 335, 333, 331, 329, 327, 324, 325, 504, 505, 561, 560, 367, 365, 363, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 337, 335, 333, 331, 329, 327, 324, 325, 504, 505, // 24
558, 556, 554, 552, 550, 548, 546, 544, 542, 540, 538, 536, 534, 532, 530, 528, 526, 524, 522, 520, 518, 516, 514, 512, 510, 506, 507, 558, 556, 554, 552, 550, 548, 546, 544, 542, 540, 538, 536, 534, 532, 530, 528, 526, 524, 522, 520, 518, 516, 514, 512, 510, 506, 507, // 25
559, 557, 555, 553, 551, 549, 547, 545, 543, 541, 539, 537, 535, 533, 531, 529, 527, 525, 523, 521, 519, 517, 515, 513, 511, 508, 509 559, 557, 555, 553, 551, 549, 547, 545, 543, 541, 539, 537, 535, 533, 531, 529, 527, 525, 523, 521, 519, 517, 515, 513, 511, 508, 509, // 26
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
}; };
/* Pre-calculated finder, descriptor, orientation mappings for full-range symbol */ /* Pre-calculated finder, descriptor, orientation mappings for full-range symbol */

View File

@ -42,6 +42,16 @@
#include "reedsol.h" #include "reedsol.h"
#include <assert.h> #include <assert.h>
#define LEVEL_L 1
#define LEVEL_M 2
#define LEVEL_Q 3
#define LEVEL_H 4
#define QR_PERCENT 38 /* Alphanumeric mode % */
#define RMQR_VERSION 41
#define MICROQR_VERSION 73
/* Returns true if input glyph is in the Alphanumeric set */ /* Returns true if input glyph is in the Alphanumeric set */
static int is_alpha(const unsigned int glyph, const int gs1) { static int is_alpha(const unsigned int glyph, const int gs1) {
int retval = 0; int retval = 0;
@ -497,7 +507,7 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
bp = bin_append_posn(byte, byte > 0xFF ? 16 : 8, binary, bp); bp = bin_append_posn(byte, byte > 0xFF ? 16 : 8, binary, bp);
if (debug_print) { if (debug_print) {
printf("0x%02X(%d) ", byte, byte); printf("0x%02X(%d) ", byte, (int) byte);
} }
} }

View File

@ -1,7 +1,7 @@
/* qr.h Data for QR Code, Micro QR Code and rMQR /* qr.h Data for QR Code, Micro QR Code and rMQR
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008 - 2020 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2006 Kentaro Fukuchi <fukuchi@megaui.net> Copyright (C) 2006 Kentaro Fukuchi <fukuchi@megaui.net>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -31,13 +31,6 @@
*/ */
/* vim: set ts=4 sw=4 et : */ /* vim: set ts=4 sw=4 et : */
#define LEVEL_L 1
#define LEVEL_M 2
#define LEVEL_Q 3
#define LEVEL_H 4
#define QR_PERCENT 38 /* Alphanumeric mode % */
/* From ISO/IEC 18004:2015 Table 5 Encoding/decoding table for Alphanumeric mode */ /* From ISO/IEC 18004:2015 Table 5 Encoding/decoding table for Alphanumeric mode */
static const char qr_alphanumeric[59] = { static const char qr_alphanumeric[59] = {
36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, /* SP-/ */ 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, /* SP-/ */
@ -46,9 +39,6 @@ static const char qr_alphanumeric[59] = {
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 /* P-Z */ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 /* P-Z */
}; };
#define RMQR_VERSION 100
#define MICROQR_VERSION 200
/* From ISO/IEC 18004:2015 Table 7 */ /* From ISO/IEC 18004:2015 Table 7 */
static const unsigned short int qr_data_codewords_L[] = { static const unsigned short int qr_data_codewords_L[] = {
19, 34, 55, 80, 108, 136, 156, 194, 232, 274, 324, 370, 428, 461, 523, 589, 647, 19, 34, 55, 80, 108, 136, 156, 194, 232, 274, 324, 370, 428, 461, 523, 589, 647,

View File

@ -120,7 +120,7 @@ static void test_big5_utf8(int index) {
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol symbol; struct zint_symbol symbol = {0};
unsigned int b5data[20]; unsigned int b5data[20];
testStart("test_big5_utf8"); testStart("test_big5_utf8");

View File

@ -134,7 +134,7 @@ static void test_hrt_cpy_iso8859_1(int index, int debug) {
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol symbol; struct zint_symbol symbol = {0};
testStart("test_hrt_cpy_iso8859_1"); testStart("test_hrt_cpy_iso8859_1");

View File

@ -54,7 +54,7 @@ static void test_utf8_to_unicode(int index, int debug) {
int i, length, ret; int i, length, ret;
unsigned int vals[20]; unsigned int vals[20];
struct zint_symbol symbol; struct zint_symbol symbol = {0};
testStart("test_utf8_to_unicode"); testStart("test_utf8_to_unicode");

View File

@ -103,12 +103,14 @@ static int gb18030_wctomb_zint2(unsigned int *r1, unsigned int *r2, unsigned int
return 4; return 4;
} }
// GB18030 (libiconv-1.16/lib/gb18030.h) // GB18030 (libiconv-1.16/lib/gb18030.h)
if (wc >= 0x10000 && wc < 0x10400) { // Code set 3 (Unicode U+10000..U+10FFFF) // Code set 3 (Unicode U+10000..U+10FFFF)
if (wc >= 0x10000 /*&& wc < 0x10400*/) { // Not being called for U+10400..U+10FFFF
c = wc - 0x10000; c = wc - 0x10000;
*r1 = 0x9030; *r1 = 0x9030;
*r2 = 0x8130 + (c % 10) + 0x100 * (c / 10); *r2 = 0x8130 + (c % 10) + 0x100 * (c / 10);
return 4; return 4;
} }
tab_length = ARRAY_SIZE(test_gb18030_tab); tab_length = ARRAY_SIZE(test_gb18030_tab);
start_i = test_gb18030_tab_ind[wc >> 10]; start_i = test_gb18030_tab_ind[wc >> 10];
end_i = start_i + 0x800 > tab_length ? tab_length : start_i + 0x800; end_i = start_i + 0x800 > tab_length ? tab_length : start_i + 0x800;
@ -142,10 +144,10 @@ static void test_gb18030_wctomb_zint(void) {
val1_1 = val1_2 = val2_1 = val2_2 = 0; val1_1 = val1_2 = val2_1 = val2_2 = 0;
ret = gb18030_wctomb_zint(&val1_1, &val1_2, i); ret = gb18030_wctomb_zint(&val1_1, &val1_2, i);
ret2 = gb18030_wctomb_zint2(&val2_1, &val2_2, i); ret2 = gb18030_wctomb_zint2(&val2_1, &val2_2, i);
assert_equal(ret, ret2, "i:%d 0x%04X ret %d != ret2 %d, val1_1 0x%04X, val2_1 0x%04X, val1_2 0x%04X, val2_2 0x%04X\n", i, i, ret, ret2, val1_1, val2_1, val1_2, val2_2); assert_equal(ret, ret2, "i:%d 0x%04X ret %d != ret2 %d, val1_1 0x%04X, val2_1 0x%04X, val1_2 0x%04X, val2_2 0x%04X\n", (int) i, i, ret, ret2, val1_1, val2_1, val1_2, val2_2);
if (ret2) { if (ret2) {
assert_equal(val1_1, val2_1, "i:%d 0x%04X val1_1 0x%04X != val2_1 0x%04X\n", i, i, val1_1, val2_1); assert_equal(val1_1, val2_1, "i:%d 0x%04X val1_1 0x%04X != val2_1 0x%04X\n", (int) i, i, val1_1, val2_1);
assert_equal(val1_2, val2_2, "i:%d 0x%04X val1_2 0x%04X != val2_2 0x%04X\n", i, i, val1_2, val2_2); assert_equal(val1_2, val2_2, "i:%d 0x%04X val1_2 0x%04X != val2_2 0x%04X\n", (int) i, i, val1_2, val2_2);
} }
} }
@ -185,7 +187,7 @@ static void test_gb18030_utf8(int index) {
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol symbol; struct zint_symbol symbol = {0};
unsigned int gbdata[30]; unsigned int gbdata[30];
testStart("test_gb18030_utf8"); testStart("test_gb18030_utf8");

View File

@ -2652,6 +2652,7 @@ static void test_rmqr_encode(int index, int generate, int debug) {
char *comment; char *comment;
char *expected; char *expected;
}; };
// Note very little available to compare these to (BWIPP gives very different results TODO: investigate) so should be considered "unproven"
struct item data[] = { struct item data[] = {
/* 0*/ { UNICODE_MODE, "0123456", 4, 11, 0, 11, 27, "Draft ISO 2018-6-8 Annex H I.2, currently no image to compare to", /* 0*/ { UNICODE_MODE, "0123456", 4, 11, 0, 11, 27, "Draft ISO 2018-6-8 Annex H I.2, currently no image to compare to",
"111111101010101010101010111" "111111101010101010101010111"
@ -2681,6 +2682,75 @@ static void test_rmqr_encode(int index, int generate, int debug) {
"101101101100110111000010001" "101101101100110111000010001"
"111010101010101010101011111" "111010101010101010101011111"
}, },
/* 2*/ { UNICODE_MODE, "123456789012", -1, 1, 0, 7, 43, "R7x34 M max numeric 12 digits",
"1111111010101010101011101010101010101010111"
"1000001001011011001110111100000000011000101"
"1011101010110010101111101001000111111111111"
"1011101001101000000100111011010101000010001"
"1011101000111001001111110010111101110010101"
"1000001011111101000110100110000000011010001"
"1111111010101010101011101010101010101011111"
},
/* 3*/ { UNICODE_MODE, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", 4, 32, 0, 17, 139, "R17x139 H max numeric 178 digits",
"1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111"
"1000001011001000110010100110111110011010111100010111001010001011000101011111010101101010110111011011111110010110100110010111101000100111001"
"1011101010000000000011101111110000111110100010101011001111101110111000000101100010111111010110100111111010000011100001110011001100010010001"
"1011101010010001001011011110110110001011110111000001111000011010111010001110100001001101110010000101111110100110111111101000000001000010000"
"1011101001001111000111101011001111001111010001011011011110111000111001000100111001110111001001011000101011111111111111001101010011111000111"
"1000001010001010101111010110110110101110111110111100010001000011101011101010001111001001100101001010001001011000111000011111101001010010010"
"1111111010000101010101110011100101000111101010101110100111101111100000110100110101110101010011100011001100010001100000100110111011111110011"
"0000000000011101001101111000100110010011011001110000111000111101011000111111101010000101001011110001000101101110100100100000010010111100100"
"1111010111011011000110010101111110011000010100000011011110010011100001111101000010010101001111111010000111101101111011011000010100010001101"
"0111101110101010001010101110000111000110011011010110100001111100111100101100100001000010101101100010101000010100001111011111101110110001010"
"1111111110011100100100000111000011110101110100011000110100011110000100111000110110111001101100001110111000100011001000110011101101000110011"
"0110110101110001110100000110101010100000011001011000000001001111111001010101001110000111101100000100011110100010110111100101000001001011010"
"1010010110011001000100010001000111111110101001001111001101010001000111010101001101011111111000111111001011001111110111101010010010111011111"
"0011110011110100101011001000001010100011101111100100001000011000111100011011110010001101000111101011100001010100101010001110111001111110001"
"1011101000011100110000101111100101100011010011000110011110101101000101011010001011111010000101000100110100010111110000110111101010111110101"
"1000101001111010100011010110111110101000110110000000101011110010110010010000110110101111110010110100110111101010110000100000011110010110001"
"1110101010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111"
},
/* 4*/ { UNICODE_MODE, "123456789012345678901234567890123456789012345678901234", 4, 33, 0, 7, 139, "R7xauto H max numeric 54 digits",
"1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111"
"1000001011011110100001110010100100001111000111011101011011001100000111111010011111101110111011101001010011101110111011000110000001001000001"
"1011101000010001001110011111100000100110110101101011101110101000100001001100001110111010100000110100100001111011101000110111011110101011111"
"1011101001111010110000111110101111100001011110010111010010111110100110011111111111101101010101000111101010011000110111101010001100000010001"
"1011101011110100001010000011101111100111101100000011011110100010111101101100100111111011101000110101101000000111101110111001010100101010101"
"1000001010001000001011100010101001100011000011000010011011011011011111110010010011101000011010011110010110111010101010010011111110010110001"
"1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111"
},
/* 5*/ { UNICODE_MODE, "123456789012345678901234567890123", 4, 35, 0, 11, 59, "R11xauto H with max numeric 33 digits for width 59",
"11111110101010101011101010101010101010111010101010101010111"
"10000010101010010010100111111011011110101001100110110011001"
"10111010000110110111101001001010100001111010000100000000011"
"10111010101111011100110000010110100101100001111110110110100"
"10111010001110111011111110110011010100011010101010010000101"
"10000010000110100110000001000110110100100000001100100110000"
"11111110111000101111111010001011010011111111101101101011111"
"00000000010001110000100101111101101110100011001010111010001"
"11010101101011100011100001110011000010111111110000010010101"
"10011110000011110010101110111110000100101110100001000110001"
"11101010101010101011101010101010101010111010101010101011111"
},
/* 6*/ { UNICODE_MODE, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", -1, 38, 0, 17, 139, "R17xauto M max numeric 361 digits",
"1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111"
"1000001001000101001111000010110100001000101100110001101010100000111110001000100011101011111000001110011001110010100111000101001100000001101"
"1011101011100100000111001011101001110010101001100000001111010010111111101001111110111000101000010010110101111111111101111101101000001011001"
"1011101001000111010101101000100010100110111111000010001010000111000001110010101101101100011111010001000111001110011101000011110011100111010"
"1011101000011011001010110111000101101000011001111111100110101100100010000110011000110010001110111101000010010001000111100010001111110010101"
"1000001000010011010111011100110011101001111000011100111001111010111111001101001001101010001000000100111100000100000000111100001000011110110"
"1111111011000011001100001011100101010100001110100100010101100010100001111000000110011101001100000011111010101111101010011101110001001101101"
"0000000010101010011100011110100011110101111000010000000010110101000000110111010110100101100101111001001000101010011001000010010111110000110"
"1111000101000101010110010101111001011001110001111100101110110101011111010111100011110000110011101111100001010011010011000010011110110010011"
"0111110010111110100111011100100110100111011110110111111000100100111111001000100001001010111010000110011001110110001110100011101010000101010"
"1000110110001000011011011001101111100101110100110000000101010010110110101100011100011111101000011010110100011101100100111101100100001010011"
"0010111001011000101010100000011101100011011000111100001000000111001000110110111111100101010111010001000111001000011101011100100101111011110"
"1000000110001011100000011101011000110101100001100011100110101100100000011011110100110101010110111101000010000011100110100011011011110111111"
"0010111110101011111010111110000101111100111101001010111001111010111111111001011100001111101000100100111100010010000010111111011011000110001"
"1101011001000100011101010111100001001010100010010110011111100011000101100010001111111011100101000011111110101111101000011110100000010110101"
"1001100101010101001010100010100011011100111001110111011010110101000100100111100110101011100101111011001010100110111111000010110110100110001"
"1110101010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111"
},
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@ -2705,7 +2775,7 @@ static void test_rmqr_encode(int index, int generate, int debug) {
i, testUtilInputModeName(data[i].input_mode), data[i].data, data[i].option_1, data[i].option_2, testUtilErrorName(data[i].ret), i, testUtilInputModeName(data[i].input_mode), data[i].data, data[i].option_1, data[i].option_2, testUtilErrorName(data[i].ret),
symbol->rows, symbol->width, data[i].comment); symbol->rows, symbol->width, data[i].comment);
testUtilModulesPrint(symbol, " ", "\n"); testUtilModulesPrint(symbol, " ", "\n");
printf(" },\n"); printf(" },\n");
} else { } else {
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);

View File

@ -143,7 +143,7 @@ static void test_sjis_utf8(int index) {
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol symbol; struct zint_symbol symbol = {0};
unsigned int jisdata[20]; unsigned int jisdata[20];
testStart("test_sjis_utf8"); testStart("test_sjis_utf8");

View File

@ -2796,7 +2796,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sgssep", strlen(bwipp_opts_buf) ? " " : ""); sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sgssep", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf; bwipp_opts = bwipp_opts_buf;
} }
if (option_2 >= 1 && option_2 <= (int) sizeof(intsymbol)) { if (option_2 >= 1 && option_2 <= ARRAY_SIZE(intsymbol)) {
int idx = intsymbol[option_2 - 1]; int idx = intsymbol[option_2 - 1];
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srows=%d columns=%d", sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srows=%d columns=%d",
strlen(bwipp_opts_buf) ? " " : "", matrixH[idx], matrixW[idx]); strlen(bwipp_opts_buf) ? " " : "", matrixH[idx], matrixW[idx]);

View File

@ -75,9 +75,10 @@ Reader Initialisation: Some symbologies allow a special character to be included
programming codes relevant to your scanner. programming codes relevant to your scanner.
ECI: The ECI mechanism allows for multi-language data to be encoded in ECI: The ECI mechanism allows for multi-language data to be encoded in
symbols which would usually support only Latin-1 characters. This can symbols which would usually support only Latin-1 (ISO/IEC 8859-1)
be useful, for example, if you need to encode Cyrillic characters, but characters. This can be useful, for example, if you need to encode
should be used with caution as not all scanners support this method. Cyrillic characters, but should be used with caution as not all scanners
support this method.
2. Installing Zint 2. Installing Zint
@ -2373,13 +2374,13 @@ ZINT_FULL_MULTIBYTE | (N + 1) << 8.
6.6.4 Rectangular Micro QR Code (rMQR) 6.6.4 Rectangular Micro QR Code (rMQR)
-------------------------------------- --------------------------------------
A rectangular version of QR Code. Like QR code rMQR supports encoding of GS1 A rectangular version of QR Code. Like QR Code, rMQR supports encoding of GS1
data, Latin-1 and Kanji characters in the Shift JIS encoding scheme. It does not data, and Latin-1 characters in the ISO/IEC 8859-1 set and Kanji characters in
support other ISO/IEC 8859 character sets or encodings. As with other the Shift JIS encoding scheme. It does not support other ISO/IEC 8859 character
symbologies data should be entered as UTF-8 with the conversion to Shift JIS sets or encodings. As with other symbologies data should be entered as UTF-8
being handled by Zint. The amount of ECC codewords can be adjusted using the with the conversion to Latin-1 or Shift JIS being handled by Zint. The amount of
--secure= option (API option_1), however only ECC levels M and H are valid for ECC codewords can be adjusted using the --secure= option (API option_1), however
this type of symbol. only ECC levels M and H are valid for this type of symbol.
------------------------------------------------------------------------- -------------------------------------------------------------------------
Input | ECC Level | Error Correction Capacity | Recovery Capacity Input | ECC Level | Error Correction Capacity | Recovery Capacity
@ -2392,9 +2393,9 @@ The preferred symbol sizes can be selected using the --vers= option (API
option_2) as shown in the table below. Input values between 33 and 38 fix the option_2) as shown in the table below. Input values between 33 and 38 fix the
height of the symbol while allowing Zint to determine the minimum symbol width. height of the symbol while allowing Zint to determine the minimum symbol width.
--------------------------------- ---------------------------------------
Input | Version | Symbol Size Input | Version | Symbol Size (HxW)
--------------------------------- ---------------------------------------
1 | R7x43 | 7 x 73 1 | R7x43 | 7 x 73
2 | R7x59 | 7 x 59 2 | R7x59 | 7 x 59
3 | R7x77 | 7 x 77 3 | R7x77 | 7 x 77
@ -2427,14 +2428,14 @@ Input | Version | Symbol Size
30 | R17x77 | 17 x 77 30 | R17x77 | 17 x 77
31 | R17x99 | 17 x 99 31 | R17x99 | 17 x 99
32 | R17x139 | 17 x 139 32 | R17x139 | 17 x 139
--------------------------------- ---------------------------------------
33 | Fixed height 7 33 | R7 x automatic width
34 | Fixed height 9 34 | R9 x automatic width
35 | Fixed height 11 35 | R11 x automatic width
36 | Fixed height 13 36 | R13 x automatic width
37 | Fixed height 15 37 | R15 x automatic width
38 | Fixed height 17 38 | R17 x automatic width
--------------------------------- ---------------------------------------
For barcode readers that support it, non-ASCII data density may be maximized by For barcode readers that support it, non-ASCII data density may be maximized by
using the --fullmultibyte switch or by setting option_3 to ZINT_FULL_MULTIBYTE. using the --fullmultibyte switch or by setting option_3 to ZINT_FULL_MULTIBYTE.

View File

@ -44,192 +44,192 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R7x43</string> <string>R7x43 (Zint 1)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R7x59</string> <string>R7x59 (Zint 2)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R7x77</string> <string>R7x77 (Zint 3)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R7x99</string> <string>R7x99 (Zint 4)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R7x139</string> <string>R7x139 (Zint 5)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R9x43</string> <string>R9x43 (Zint 6)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R9x59</string> <string>R9x59 (Zint 7)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R9x77</string> <string>R9x77 (Zint 8)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R9x99</string> <string>R9x99 (Zint 9)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R9x139</string> <string>R9x139 (Zint 10)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R11x27</string> <string>R11x27 (Zint 11)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R11x43</string> <string>R11x43 (Zint 12)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R11x59</string> <string>R11x59 (Zint 13)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R11x77</string> <string>R11x77 (Zint 14)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R11x99</string> <string>R11x99 (Zint 15)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R11x139</string> <string>R11x139 (Zint 16)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R13x27</string> <string>R13x27 (Zint 17)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R13x43</string> <string>R13x43 (Zint 18)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R13x59</string> <string>R13x59 (Zint 19)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R13x77</string> <string>R13x77 (Zint 20)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R13x99</string> <string>R13x99 (Zint 21)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R13x139</string> <string>R13x139 (Zint 22)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R15x43</string> <string>R15x43 (Zint 23)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R15x59</string> <string>R15x59 (Zint 24)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R15x77</string> <string>R15x77 (Zint 25)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R15x99</string> <string>R15x99 (Zint 26)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R15x139</string> <string>R15x139 (Zint 27)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R17x43</string> <string>R17x43 (Zint 28)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R17x59</string> <string>R17x59 (Zint 29)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R17x77</string> <string>R17x77 (Zint 30)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R17x99</string> <string>R17x99 (Zint 31)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R17x139</string> <string>R17x139 (Zint 32)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R7x Automatic Width</string> <string>R7 x Automatic Width (Zint 33)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R9x Automatic Width</string> <string>R9 x Automatic Width (Zint 34)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R11x Automatic Width</string> <string>R11 x Automatic Width (Zint 35)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R13x Automatic Width</string> <string>R13 x Automatic Width (Zint 36)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R15 x Automatic Width</string> <string>R15 x Automatic Width (Zint 37)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>R17 x Automatic Width</string> <string>R17 x Automatic Width (Zint 38)</string>
</property> </property>
</item> </item>
</widget> </widget>