GUI: fix foreground/background picker invocations (broken

[f3a982c1dd])
AZTEC/CODE16K/CODEONE/DATAMATRIX/DBAR_EXP/GRIDMATRIX/HANXIN
/MAILMARK_4S/PDF417/MSI_PLESSEY/QRCODE/RMQR/TIF/ULTRA/USPS_IMAIL:
  lessen storage of some tables by using least integral size
  required (saves ~3K); reformat some tables, comments
AUSPOST/AZTEC: remove unnecessary int casts on array indexing
CODE11/CODE39: move start/stop chars into one entry in tables to
  save a few bytes; some reformatting, comments
CODEONE: add `c1_` prefixes
common: more precise compiler/version checks
composite: add `cc_` prefixes; UINT -> unsigned short; use
  `sizeof()` instead of `strlen()` for `in_linear_comp` static;
  some reformatting, comments
EMF: use table instead of string for `ultra_chars[]`
GIF: remove unnecessary cast
library: use `sizeof()` instead of `strlen()` for static;
  add `consts` to `escape_char_process()` & use unsigned for `ch`
DBAR: use `dbar_`, `dbar_ltd_`, `dbar_exp_` prefixes
docs: update pandoc version
This commit is contained in:
gitlost 2024-05-27 23:19:45 +01:00
parent 0a00d04ccc
commit eb035a6372
43 changed files with 722 additions and 641 deletions

View file

@ -1,7 +1,7 @@
/* auspost.c - Handles Australia Post 4-State Barcode */
/*
libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -91,7 +91,7 @@ static char *aus_rs_error(char data_pattern[], char *d) {
rs_encode(&rs, triple_writer, triple, result);
for (reader = 4; reader > 0; reader--, d += 3) {
memcpy(d, AusBarTable[(int) result[reader - 1]], 3);
memcpy(d, AusBarTable[result[reader - 1]], 3);
}
return d;

View file

@ -1,7 +1,7 @@
/* aztec.c - Handles Aztec 2D Symbols */
/*
libzint - the open source barcode library
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -41,6 +41,7 @@
#define AZTEC_MAP_SIZE 22801 /* AztecMap Version 32 151 x 151 */
#define AZTEC_MAP_POSN_MAX 20039 /* Maximum position index in AztecMap */
/* Count number of consecutive (. SP) or (, SP) Punct mode doubles for comparison against Digit mode encoding */
static int az_count_doubles(const unsigned char source[], int i, const int length) {
int c = 0;
@ -52,6 +53,7 @@ static int az_count_doubles(const unsigned char source[], int i, const int lengt
return c;
}
/* Count number of consecutive full stops or commas (can be encoded in Punct or Digit mode) */
static int az_count_dotcomma(const unsigned char source[], int i, const int length) {
int c = 0;
@ -63,6 +65,7 @@ static int az_count_dotcomma(const unsigned char source[], int i, const int leng
return c;
}
/* Count number of consecutive `chr`s */
static int az_count_chr(const unsigned char source[], int i, const int length, const unsigned char chr) {
int c = 0;
@ -74,6 +77,7 @@ static int az_count_chr(const unsigned char source[], int i, const int length, c
return c;
}
/* Return mode following current, or 'E' if none */
static char az_get_next_mode(const char encode_mode[], const int src_len, int i) {
int current_mode = encode_mode[i];
@ -87,6 +91,7 @@ static char az_get_next_mode(const char encode_mode[], const int src_len, int i)
}
}
/* Same as `bin_append_posn()`, except check for buffer overflow first */
static int az_bin_append_posn(const int arg, const int length, char *binary, const int bin_posn) {
if (bin_posn + length > AZTEC_BIN_CAPACITY) {
@ -95,6 +100,7 @@ static int az_bin_append_posn(const int arg, const int length, char *binary, con
return bin_append_posn(arg, length, binary, bin_posn);
}
/* Determine encoding modes and encode */
static int aztec_text_process(const unsigned char source[], int src_len, int bp, char binary_string[], const int gs1,
const int eci, char *p_current_mode, int *data_length, const int debug_print) {
@ -112,7 +118,7 @@ static int aztec_text_process(const unsigned char source[], int src_len, int bp,
if (source[i] >= 128) {
encode_mode[i] = 'B';
} else {
encode_mode[i] = AztecModes[(int) source[i]];
encode_mode[i] = AztecModes[source[i]];
}
}
@ -618,15 +624,13 @@ static int aztec_text_process(const unsigned char source[], int src_len, int bp,
if (reduced_source[i] == ' ') {
if (!(bp = az_bin_append_posn(1, 5, binary_string, bp))) return 0; /* SP */
} else {
if (!(bp = az_bin_append_posn(AztecSymbolChar[(int) reduced_source[i]], 5, binary_string, bp)))
return 0;
if (!(bp = az_bin_append_posn(AztecSymbolChar[reduced_source[i]], 5, binary_string, bp))) return 0;
}
} else if (reduced_encode_mode[i] == 'L') {
if (reduced_source[i] == ' ') {
if (!(bp = az_bin_append_posn(1, 5, binary_string, bp))) return 0; /* SP */
} else {
if (!(bp = az_bin_append_posn(AztecSymbolChar[(int) reduced_source[i]], 5, binary_string, bp)))
return 0;
if (!(bp = az_bin_append_posn(AztecSymbolChar[reduced_source[i]], 5, binary_string, bp))) return 0;
}
} else if (reduced_encode_mode[i] == 'M') {
if (reduced_source[i] == ' ') {
@ -634,8 +638,7 @@ static int aztec_text_process(const unsigned char source[], int src_len, int bp,
} else if (reduced_source[i] == 13) {
if (!(bp = az_bin_append_posn(14, 5, binary_string, bp))) return 0; /* CR */
} else {
if (!(bp = az_bin_append_posn(AztecSymbolChar[(int) reduced_source[i]], 5, binary_string, bp)))
return 0;
if (!(bp = az_bin_append_posn(AztecSymbolChar[reduced_source[i]], 5, binary_string, bp))) return 0;
}
} else if ((reduced_encode_mode[i] == 'P') || (reduced_encode_mode[i] == 'p')) {
if (gs1 && (reduced_source[i] == '[')) {
@ -656,8 +659,7 @@ static int aztec_text_process(const unsigned char source[], int src_len, int bp,
} else if (reduced_source[i] == '.') {
if (!(bp = az_bin_append_posn(19, 5, binary_string, bp))) return 0; /* Full stop */
} else {
if (!(bp = az_bin_append_posn(AztecSymbolChar[(int) reduced_source[i]], 5, binary_string, bp)))
return 0;
if (!(bp = az_bin_append_posn(AztecSymbolChar[reduced_source[i]], 5, binary_string, bp))) return 0;
}
} else if (reduced_encode_mode[i] == 'D') {
if (reduced_source[i] == ' ') {
@ -667,8 +669,7 @@ static int aztec_text_process(const unsigned char source[], int src_len, int bp,
} else if (reduced_source[i] == '.') {
if (!(bp = az_bin_append_posn(13, 4, binary_string, bp))) return 0; /* Full stop */
} else {
if (!(bp = az_bin_append_posn(AztecSymbolChar[(int) reduced_source[i]], 4, binary_string, bp)))
return 0;
if (!(bp = az_bin_append_posn(AztecSymbolChar[reduced_source[i]], 4, binary_string, bp))) return 0;
}
}
}

View file

@ -33,8 +33,8 @@
#ifndef Z_AZTEC_H
#define Z_AZTEC_H
static const short AztecCompactMap[] = {
/* 27 x 27 data grid */
/* 27 x 27 data grid */
static const short AztecCompactMap[729] = {
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, /* 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, /* 2 */
@ -84,56 +84,61 @@ static const short AztecMapCore[15][15] = {
{ 0, 0, 20029, 20028, 20027, 20026, 20025, 0, 20024, 20023, 20022, 20021, 20020, 0, 0, },
};
/* From Table 2 */
static const char AztecSymbolChar[128] = {
/* From Table 2 */
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 1, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 0, 18, 0, 20, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 22,
23, 24, 25, 26, 20, 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, 27, 27, 21, 28, 22, 23, 24, 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, 27, 29, 25, 30, 26, 27
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19,
1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 18, 0, 20,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 22, 23, 24, 25, 26,
20, 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, 27, 27, 21, 28, 22, 23,
24, 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, 27, 29, 25, 30, 26, 27
};
static const char AztecModes[129] = "BMMMMMMMMMMMMXBBBBBBBBBBBBBMMMMMXPPPPPPPPPPPXPXPDDDDDDDDDDPPPPPP"
"MUUUUUUUUUUUUUUUUUUUUUUUUUUPMPMMMLLLLLLLLLLLLLLLLLLLLLLLLLLPMPMM";
static const char AztecModes[128] = {
'B', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'X', 'B', 'B',
'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'M', 'M', 'M', 'M', 'M',
'X', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'X', 'P', 'X', 'P',
'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'P', 'P', 'P', 'P', 'P', 'P',
'M', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U',
'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'P', 'M', 'P', 'M', 'M',
'M', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L',
'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'P', 'M', 'P', 'M', 'M'
};
/* Codewords per symbol */
static const short AztecSizes[32] = {
/* Codewords per symbol */
21, 48, 60, 88, 120, 156, 196, 240, 230, 272, 316, 364, 416, 470, 528, 588, 652, 720, 790,
864, 940, 1020, 920, 992, 1066, 1144, 1224, 1306, 1392, 1480, 1570, 1664
21, 48, 60, 88, 120, 156, 196, 240, 230, 272, 316, 364, 416, 470, 528, 588,
652, 720, 790, 864, 940, 1020, 920, 992, 1066, 1144, 1224, 1306, 1392, 1480, 1570, 1664
};
static const short AztecCompactSizes[4] = {
17, 40, 51, 64 /* 64 data blocks (Mode Message max) but 76 altogether */
};
/* Data bits per symbol maximum with 10% error correction */
static const short Aztec10DataSizes[32] = {
/* Data bits per symbol maximum with 10% error correction */
96, 246, 408, 616, 840, 1104, 1392, 1704, 2040, 2420, 2820, 3250, 3720, 4200, 4730,
5270, 5840, 6450, 7080, 7750, 8430, 9150, 9900, 10680, 11484, 12324, 13188, 14076,
15000, 15948, 16920, 17940
96, 246, 408, 616, 840, 1104, 1392, 1704, 2040, 2420, 2820, 3250, 3720, 4200, 4730, 5270,
5840, 6450, 7080, 7750, 8430, 9150, 9900, 10680, 11484, 12324, 13188, 14076, 15000, 15948, 16920, 17940
};
/* Data bits per symbol maximum with 23% error correction */
static const short Aztec23DataSizes[32] = {
/* Data bits per symbol maximum with 23% error correction */
84, 204, 352, 520, 720, 944, 1184, 1456, 1750, 2070, 2410, 2780, 3180, 3590, 4040,
4500, 5000, 5520, 6060, 6630, 7210, 7830, 8472, 9132, 9816, 10536, 11280, 12036,
12828, 13644, 14472, 15348
84, 204, 352, 520, 720, 944, 1184, 1456, 1750, 2070, 2410, 2780, 3180, 3590, 4040, 4500,
5000, 5520, 6060, 6630, 7210, 7830, 8472, 9132, 9816, 10536, 11280, 12036, 12828, 13644, 14472, 15348
};
/* Data bits per symbol maximum with 36% error correction */
static const short Aztec36DataSizes[32] = {
/* Data bits per symbol maximum with 36% error correction */
66, 168, 288, 432, 592, 776, 984, 1208, 1450, 1720, 2000, 2300, 2640, 2980, 3350,
3740, 4150, 4580, 5030, 5500, 5990, 6500, 7032, 7584, 8160, 8760, 9372, 9996, 10656,
11340, 12024, 12744
66, 168, 288, 432, 592, 776, 984, 1208, 1450, 1720, 2000, 2300, 2640, 2980, 3350, 3740,
4150, 4580, 5030, 5500, 5990, 6500, 7032, 7584, 8160, 8760, 9372, 9996, 10656, 11340, 12024, 12744
};
/* Data bits per symbol maximum with 50% error correction */
static const short Aztec50DataSizes[32] = {
/* Data bits per symbol maximum with 50% error correction */
48, 126, 216, 328, 456, 600, 760, 936, 1120, 1330, 1550, 1790, 2050, 2320, 2610,
2910, 3230, 3570, 3920, 4290, 4670, 5070, 5484, 5916, 6360, 6828, 7308, 7800, 8316,
8844, 9384, 9948
48, 126, 216, 328, 456, 600, 760, 936, 1120, 1330, 1550, 1790, 2050, 2320, 2610, 2910,
3230, 3570, 3920, 4290, 4670, 5070, 5484, 5916, 6360, 6828, 7308, 7800, 8316, 8844, 9384, 9948
};
static const short AztecCompact10DataSizes[4] = {
@ -152,16 +157,17 @@ static const short AztecCompact50DataSizes[4] = {
36, 102, 176, 280
};
/* Reference grid offsets */
static const char AztecOffset[32] = {
66, 64, 62, 60, 57, 55, 53, 51, 49, 47, 45, 42, 40, 38, 36, 34, 32, 30, 28, 25, 23, 21,
19, 17, 15, 13, 10, 8, 6, 4, 2, 0
66, 64, 62, 60, 57, 55, 53, 51, 49, 47, 45, 42, 40, 38, 36, 34,
32, 30, 28, 25, 23, 21, 19, 17, 15, 13, 10, 8, 6, 4, 2, 0
};
static const char AztecCompactOffset[4] = {
6, 4, 2, 0
};
static const short AztecMapGridYOffsets[] = {
static const unsigned char AztecMapGridYOffsets[8] = {
27, 43, 59, 75, 91, 107, 123, 139
};

View file

@ -43,18 +43,15 @@ static const char SILVER[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd";
#define ARSENIC_F (IS_NUM_F | IS_ARS_F) /* ARSENIC "0123456789ABCDEFGHJKLMNPRSTUVWXYZ" */
static const char C11Table[11][6] = {
static const char C11Table[11 + 1][6] = {
{'1','1','1','1','2','1'}, {'2','1','1','1','2','1'}, {'1','2','1','1','2','1'}, {'2','2','1','1','1','1'},
{'1','1','2','1','2','1'}, {'2','1','2','1','1','1'}, {'1','2','2','1','1','1'}, {'1','1','1','2','2','1'},
{'2','1','1','2','1','1'}, {'2','1','1','1','1','1'}, {'1','1','2','1','1','1'}
{'2','1','1','2','1','1'}, {'2','1','1','1','1','1'}, {'1','1','2','1','1','1'},
{'1','1','2','2','1','1'} /* Start character (full 6), Stop character (first 5) */
};
/* Code 39 tables checked against ISO/IEC 16388:2007 */
/* Incorporates Table A1 */
static const char C39Table[43][10] = {
/* Code 39 character assignments (Table 1) */
/* Code 39 character assignments (ISO/IEC 16388:2007 Table 1 and Table A.1) */
static const char C39Table[43 + 1][10] = {
{'1','1','1','2','2','1','2','1','1','1'}, {'2','1','1','2','1','1','1','1','2','1'},
{'1','1','2','2','1','1','1','1','2','1'}, {'2','1','2','2','1','1','1','1','1','1'},
{'1','1','1','2','2','1','1','1','2','1'}, {'2','1','1','2','2','1','1','1','1','1'},
@ -76,11 +73,12 @@ static const char C39Table[43][10] = {
{'1','2','1','1','1','1','2','1','2','1'}, {'2','2','1','1','1','1','2','1','1','1'},
{'1','2','2','1','1','1','2','1','1','1'}, {'1','2','1','2','1','2','1','1','1','1'},
{'1','2','1','2','1','1','1','2','1','1'}, {'1','2','1','1','1','2','1','2','1','1'},
{'1','1','1','2','1','2','1','2','1','1'}
{'1','1','1','2','1','2','1','2','1','1'},
{'1','2','1','1','2','1','2','1','1','1'} /* Start character (full 10), Stop character (first 9) */
};
/* Encoding the full ASCII character set in Code 39 (ISO/IEC 16388:2007 Table A.2) */
static const char EC39Ctrl[128][2] = {
/* Encoding the full ASCII character set in Code 39 (Table A2) */
{'%','U'}, {'$','A'}, {'$','B'}, {'$','C'}, {'$','D'}, {'$','E'}, {'$','F'}, {'$','G'}, {'$','H'}, {'$','I'},
{'$','J'}, {'$','K'}, {'$','L'}, {'$','M'}, {'$','N'}, {'$','O'}, {'$','P'}, {'$','Q'}, {'$','R'}, {'$','S'},
{'$','T'}, {'$','U'}, {'$','V'}, {'$','W'}, {'$','X'}, {'$','Y'}, {'$','Z'}, {'%','A'}, {'%','B'}, {'%','C'},
@ -96,6 +94,7 @@ static const char EC39Ctrl[128][2] = {
{'+','X'}, {'+','Y'}, {'+','Z'}, {'%','P'}, {'%','Q'}, {'%','R'}, {'%','S'}, {'%','T'}
};
/* Code 93 ANSI/AIM BC5-1995 Table 3 */
static const char C93Ctrl[128][2] = {
{'b','U'}, {'a','A'}, {'a','B'}, {'a','C'}, {'a','D'}, {'a','E'}, {'a','F'}, {'a','G'}, {'a','H'}, {'a','I'},
{'a','J'}, {'a','K'}, {'a','L'}, {'a','M'}, {'a','N'}, {'a','O'}, {'a','P'}, {'a','Q'}, {'a','R'}, {'a','S'},
@ -112,6 +111,7 @@ static const char C93Ctrl[128][2] = {
{'d','X'}, {'d','Y'}, {'d','Z'}, {'b','P'}, {'b','Q'}, {'b','R'}, {'b','S'}, {'b','T'}
};
/* Code 93 ANSI/AIM BC5-1995 Table 2 */
static const char C93Table[47][6] = {
{'1','3','1','1','1','2'}, {'1','1','1','2','1','3'}, {'1','1','1','3','1','2'}, {'1','1','1','4','1','1'},
{'1','2','1','1','1','3'}, {'1','2','1','2','1','2'}, {'1','2','1','3','1','1'}, {'1','1','1','1','1','4'},
@ -127,8 +127,8 @@ static const char C93Table[47][6] = {
{'3','1','2','1','1','1'}, {'3','1','1','1','2','1'}, {'1','2','2','2','1','1'}
};
/* *********************** CODE 11 ******************** */
INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int length) { /* Code 11 */
/* Code 11 */
INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int length) {
int i;
int h, c_digit, c_weight, c_count, k_digit, k_weight, k_count;
@ -170,7 +170,7 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
k_count = 0;
/* start character */
memcpy(d, "112211", 6);
memcpy(d, C11Table[11], 6);
d += 6;
/* Draw main body of barcode */
@ -223,7 +223,7 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
}
/* Stop character */
memcpy(d, "11221", 5);
memcpy(d, C11Table[11], 5);
d += 5;
expand(symbol, dest, d - dest);
@ -274,7 +274,7 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
}
/* Start character */
memcpy(d, "1211212111", 10);
memcpy(d, C39Table[43], 10);
d += 10;
for (i = 0; i < length; i++, d += 10) {
@ -303,7 +303,7 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
}
/* Stop character */
memcpy(d, "121121211", 9);
memcpy(d, C39Table[43], 9);
d += 9;
if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->symbology == BARCODE_HIBC_39)) {
@ -844,7 +844,7 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length)
char output_check;
int sum;
int i;
static const int weight[17] = {8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2};
static const char weight[17] = { 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 };
/* Check length */
if (length != 17) {
@ -900,7 +900,7 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length)
}
/* Start character */
memcpy(d, "1211212111", 10);
memcpy(d, C39Table[43], 10);
d += 10;
/* Import character 'I' prefix? */
@ -915,7 +915,7 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length)
}
/* Stop character */
memcpy(d, "121121211", 9);
memcpy(d, C39Table[43], 9);
d += 9;
expand(symbol, dest, d - dest);

View file

@ -1,7 +1,7 @@
/* code1.c - USS Code One */
/*
libzint - the open source barcode library
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -461,7 +461,7 @@ static int c1_c40text_cnt(const int current_mode, const int gs1, unsigned char i
cnt += 2;
input -= 128;
}
if ((current_mode == C1_C40 && c40_shift[input]) || (current_mode == C1_TEXT && text_shift[input])) {
if ((current_mode == C1_C40 && c1_c40_shift[input]) || (current_mode == C1_TEXT && c1_text_shift[input])) {
cnt += 1;
}
@ -689,11 +689,11 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
const char *ct_shift, *ct_value;
if (current_mode == C1_C40) {
ct_shift = c40_shift;
ct_value = c40_value;
ct_shift = c1_c40_shift;
ct_value = c1_c40_value;
} else {
ct_shift = text_shift;
ct_value = text_value;
ct_shift = c1_text_shift;
ct_value = c1_text_value;
}
if (debug_print) fputs(current_mode == C1_C40 ? "C40 " : "TEXT ", stdout);

View file

@ -1,7 +1,7 @@
/* code1.h - Lookup info for USS Code One */
/*
libzint - the open source barcode library
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -33,67 +33,96 @@
#ifndef Z_CODE1_H
#define Z_CODE1_H
static const char c40_shift[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
/* C40 shift to use per ASCII character (Table 11) */
static const char c1_c40_shift[128] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
};
static const char c40_value[] = {
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, 27, 28, 29, 30, 31,
3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
15, 16, 17, 18, 19, 20, 21, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
22, 23, 24, 25, 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, 27, 28, 29, 30, 31
/* C40 ASCII values (Table 11) */
static const char c1_c40_value[128] = {
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, 27, 28, 29, 30, 31,
3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20,
21, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 22, 23, 24, 25, 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, 27, 28, 29, 30, 31
};
static const char text_shift[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3
/* Text shift to use per ASCII character (Table 11) */
static const char c1_text_shift[128] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2,
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3
};
static const char text_value[] = {
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, 27, 28, 29, 30, 31,
3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
15, 16, 17, 18, 19, 20, 21, 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,
22, 23, 24, 25, 26, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 27, 28, 29, 30, 31
/* Text ASCII values (Table 11) */
static const char c1_text_value[128] = {
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, 27, 28, 29, 30, 31,
3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20,
21, 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, 22, 23, 24, 25, 26,
0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 27, 28, 29, 30, 31
};
static const unsigned short c1_height[] = {
/* Height in X-dims per version A-H (Table 2) */
static const unsigned char c1_height[8] = {
16, 22, 28, 40, 52, 70, 104, 148
};
static const unsigned short c1_width[] = {
/* Width in X-dims per version A-H (Table 2) */
static const unsigned char c1_width[8] = {
18, 22, 32, 42, 54, 76, 98, 134
};
static const unsigned short c1_data_length[] = {
/* Data codewords per version A-H (Table 14) */
static const unsigned short c1_data_length[8] = {
10, 19, 44, 91, 182, 370, 732, 1480
};
static const unsigned short c1_ecc_length[] = {
/* EC codewords per version A-H (Table 14) */
static const unsigned short c1_ecc_length[8] = {
10, 16, 26, 44, 70, 140, 280, 560
};
static const unsigned short c1_blocks[] = {
/* Number of codewords to divide into odd/even blocks for EC per version A-H */
static const unsigned char c1_blocks[8] = {
1, 1, 1, 1, 1, 2, 4, 8
};
static const unsigned short c1_data_blocks[] = {
/* Data blocks per version A-H (Table 14) */
static const unsigned char c1_data_blocks[8] = {
10, 19, 44, 91, 182, 185, 183, 185
};
static const unsigned short c1_ecc_blocks[] = {
/* EC blocks per version A-H (Table 14) */
static const unsigned char c1_ecc_blocks[8] = {
10, 16, 26, 44, 70, 70, 70, 70
};
static const unsigned short c1_grid_width[] = {
/* Number of block columns per version A-H */
static const unsigned char c1_grid_width[8] = {
4, 5, 7, 9, 12, 17, 22, 30
};
static const unsigned short c1_grid_height[] = {
/* Number of block rows per version A-H */
static const unsigned char c1_grid_height[8] = {
5, 7, 10, 15, 21, 30, 46, 68
};

View file

@ -1,7 +1,7 @@
/* code16k.c - Handles Code 16k stacked symbology */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -41,18 +41,18 @@
/* Note using C128Table with extra entry at 106 (Triple Shift) for C16KTable */
/* EN 12323 Table 3 and Table 4 - Start patterns and stop patterns */
static const char C16KStartStop[8][4] = {
/* EN 12323 Table 3 and Table 4 - Start patterns and stop patterns */
{'3','2','1','1'}, {'2','2','2','1'}, {'2','1','2','2'}, {'1','4','1','1'},
{'1','1','3','2'}, {'1','2','3','1'}, {'1','1','1','4'}, {'3','1','1','2'}
};
/* EN 12323 Table 5 - Start and stop values defining row numbers */
static const int C16KStartValues[16] = {
static const unsigned char C16KStartValues[16] = {
0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7
};
static const int C16KStopValues[16] = {
static const unsigned char C16KStopValues[16] = {
0, 1, 2, 3, 4, 5, 6, 7, 4, 5, 6, 7, 0, 1, 2, 3
};

View file

@ -551,10 +551,9 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height,
}
/* Prevent inlining of `stripf()` which can optimize away its effect */
#if defined(__GNUC__) || defined(__clang__)
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
__attribute__((__noinline__))
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1310 /* MSVC 2003 (VC++ 7.1) */
#elif defined(_MSC_VER) && _MSC_VER >= 1310 /* MSVC 2003 (VC++ 7.1) */
__declspec(noinline)
#endif
/* Removes excess precision from floats - see https://stackoverflow.com/q/503436 */

View file

@ -123,7 +123,7 @@ typedef unsigned __int64 uint64_t;
#define ustrcat(target, source) strcat((char *) (target), (const char *) (source))
#define ustrncat(target, source, count) strncat((char *) (target), (const char *) (source), (count))
#if (defined(_MSC_VER) && _MSC_VER == 1200) || defined(ZINT_IS_C89) /* VC6 or C89 */
#if (defined(_MSC_VER) && _MSC_VER <= 1200) || defined(ZINT_IS_C89) /* VC6 or C89 */
# define ceilf (float) ceil
# define floorf (float) floor
# define fmodf (float) fmod
@ -136,7 +136,7 @@ typedef unsigned __int64 uint64_t;
#ifdef _MSC_VER
# pragma warning(disable: 4244) /* conversion from int to float */
# if _MSC_VER != 1200 /* VC6 */
# if _MSC_VER > 1200 /* VC6 */
# pragma warning(disable: 4996) /* function or variable may be unsafe */
# endif
#endif
@ -144,17 +144,17 @@ typedef unsigned __int64 uint64_t;
/* Is float integral value? (https://stackoverflow.com/a/40404149) */
#define isfintf(arg) (fmodf(arg, 1.0f) == 0.0f)
#if (defined(__GNUC__) || defined(__clang__)) && !defined(ZINT_TEST) && !defined(__MINGW32__)
# define INTERNAL __attribute__ ((visibility ("hidden")))
#if defined(__GNUC__) && __GNUC__ >= 4 && !defined(ZINT_TEST) && !defined(__MINGW32__)
# define INTERNAL __attribute__((__visibility__("hidden")))
#elif defined(ZINT_TEST)
# define INTERNAL ZINT_EXTERN /* The test suite references INTERNAL functions, so they need to be exported */
#else
# define INTERNAL
#endif
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MINGW32__)
# define INTERNAL_DATA_EXTERN __attribute__ ((visibility ("hidden"))) extern
# define INTERNAL_DATA __attribute__ ((visibility ("hidden")))
#if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
# define INTERNAL_DATA_EXTERN __attribute__((__visibility__("hidden"))) extern
# define INTERNAL_DATA __attribute__((__visibility__("hidden")))
#else
# define INTERNAL_DATA_EXTERN extern
# define INTERNAL_DATA

View file

@ -56,7 +56,6 @@
#include "gs1.h"
#include "general_field.h"
#define UINT unsigned short
#include "composite.h"
INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_mode,
@ -73,7 +72,7 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int
INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows);
INTERNAL int dbar_date(const unsigned char source[], const int length, const int src_posn);
static int _min(const int first, const int second) {
static int cc_min(const int first, const int second) {
if (first <= second)
return first;
@ -82,23 +81,23 @@ static int _min(const int first, const int second) {
}
/* gets bit in bitString at bitPos */
static int getBit(const UINT *bitStr, const int bitPos) {
static int cc_getBit(const unsigned short *bitStr, const int bitPos) {
return !!(bitStr[bitPos >> 4] & (0x8000 >> (bitPos & 15)));
}
/* converts bit string to base 928 values, codeWords[0] is highest order */
static int encode928(const UINT bitString[], UINT codeWords[], const int bitLng) {
static int cc_encode928(const unsigned short bitString[], unsigned short codeWords[], const int bitLng) {
int i, j, b, cwNdx, cwLng;
for (cwNdx = cwLng = b = 0; b < bitLng; b += 69, cwNdx += 7) {
const int bitCnt = _min(bitLng - b, 69);
const int bitCnt = cc_min(bitLng - b, 69);
int cwCnt;
cwLng += cwCnt = bitCnt / 10 + 1;
for (i = 0; i < cwCnt; i++)
codeWords[cwNdx + i] = 0; /* init 0 */
for (i = 0; i < bitCnt; i++) {
if (getBit(bitString, b + bitCnt - i - 1)) {
if (cc_getBit(bitString, b + bitCnt - i - 1)) {
for (j = 0; j < cwCnt; j++)
codeWords[cwNdx + j] += pwr928[i][j + 7 - cwCnt];
codeWords[cwNdx + j] += cc_pwr928[i][j + 7 - cwCnt];
}
}
for (i = cwCnt - 1; i > 0; i--) {
@ -117,8 +116,8 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w
int LeftRAPStart, RightRAPStart, CentreRAPStart, StartCluster;
int LeftRAP, RightRAP, CentreRAP, Cluster;
int loop;
UINT codeWords[28] = {0};
UINT bitStr[13] = {0};
unsigned short codeWords[28] = {0};
unsigned short bitStr[13] = {0};
char pattern[580];
int bp = 0;
const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
@ -140,7 +139,7 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w
}
/* encode codeWords from bitStr */
cwCnt = encode928(bitStr, codeWords, bitlen);
cwCnt = cc_encode928(bitStr, codeWords, bitlen);
switch (cc_width) {
case 2:
@ -191,9 +190,9 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w
break;
}
rows = ccaVariants[variant];
k = ccaVariants[17 + variant];
offset = ccaVariants[34 + variant];
rows = cc_aVariants[variant];
k = cc_aVariants[17 + variant];
offset = cc_aVariants[34 + variant];
/* Reed-Solomon error correction */
@ -201,9 +200,9 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w
total = (codeWords[i] + rsCodeWords[k - 1]) % 929;
for (j = k - 1; j >= 0; j--) {
if (j == 0) {
rsCodeWords[j] = (929 - (total * ccaCoeffs[offset + j]) % 929) % 929;
rsCodeWords[j] = (929 - (total * cc_aCoeffs[offset + j]) % 929) % 929;
} else {
rsCodeWords[j] = (rsCodeWords[j - 1] + 929 - (total * ccaCoeffs[offset + j]) % 929) % 929;
rsCodeWords[j] = (rsCodeWords[j - 1] + 929 - (total * cc_aCoeffs[offset + j]) % 929) % 929;
}
}
}
@ -220,10 +219,10 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w
}
/* Place data into table */
LeftRAPStart = aRAPTable[variant];
CentreRAPStart = aRAPTable[variant + 17];
RightRAPStart = aRAPTable[variant + 34];
StartCluster = aRAPTable[variant + 51] / 3;
LeftRAPStart = cc_aRAPTable[variant];
CentreRAPStart = cc_aRAPTable[variant + 17];
RightRAPStart = cc_aRAPTable[variant + 34];
StartCluster = cc_aRAPTable[variant + 51] / 3;
LeftRAP = LeftRAPStart;
CentreRAP = CentreRAPStart;
@ -652,7 +651,7 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w
}
}
static int calc_padding_cca(const int binary_length, const int cc_width) {
static int cc_a_calc_padding(const int binary_length, const int cc_width) {
int target_bitsize = 0;
switch (cc_width) {
@ -704,7 +703,7 @@ static int calc_padding_cca(const int binary_length, const int cc_width) {
return target_bitsize;
}
static int calc_padding_ccb(const int binary_length, const int cc_width) {
static int cc_b_calc_padding(const int binary_length, const int cc_width) {
int target_bitsize = 0;
switch (cc_width) {
@ -778,7 +777,7 @@ static int calc_padding_ccb(const int binary_length, const int cc_width) {
return target_bitsize;
}
static int calc_padding_ccc(const int binary_length, int *p_cc_width, const int linear_width, int *p_ecc_level) {
static int cc_c_calc_padding(const int binary_length, int *p_cc_width, const int linear_width, int *p_ecc_level) {
int target_bitsize = 0;
int byte_length, codewords_used, ecc_level, ecc_codewords, rows;
int codewords_total, target_codewords, target_bytesize;
@ -1136,13 +1135,13 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
switch (cc_mode) {
case 1:
target_bitsize = calc_padding_cca(bp, *p_cc_width);
target_bitsize = cc_a_calc_padding(bp, *p_cc_width);
break;
case 2:
target_bitsize = calc_padding_ccb(bp, *p_cc_width);
target_bitsize = cc_b_calc_padding(bp, *p_cc_width);
break;
case 3:
target_bitsize = calc_padding_ccc(bp, p_cc_width, linear_width, p_ecc_level);
target_bitsize = cc_c_calc_padding(bp, p_cc_width, linear_width, p_ecc_level);
break;
}
@ -1173,13 +1172,13 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
switch (cc_mode) {
case 1:
target_bitsize = calc_padding_cca(bp, *p_cc_width);
target_bitsize = cc_a_calc_padding(bp, *p_cc_width);
break;
case 2:
target_bitsize = calc_padding_ccb(bp, *p_cc_width);
target_bitsize = cc_b_calc_padding(bp, *p_cc_width);
break;
case 3:
target_bitsize = calc_padding_ccc(bp, p_cc_width, linear_width, p_ecc_level);
target_bitsize = cc_c_calc_padding(bp, p_cc_width, linear_width, p_ecc_level);
break;
}
@ -1214,7 +1213,8 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
}
/* Calculate the width of the linear part (primary) */
static int linear_dummy_run(int input_mode, unsigned char *source, const int length, const int debug, char *errtxt) {
static int cc_linear_dummy_run(int input_mode, unsigned char *source, const int length, const int debug,
char *errtxt) {
struct zint_symbol dummy = {0};
int error_number;
int linear_width;
@ -1235,9 +1235,8 @@ static int linear_dummy_run(int input_mode, unsigned char *source, const int len
return linear_width;
}
static const char in_linear_comp[] = " in linear component";
INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
static const char in_linear_comp[] = " in linear component";
int error_number, cc_mode, cc_width = 0, ecc_level = 0;
int j, i, k;
/* Allow for 8 bits + 5-bit latch per char + 1000 bits overhead/padding */
@ -1273,10 +1272,10 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
if (symbol->symbology == BARCODE_GS1_128_CC) {
/* Do a test run of encoding the linear component to establish its width */
linear_width = linear_dummy_run(symbol->input_mode, (unsigned char *) symbol->primary, pri_len,
linear_width = cc_linear_dummy_run(symbol->input_mode, (unsigned char *) symbol->primary, pri_len,
symbol->debug, symbol->errtxt);
if (linear_width == 0) {
if (strlen(symbol->errtxt) + strlen(in_linear_comp) < sizeof(symbol->errtxt)) {
if (strlen(symbol->errtxt) + sizeof(in_linear_comp) <= sizeof(symbol->errtxt)) {
strcat(symbol->errtxt, in_linear_comp);
}
return ZINT_ERROR_INVALID_DATA;
@ -1445,7 +1444,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
if (error_number) {
strcpy(symbol->errtxt, linear->errtxt);
if (strlen(symbol->errtxt) + strlen(in_linear_comp) < sizeof(symbol->errtxt)) {
if (strlen(symbol->errtxt) + sizeof(in_linear_comp) <= sizeof(symbol->errtxt)) {
strcat(symbol->errtxt, in_linear_comp);
}
if (error_number >= ZINT_ERROR) {

View file

@ -1,7 +1,7 @@
/* composite.c - Tables for UCC.EAN Composite Symbols */
/*
libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -34,7 +34,7 @@
#define Z_COMPOSITE_H
/* CC-A component coefficients from ISO/IEC 24728:2006 Annex F */
static const unsigned short ccaCoeffs[30] = {
static const unsigned short cc_aCoeffs[30] = {
/* k = 4 */
522, 568, 723, 809,
@ -42,34 +42,34 @@ static const unsigned short ccaCoeffs[30] = {
427, 919, 460, 155, 566,
/* k = 6 */
861, 285, 19, 803, 17, 766,
861, 285, 19, 803, 17, 766,
/* k = 7 */
76, 925, 537, 597, 784, 691, 437,
76, 925, 537, 597, 784, 691, 437,
/* k = 8 */
237, 308, 436, 284, 646, 653, 428, 379
};
/* rows, error codewords, k-offset of valid CC-A sizes from ISO/IEC 24723:2006 Table 9 */
static const char ccaVariants[51] = {
5, 6, 7, 8, 9, 10, 12, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7,
4, 4, 5, 5, 6, 6, 7, 4, 5, 6, 7, 7, 4, 5, 6, 7, 8,
0, 0, 4, 4, 9, 9, 15, 0, 4, 9, 15, 15, 0, 4, 9, 15, 22
static const char cc_aVariants[51] = {
5, 6, 7, 8, 9, 10, 12, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7,
4, 4, 5, 5, 6, 6, 7, 4, 5, 6, 7, 7, 4, 5, 6, 7, 8,
0, 0, 4, 4, 9, 9, 15, 0, 4, 9, 15, 15, 0, 4, 9, 15, 22
};
/* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24723:2006 tables 10 and 11 */
static const char aRAPTable[68] = {
39, 1, 32, 8, 14, 43, 20, 11, 1, 5, 15, 21, 40, 43, 46, 34, 29,
0, 0, 0, 0, 0, 0, 0, 43, 33, 37, 47, 1, 20, 23, 26, 14, 9,
19, 33, 12, 40, 46, 23, 52, 23, 13, 17, 27, 33, 52, 3, 6, 46, 41,
6, 0, 3, 3, 3, 0, 3, 3, 0, 3, 6, 6, 0, 0, 0, 0, 3
static const char cc_aRAPTable[68] = {
39, 1, 32, 8, 14, 43, 20, 11, 1, 5, 15, 21, 40, 43, 46, 34, 29,
0, 0, 0, 0, 0, 0, 0, 43, 33, 37, 47, 1, 20, 23, 26, 14, 9,
19, 33, 12, 40, 46, 23, 52, 23, 13, 17, 27, 33, 52, 3, 6, 46, 41,
6, 0, 3, 3, 3, 0, 3, 3, 0, 3, 6, 6, 0, 0, 0, 0, 3
};
/* Row Address Patterns are as defined in pdf417.h */
/* Generated by tools/gen_pwr928_table.php */
static const UINT pwr928[69][7] = {
static const unsigned short cc_pwr928[69][7] = {
{ 0, 0, 0, 0, 0, 0, 1, },
{ 0, 0, 0, 0, 0, 0, 2, },
{ 0, 0, 0, 0, 0, 0, 4, },

View file

@ -1,7 +1,7 @@
/* dmatrix.c Handles Data Matrix ECC 200 symbols */
/*
libzint - the open source barcode library
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
developed from and including some functions from:
IEC16022 bar code generation
@ -930,7 +930,7 @@ static void dm_addEdges(struct zint_symbol *symbol, const unsigned char source[]
/* Not possible to unlatch a full EDF edge to something else */
if (previous == NULL || previous->endMode != DM_EDIFACT) {
static const int c40text_modes[] = { DM_C40, DM_TEXT };
static const char c40text_modes[] = { DM_C40, DM_TEXT };
if (z_isdigit(source[from]) && from + 1 < length && z_isdigit(source[from + 1])) {
dm_addEdge(symbol, source, length, edges, DM_ASCII, from, 2, previous, 0);
@ -1886,7 +1886,7 @@ static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const i
}
/* ecc code */
if (symbolsize == INTSYMBOL144 && !(symbol->option_3 & DM_ISO_144)) {
if (symbolsize == DMINTSYMBOL144 && !(symbol->option_3 & DM_ISO_144)) {
skew = 1;
}
dm_ecc(binary, bytes, datablock, rsblock, skew);

View file

@ -1,7 +1,7 @@
/* dmatrix.h - Handles Data Matrix ECC 200 */
/*
libzint - the open source barcode library
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -46,198 +46,211 @@
#define DM_EDIFACT 5
#define DM_BASE256 6
static const char dm_c40_shift[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
/* C40 shift to use per ASCII character (Table C.1) */
static const char dm_c40_shift[128] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
};
static const char dm_c40_value[] = {
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, 27, 28, 29, 30, 31,
3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
15, 16, 17, 18, 19, 20, 21, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
22, 23, 24, 25, 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, 27, 28, 29, 30, 31
/* C40 ASCII values (Table C.1) */
static const char dm_c40_value[128] = {
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, 27, 28, 29, 30, 31,
3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20,
21, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 22, 23, 24, 25, 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, 27, 28, 29, 30, 31
};
static const char dm_text_shift[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3
/* Text shift to use per ASCII character (Table C.2) */
static const char dm_text_shift[128] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2,
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3
};
static const char dm_text_value[] = {
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, 27, 28, 29, 30, 31,
3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
15, 16, 17, 18, 19, 20, 21, 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,
22, 23, 24, 25, 26, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 27, 28, 29, 30, 31
};
/* Position in option array [symbol option value - 1]
The position in the option array is by increasing total data codewords with square first
The last comment value is the total data codewords value.
The index of this array is the --vers parameter value -1 and is given as first comment value */
static const unsigned short dm_intsymbol[] = {
/* Standard DM */
0, /* 1: 10x10 , 3*/ 1, /* 2: 12x12 , 5*/ 3, /* 3: 14x14 , 8*/ 5, /* 4: 16x16 , 12*/
7, /* 5: 18x18 , 18*/ 9, /* 6: 20x20 , 22*/ 12, /* 7: 22x22 , 30*/ 15, /* 8: 24x24 , 36*/
18, /* 9: 26x26 , 44*/ 23, /* 10: 32x32 , 62*/ 31, /* 11: 36x36 , 86*/ 34, /* 12: 40x40 ,114*/
36, /* 13: 44x44 ,144*/ 37, /* 14: 48x48 ,174*/ 38, /* 15: 52x52 ,204*/ 39, /* 16: 64x64 ,280*/
40, /* 17: 72x72 ,368*/ 41, /* 18: 80x80 ,456*/ 42, /* 19: 88x88 ,576*/ 43, /* 20: 96x96 ,696*/
44, /* 21:104x104,816*/ 45, /* 22:120x120,1050*/46, /* 23:132x132,1304*/47, /* 24:144x144,1558*/
2, /* 25: 8x18 , 5*/ 4, /* 26: 8x32 , 10*/ 6, /* 27: 12x26 , 16*/ 10, /* 28: 12x36 , 22*/
13, /* 29: 16x36 , 32*/ 20, /* 30: 16x48 , 49*/
/* DMRE */
8, /* 31: 8x48 , 18*/ 11, /* 32: 8x64 , 24*/ 14, /* 33: 8x80 , 32*/ 16, /* 34: 8x96 , 38*/
21, /* 35: 8x120, 49*/ 25, /* 36: 8x144, 63*/ 17, /* 37: 12x64 , 43*/ 26, /* 38: 12x88 , 64*/
24, /* 39: 16x64 , 62*/ 19, /* 40: 20x36 , 44*/ 22, /* 41: 20x44 , 56*/ 30, /* 42: 20x64 , 84*/
28, /* 43: 22x48 , 72*/ 29, /* 44: 24x48 , 80*/ 33, /* 45: 24x64 ,108*/ 27, /* 46: 26x40 , 70*/
32, /* 47: 26x48 , 90*/ 35, /* 48: 26x64 ,118*/
/* Text ASCII values (Table C.2) */
static const char dm_text_value[128] = {
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, 27, 28, 29, 30, 31,
3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20,
21, 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, 22, 23, 24, 25, 26,
0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 27, 28, 29, 30, 31
};
/* Number of DM Sizes */
#define DMSIZESCOUNT 48
/* Number of 144x144 for special interlace */
#define INTSYMBOL144 47
#define DMINTSYMBOL144 47
/* Is the current code a DMRE code ?
This is the case, if dm_intsymbol index >= 30 */
/* Total data codewords (Table 7) in ascending order */
static const unsigned short dm_matrixbytes[DMSIZESCOUNT] = {
/* 0*/ 3 /*10x10*/, 5 /*12x12*/, 5 /*8x18*/, 8 /*14x14*/,
/* 4*/ 10 /*8x32*/, 12 /*16x16*/, 16 /*12x26*/, 18 /*18x18*/,
/* 8*/ 18 /*8x48*/, 22 /*20x20*/, 22 /*12x36*/, 24 /*8x64*/,
/*12*/ 30 /*22x22*/, 32 /*16x36*/, 32 /*8x80*/, 36 /*24x24*/,
/*16*/ 38 /*8x96*/, 43 /*12x64*/, 44 /*26x26*/, 44 /*20x36*/,
/*20*/ 49 /*16x48*/, 49 /*8x120*/, 56 /*20x44*/, 62 /*32x32*/,
/*24*/ 62 /*16x64*/, 63 /*8x144*/, 64 /*12x88*/, 70 /*26x40*/,
/*28*/ 72 /*22x48*/, 80 /*24x48*/, 84 /*20x64*/, 86 /*36x36*/,
/*32*/ 90 /*26x48*/, 108 /*24x64*/, 114 /*40x40*/, 118 /*26x64*/,
/*36*/ 144 /*44x44*/, 174 /*48x48*/, 204 /*52x52*/, 280 /*64x64*/,
/*40*/ 368 /*72x72*/, 456 /*80x80*/, 576 /*88x88*/, 696 /*96x96*/,
/*44*/ 816 /*104x104*/, 1050 /*120x120*/, 1304 /*132x132*/, 1558 /*144x144*/
};
static const char dm_isDMRE[] = {
/* 0*/ 0, /* 10x10, 3*/ 0, /* 12x12 , 5*/ 0, /* 8x18 , 5*/ 0, /* 14x14 , 8*/
/* 4*/ 0, /* 8x32 , 10*/ 0, /* 16x16 , 12*/ 0, /* 12x26 , 16*/ 0, /* 18x18 , 18*/
/* 8*/ 1, /* 8x48 , 18*/ 0, /* 20x20 , 22*/ 0, /* 12x36 , 22*/ 1, /* 8x64 , 24*/
/*12*/ 0, /* 22x22 , 30*/ 0, /* 16x36 , 32*/ 1, /* 8x80 , 32*/ 0, /* 24x24 , 36*/
/*16*/ 1, /* 8x96 , 38*/ 1, /* 12x64 , 43*/ 0, /* 26x26 , 44*/ 1, /* 20x36 , 44*/
/*20*/ 0, /* 16x48 , 49*/ 1, /* 8x120, 49*/ 1, /* 20x44 , 56*/ 0, /* 32x32 , 62*/
/*24*/ 1, /* 16x64 , 62*/ 1, /* 8x144, 63*/ 1, /* 12x88 , 64*/ 1, /* 26x40 , 70*/
/*28*/ 1, /* 22x48 , 72*/ 1, /* 24x48 , 80*/ 1, /* 20x64 , 84*/ 0, /* 36x36 , 86*/
/*32*/ 1, /* 26x48 , 90*/ 1, /* 24x64 ,108*/ 0, /* 40x40 ,114*/ 1, /* 26x64 ,118*/
/*36*/ 0, /* 44x44 ,144*/ 0, /* 48x48 ,174*/ 0, /* 52x52 ,204*/ 0, /* 64x64 ,280*/
/*40*/ 0, /* 72x72 ,368*/ 0, /* 80x80 ,456*/ 0, /* 88x88 ,576*/ 0, /* 96x96 ,696*/
/*44*/ 0, /*104x104,816*/ 0, /*120x120,1050*/0, /*132x132,1304*/0 /*144x144,1558*/
/* Index into `dm_matrixbytes` array in `symbol->option_2` (CLI `--vers`) order,
i.e. square symbols first, then standard rectangular, then DMRE.
The bracketed comment value is the total data codewords value. */
static const unsigned char dm_intsymbol[DMSIZESCOUNT] = {
/* Standard DM square */
/* 1-4*/ 0 /*10x10 (3)*/, 1 /*12x12 (5)*/, 3 /*14x14 (8)*/, 5 /*16x16 (12)*/,
/* 5-8*/ 7 /*18x18 (18)*/, 9 /*20x20 (22)*/, 12 /*22x22 (30)*/, 15 /*24x24 (36)*/,
/* 9-12*/ 18 /*26x26 (44)*/, 23 /*32x32 (62)*/, 31 /*36x36 (86)*/, 34 /*40x40 (114)*/,
/*13-16*/ 36 /*44x44 (144)*/, 37 /*48x48 (174)*/, 38 /*52x52 (204)*/, 39 /*64x64 (280)*/,
/*17-20*/ 40 /*72x72 (368)*/, 41 /*80x80 (456)*/, 42 /*88x88 (576)*/, 43 /*96x96 (696)*/,
/*21-24*/ 44 /*104x104 (816)*/, 45 /*120x120 (1050)*/, 46 /*132x132 (1304)*/, 47 /*144x144 (1558)*/,
/* Standard DM rectangular */
/*25-28*/ 2 /*8x18 (5)*/, 4 /*8x32 (10)*/, 6 /*12x26 (16)*/, 10 /*12x36 (22)*/,
/*29-30*/ 13 /*16x36 (32)*/, 20 /*16x48 (49)*/,
/* DMRE */
/*31-34*/ 8 /*8x48 (18)*/, 11 /*8x64 (24)*/, 14 /*8x80 (32)*/, 16 /*8x96 (38)*/,
/*35-38*/ 21 /*8x120 (49)*/, 25 /*8x144 (63)*/, 17 /*12x64 (43)*/, 26 /*12x88 (64)*/,
/*39-42*/ 24 /*16x64 (62)*/, 19 /*20x36 (44)*/, 22 /*20x44 (56)*/, 30 /*20x64 (84)*/,
/*43-46*/ 28 /*22x48 (72)*/, 29 /*24x48 (80)*/, 33 /*24x64 (108)*/, 27 /*26x40 (70)*/,
/*47-48*/ 32 /*26x48 (90)*/, 35 /*26x64 (118)*/
};
/* Following arrays in total data codewords order (`dm_matrixbytes`) */
/* Whether the version is DMRE */
static const char dm_isDMRE[DMSIZESCOUNT] = {
/* 0*/ 0 /*10x10 (3)*/, 0 /*12x12 (5)*/, 0 /*8x18 (5)*/, 0 /*14x14 (8)*/,
/* 4*/ 0 /*8x32 (10)*/, 0 /*16x16 (12)*/, 0 /*12x26 (16)*/, 0 /*18x18 (18)*/,
/* 8*/ 1 /*8x48 (18)*/, 0 /*20x20 (22)*/, 0 /*12x36 (22)*/, 1 /*8x64 (24)*/,
/*12*/ 0 /*22x22 (30)*/, 0 /*16x36 (32)*/, 1 /*8x80 (32)*/, 0 /*24x24 (36)*/,
/*16*/ 1 /*8x96 (38)*/, 1 /*12x64 (43)*/, 0 /*26x26 (44)*/, 1 /*20x36 (44)*/,
/*20*/ 0 /*16x48 (49)*/, 1 /*8x120 (49)*/, 1 /*20x44 (56)*/, 0 /*32x32 (62)*/,
/*24*/ 1 /*16x64 (62)*/, 1 /*8x144 (63)*/, 1 /*12x88 (64)*/, 1 /*26x40 (70)*/,
/*28*/ 1 /*22x48 (72)*/, 1 /*24x48 (80)*/, 1 /*20x64 (84)*/, 0 /*36x36 (86)*/,
/*32*/ 1 /*26x48 (90)*/, 1 /*24x64 (108)*/, 0 /*40x40 (114)*/, 1 /*26x64 (118)*/,
/*36*/ 0 /*44x44 (144)*/, 0 /*48x48 (174)*/, 0 /*52x52 (204)*/, 0 /*64x64 (280)*/,
/*40*/ 0 /*72x72 (368)*/, 0 /*80x80 (456)*/, 0 /*88x88 (576)*/, 0 /*96x96 (696)*/,
/*44*/ 0 /*104x104 (816)*/, 0 /*120x120 (1050)*/, 0 /*132x132 (1304)*/, 0 /*144x144 (1558)*/
};
/* Horizontal matrix size */
static const unsigned short dm_matrixH[] = {
/* 0*/ 10, /* 10x10 , 3*/ 12, /* 12x12 , 5 */ 8, /* 8x18 , 5*/ 14, /* 14x14 , 8*/
/* 4*/ 8, /* 8x32 , 10*/ 16, /* 16x16 , 12*/ 12, /* 12x26 , 16*/ 18, /* 18x18 , 18*/
/* 8*/ 8, /* 8x48 , 18*/ 20, /* 20x20 , 22*/ 12, /* 12x36 , 22*/ 8, /* 8x64 , 24*/
/*12*/ 22, /* 22x22 , 30*/ 16, /* 16x36 , 32*/ 8, /* 8x80 , 32*/ 24, /* 24x24 , 36*/
/*16*/ 8, /* 8x96 , 38*/ 12, /* 12x64 , 43*/ 26, /* 26x26 , 44*/ 20, /* 20x36 , 44*/
/*20*/ 16, /* 16x48 , 49*/ 8, /* 8x120, 49*/ 20, /* 20x44 , 56*/ 32, /* 32x32 , 62*/
/*24*/ 16, /* 16x64 , 62*/ 8, /* 8x144, 63*/ 12, /* 12x88 , 64*/ 26, /* 26x40 , 70*/
/*28*/ 22, /* 22x48 , 72*/ 24, /* 24x48 , 80*/ 20, /* 20x64 , 84*/ 36, /* 36x36 , 86*/
/*32*/ 26, /* 26x48 , 90*/ 24, /* 24x64 ,108*/ 40, /* 40x40 ,114*/ 26, /* 26x64 ,118*/
/*36*/ 44, /* 44x44 ,144*/ 48, /* 48x48 ,174*/ 52, /* 52x52 ,204*/ 64, /* 64x64 ,280*/
/*40*/ 72, /* 72x72 ,368*/ 80, /* 80x80 ,456*/ 88, /* 88x88 ,576*/ 96, /* 96x96 ,696*/
/*44*/104, /*104x104,816*/ 120,/*120x120,1050*/132,/*132x132,1304*/144 /*144x144,1558*/
static const unsigned char dm_matrixH[DMSIZESCOUNT] = {
/* 0*/ 10 /*10x10*/, 12 /*12x12 */, 8 /*8x18*/, 14 /*14x14*/,
/* 4*/ 8 /*8x32*/, 16 /*16x16*/, 12 /*12x26*/, 18 /*18x18*/,
/* 8*/ 8 /*8x48*/, 20 /*20x20*/, 12 /*12x36*/, 8 /*8x64*/,
/*12*/ 22 /*22x22*/, 16 /*16x36*/, 8 /*8x80*/, 24 /*24x24*/,
/*16*/ 8 /*8x96*/, 12 /*12x64*/, 26 /*26x26*/, 20 /*20x36*/,
/*20*/ 16 /*16x48*/, 8 /*8x120*/, 20 /*20x44*/, 32 /*32x32*/,
/*24*/ 16 /*16x64*/, 8 /*8x144*/, 12 /*12x88*/, 26 /*26x40*/,
/*28*/ 22 /*22x48*/, 24 /*24x48*/, 20 /*20x64*/, 36 /*36x36*/,
/*32*/ 26 /*26x48*/, 24 /*24x64*/, 40 /*40x40*/, 26 /*26x64*/,
/*36*/ 44 /*44x44*/, 48 /*48x48*/, 52 /*52x52*/, 64 /*64x64*/,
/*40*/ 72 /*72x72*/, 80 /*80x80*/, 88 /*88x88*/, 96 /*96x96*/,
/*44*/ 104 /*104x104*/, 120 /*120x120*/, 132 /*132x132*/, 144 /*144x144*/
};
/* Vertical matrix sizes */
static const unsigned short dm_matrixW[] = {
/* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 18, /* 8x18 */ 14, /* 14x14 */
/* 4*/ 32, /* 8x32 */ 16, /* 16x16 */ 26, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 48, /* 8x48 */ 20, /* 20x20 */ 36, /* 12x36 */ 64, /* 8x64 */
/*12*/ 22, /* 22x22 */ 36, /* 16x36 */ 80, /* 8x80 */ 24, /* 24x24 */
/*16*/ 96, /* 8x96 */ 64, /* 12x64 */ 26, /* 26x26 */ 36, /* 20x36 */
/*20*/ 48, /* 16x48 */120, /* 8x120*/ 44, /* 20x44 */ 32, /* 32x32 */
/*24*/ 64, /* 16x64 */144, /* 8x144*/ 88, /* 12x88 */ 40, /* 26x40 */
/*28*/ 48, /* 22x48 */ 48, /* 24x48 */ 64, /* 20x64 */ 36, /* 36x36 */
/*32*/ 48, /* 26x48 */ 64, /* 24x64 */ 40, /* 40x40 */ 64, /* 26x64 */
/*36*/ 44, /* 44x44 */ 48, /* 48x48 */ 52, /* 52x52 */ 64, /* 64x64 */
/*40*/ 72, /* 72x72 */ 80, /* 80x80 */ 88, /* 88x88 */ 96, /* 96x96 */
/*44*/104, /*104x104*/120, /*120x120*/ 132, /*132x132*/144 /*144x144*/
static const unsigned char dm_matrixW[DMSIZESCOUNT] = {
/* 0*/ 10 /*10x10*/, 12 /*12x12*/, 18 /*8x18*/, 14 /*14x14*/,
/* 4*/ 32 /*8x32*/, 16 /*16x16*/, 26 /*12x26*/, 18 /*18x18*/,
/* 8*/ 48 /*8x48*/, 20 /*20x20*/, 36 /*12x36*/, 64 /*8x64*/,
/*12*/ 22 /*22x22*/, 36 /*16x36*/, 80 /*8x80*/, 24 /*24x24*/,
/*16*/ 96 /*8x96*/, 64 /*12x64*/, 26 /*26x26*/, 36 /*20x36*/,
/*20*/ 48 /*16x48*/, 120 /*8x120*/, 44 /*20x44*/, 32 /*32x32*/,
/*24*/ 64 /*16x64*/, 144 /*8x144*/, 88 /*12x88*/, 40 /*26x40*/,
/*28*/ 48 /*22x48*/, 48 /*24x48*/, 64 /*20x64*/, 36 /*36x36*/,
/*32*/ 48 /*26x48*/, 64 /*24x64*/, 40 /*40x40*/, 64 /*26x64*/,
/*36*/ 44 /*44x44*/, 48 /*48x48*/, 52 /*52x52*/, 64 /*64x64*/,
/*40*/ 72 /*72x72*/, 80 /*80x80*/, 88 /*88x88*/, 96 /*96x96*/,
/*44*/ 104 /*104x104*/, 120 /*120x120*/, 132 /*132x132*/, 144 /*144x144*/
};
/* Horizontal submodule size (including subfinder) */
static const unsigned short dm_matrixFH[] = {
/* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 8, /* 8x18 */ 14, /* 14x14 */
/* 4*/ 8, /* 8x32 */ 16, /* 16x16 */ 12, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 8, /* 8x48 */ 20, /* 20x20 */ 12, /* 12x36 */ 8, /* 8x64 */
/*12*/ 22, /* 22x22 */ 16, /* 16x36 */ 8, /* 8x80 */ 24, /* 24x24 */
/*16*/ 8, /* 8x96 */ 12, /* 12x64 */ 26, /* 26x26 */ 20, /* 20x36 */
/*20*/ 16, /* 16x48 */ 8, /* 8x120*/ 20, /* 20x44 */ 16, /* 32x32 */
/*24*/ 16, /* 16x64 */ 8, /* 8x144*/ 12, /* 12x88 */ 26, /* 26x40 */
/*28*/ 22, /* 22x48 */ 24, /* 24x48 */ 20, /* 20x64 */ 18, /* 36x36 */
/*32*/ 26, /* 26x48 */ 24, /* 24x64 */ 20, /* 40x40 */ 26, /* 26x64 */
/*36*/ 22, /* 44x44 */ 24, /* 48x48 */ 26, /* 52x52 */ 16, /* 64x64 */
/*40*/ 18, /* 72x72 */ 20, /* 80x80 */ 22, /* 88x88 */ 24, /* 96x96 */
/*44*/ 26, /*104x104*/ 20, /*120x120*/ 22, /*132x132*/ 24 /*144x144*/
/* Horizontal submodule size (including subfinder) - see Table 7 Data region H + 2 */
static const unsigned char dm_matrixFH[DMSIZESCOUNT] = {
/* 0*/ 10 /*10x10*/, 12 /*12x12*/, 8 /*8x18*/, 14 /*14x14*/,
/* 4*/ 8 /*8x32*/, 16 /*16x16*/, 12 /*12x26*/, 18 /*18x18*/,
/* 8*/ 8 /*8x48*/, 20 /*20x20*/, 12 /*12x36*/, 8 /*8x64*/,
/*12*/ 22 /*22x22*/, 16 /*16x36*/, 8 /*8x80*/, 24 /*24x24*/,
/*16*/ 8 /*8x96*/, 12 /*12x64*/, 26 /*26x26*/, 20 /*20x36*/,
/*20*/ 16 /*16x48*/, 8 /*8x120*/, 20 /*20x44*/, 16 /*32x32*/,
/*24*/ 16 /*16x64*/, 8 /*8x144*/, 12 /*12x88*/, 26 /*26x40*/,
/*28*/ 22 /*22x48*/, 24 /*24x48*/, 20 /*20x64*/, 18 /*36x36*/,
/*32*/ 26 /*26x48*/, 24 /*24x64*/, 20 /*40x40*/, 26 /*26x64*/,
/*36*/ 22 /*44x44*/, 24 /*48x48*/, 26 /*52x52*/, 16 /*64x64*/,
/*40*/ 18 /*72x72*/, 20 /*80x80*/, 22 /*88x88*/, 24 /*96x96*/,
/*44*/ 26 /*104x104*/, 20 /*120x120*/, 22 /*132x132*/, 24 /*144x144*/
};
/* Vertical submodule size (including subfinder) */
static const unsigned short dm_matrixFW[] = {
/* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 18, /* 8x18 */ 14, /* 14x14 */
/* 4*/ 16, /* 8x32 */ 16, /* 16x16 */ 26, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 24, /* 8x48 */ 20, /* 20x20 */ 18, /* 12x36 */ 16, /* 8x64 */
/*12*/ 22, /* 22x22 */ 18, /* 16x36 */ 20, /* 8x80 */ 24, /* 24x24 */
/*16*/ 24, /* 8x96 */ 16, /* 12x64 */ 26, /* 26x26 */ 18, /* 20x36 */
/*20*/ 24, /* 16x48 */ 20, /* 8x120*/ 22, /* 20x44 */ 16, /* 32x32 */
/*24*/ 16, /* 16x64 */ 24, /* 8x144*/ 22, /* 12x88 */ 20, /* 26x40 */
/*28*/ 24, /* 22x48 */ 24, /* 24x48 */ 16, /* 20x64 */ 18, /* 36x36 */
/*32*/ 24, /* 26x48 */ 16, /* 24x64 */ 20, /* 40x40 */ 16, /* 26x64 */
/*36*/ 22, /* 44x44 */ 24, /* 48x48 */ 26, /* 52x52 */ 16, /* 64x64 */
/*40*/ 18, /* 72x72 */ 20, /* 80x80 */ 22, /* 88x88 */ 24, /* 96x96 */
/*44*/ 26, /*104x104*/ 20, /*120x120*/ 22, /*132x132*/ 24 /*144x144*/
};
/* Total Data Codewords */
static const unsigned short dm_matrixbytes[] = {
/* 0*/ 3, /* 10x10 */ 5, /* 12x12 */ 5, /* 8x18 */ 8, /* 14x14 */
/* 4*/ 10, /* 8x32 */ 12, /* 16x16 */ 16, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 18, /* 8x48 */ 22, /* 20x20 */ 22, /* 12x36 */ 24, /* 8x64 */
/*12*/ 30, /* 22x22 */ 32, /* 16x36 */ 32, /* 8x80 */ 36, /* 24x24 */
/*16*/ 38, /* 8x96 */ 43, /* 12x64 */ 44, /* 26x26 */ 44, /* 20x36 */
/*20*/ 49, /* 16x48 */ 49, /* 8x120*/ 56, /* 20x44 */ 62, /* 32x32 */
/*24*/ 62, /* 16x64 */ 63, /* 8x144*/ 64, /* 12x88 */ 70, /* 26x40 */
/*28*/ 72, /* 22x48 */ 80, /* 24x48 */ 84, /* 20x64 */ 86, /* 36x36 */
/*32*/ 90, /* 26x48 */ 108, /* 24x64 */ 114, /* 40x40 */ 118, /* 26x64 */
/*36*/ 144, /* 44x44 */ 174, /* 48x48 */ 204, /* 52x52 */ 280, /* 64x64 */
/*40*/ 368, /* 72x72 */ 456, /* 80x80 */ 576, /* 88x88 */ 696, /* 96x96 */
/*44*/ 816, /*104x104*/1050, /*120x120*/1304, /*132x132*/1558 /*144x144*/
/* Vertical submodule size (including subfinder) - see Table 7 Data region W + 2 */
static const unsigned char dm_matrixFW[DMSIZESCOUNT] = {
/* 0*/ 10 /*10x10*/, 12 /*12x12*/, 18 /*8x18*/, 14 /*14x14*/,
/* 4*/ 16 /*8x32*/, 16 /*16x16*/, 26 /*12x26*/, 18 /*18x18*/,
/* 8*/ 24 /*8x48*/, 20 /*20x20*/, 18 /*12x36*/, 16 /*8x64*/,
/*12*/ 22 /*22x22*/, 18 /*16x36*/, 20 /*8x80*/, 24 /*24x24*/,
/*16*/ 24 /*8x96*/, 16 /*12x64*/, 26 /*26x26*/, 18 /*20x36*/,
/*20*/ 24 /*16x48*/, 20 /*8x120*/, 22 /*20x44*/, 16 /*32x32*/,
/*24*/ 16 /*16x64*/, 24 /*8x144*/, 22 /*12x88*/, 20 /*26x40*/,
/*28*/ 24 /*22x48*/, 24 /*24x48*/, 16 /*20x64*/, 18 /*36x36*/,
/*32*/ 24 /*26x48*/, 16 /*24x64*/, 20 /*40x40*/, 16 /*26x64*/,
/*36*/ 22 /*44x44*/, 24 /*48x48*/, 26 /*52x52*/, 16 /*64x64*/,
/*40*/ 18 /*72x72*/, 20 /*80x80*/, 22 /*88x88*/, 24 /*96x96*/,
/*44*/ 26 /*104x104*/, 20 /*120x120*/, 22 /*132x132*/, 24 /*144x144*/
};
/* Data Codewords per RS-Block */
static const unsigned short dm_matrixdatablock[] = {
/* 0*/ 3, /* 10x10 */ 5, /* 12x12 */ 5, /* 8x18 */ 8, /* 14x14 */
/* 4*/ 10, /* 8x32 */ 12, /* 16x16 */ 16, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 18, /* 8x48 */ 22, /* 20x20 */ 22, /* 12x36 */ 24, /* 8x64 */
/*12*/ 30, /* 22x22 */ 32, /* 16x36 */ 32, /* 8x80 */ 36, /* 24x24 */
/*16*/ 38, /* 8x96 */ 43, /* 12x64 */ 44, /* 26x26 */ 44, /* 20x36 */
/*20*/ 49, /* 16x48 */ 49, /* 8x120*/ 56, /* 20x44 */ 62, /* 32x32 */
/*24*/ 62, /* 16x64 */ 63, /* 8x144*/ 64, /* 12x88 */ 70, /* 26x40 */
/*28*/ 72, /* 22x48 */ 80, /* 24x48 */ 84, /* 20x64 */ 86, /* 36x36 */
/*32*/ 90, /* 26x48 */ 108, /* 24x64 */ 114, /* 40x40 */ 118, /* 26x64 */
/*36*/ 144, /* 44x44 */ 174, /* 48x48 */ 102, /* 52x52 */ 140, /* 64x64 */
/*40*/ 92, /* 72x72 */ 114, /* 80x80 */ 144, /* 88x88 */ 174, /* 96x96 */
/*44*/ 136, /*104x104*/ 175, /*120x120*/ 163, /*132x132*/ 156 /* 144x144*/
static const unsigned char dm_matrixdatablock[DMSIZESCOUNT] = {
/* 0*/ 3 /*10x10*/, 5 /*12x12*/, 5 /*8x18*/, 8 /*14x14*/,
/* 4*/ 10 /*8x32*/, 12 /*16x16*/, 16 /*12x26*/, 18 /*18x18*/,
/* 8*/ 18 /*8x48*/, 22 /*20x20*/, 22 /*12x36*/, 24 /*8x64*/,
/*12*/ 30 /*22x22*/, 32 /*16x36*/, 32 /*8x80*/, 36 /*24x24*/,
/*16*/ 38 /*8x96*/, 43 /*12x64*/, 44 /*26x26*/, 44 /*20x36*/,
/*20*/ 49 /*16x48*/, 49 /*8x120*/, 56 /*20x44*/, 62 /*32x32*/,
/*24*/ 62 /*16x64*/, 63 /*8x144*/, 64 /*12x88*/, 70 /*26x40*/,
/*28*/ 72 /*22x48*/, 80 /*24x48*/, 84 /*20x64*/, 86 /*36x36*/,
/*32*/ 90 /*26x48*/, 108 /*24x64*/, 114 /*40x40*/, 118 /*26x64*/,
/*36*/ 144 /*44x44*/, 174 /*48x48*/, 102 /*52x52*/, 140 /*64x64*/,
/*40*/ 92 /*72x72*/, 114 /*80x80*/, 144 /*88x88*/, 174 /*96x96*/,
/*44*/ 136 /*104x104*/, 175 /*120x120*/, 163 /*132x132*/, 156 /*144x144*/
};
/* ECC Codewords per RS-Block */
static const unsigned short dm_matrixrsblock[] = {
/* 0*/ 5, /* 10x10 */ 7, /* 12x12 */ 7, /* 8x18 */ 10, /* 14x14 */
/* 4*/ 11, /* 8x32 */ 12, /* 16x16 */ 14, /* 12x26 */ 14, /* 18x18 */
/* 8*/ 15, /* 8x48 */ 18, /* 20x20 */ 18, /* 12x36 */ 18, /* 8x64 */
/*12*/ 20, /* 22x22 */ 24, /* 16x36 */ 22, /* 8x80 */ 24, /* 24x24 */
/*16*/ 28, /* 8x96 */ 27, /* 12x64 */ 28, /* 26x26 */ 28, /* 20x36 */
/*20*/ 28, /* 16x48 */ 32, /* 8x120*/ 34, /* 20x44 */ 36, /* 32x32 */
/*24*/ 36, /* 16x64 */ 36, /* 8x144*/ 36, /* 12x88 */ 38, /* 26x40 */
/*28*/ 38, /* 22x48 */ 41, /* 24x48 */ 42, /* 20x64 */ 42, /* 36x36 */
/*32*/ 42, /* 26x48 */ 46, /* 24x64 */ 48, /* 40x40 */ 50, /* 26x64 */
/*36*/ 56, /* 44x44 */ 68, /* 48x48 */ 42, /* 52x52 */ 56, /* 64x64 */
/*40*/ 36, /* 72x72 */ 48, /* 80x80 */ 56, /* 88x88 */ 68, /* 96x96 */
/*44*/ 56, /*104x104*/ 68, /*120x120*/ 62, /*132x132*/ 62 /*144x144*/
static const unsigned char dm_matrixrsblock[DMSIZESCOUNT] = {
/* 0*/ 5 /*10x10*/, 7 /*12x12*/, 7 /*8x18*/, 10 /*14x14*/,
/* 4*/ 11 /*8x32*/, 12 /*16x16*/, 14 /*12x26*/, 14 /*18x18*/,
/* 8*/ 15 /*8x48*/, 18 /*20x20*/, 18 /*12x36*/, 18 /*8x64*/,
/*12*/ 20 /*22x22*/, 24 /*16x36*/, 22 /*8x80*/, 24 /*24x24*/,
/*16*/ 28 /*8x96*/, 27 /*12x64*/, 28 /*26x26*/, 28 /*20x36*/,
/*20*/ 28 /*16x48*/, 32 /*8x120*/, 34 /*20x44*/, 36 /*32x32*/,
/*24*/ 36 /*16x64*/, 36 /*8x144*/, 36 /*12x88*/, 38 /*26x40*/,
/*28*/ 38 /*22x48*/, 41 /*24x48*/, 42 /*20x64*/, 42 /*36x36*/,
/*32*/ 42 /*26x48*/, 46 /*24x64*/, 48 /*40x40*/, 50 /*26x64*/,
/*36*/ 56 /*44x44*/, 68 /*48x48*/, 42 /*52x52*/, 56 /*64x64*/,
/*40*/ 36 /*72x72*/, 48 /*80x80*/, 56 /*88x88*/, 68 /*96x96*/,
/*44*/ 56 /*104x104*/, 68 /*120x120*/, 62 /*132x132*/, 62 /*144x144*/
};
/* vim: set ts=4 sw=4 et : */

View file

@ -368,7 +368,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) {
recordcount++;
if (symbol->symbology == BARCODE_ULTRA) {
static const char ultra_chars[] = "0CBMRYGKW";
static const char ultra_chars[] = { '0', 'C', 'B', 'M', 'R', 'Y', 'G', 'K', 'W' };
for (i = 0; i < 9; i++) {
out_le_u32(emr_createbrushindirect_colour[i].type, 0x00000027); /* EMR_CREATEBRUSHINDIRECT */
out_le_u32(emr_createbrushindirect_colour[i].size, 24);

View file

@ -420,7 +420,7 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
}
/* Image Descriptor */
/* Image separator character = ',' */
outbuf[0] = 0x2c;
outbuf[0] = ',';
/* "Image Left" */
outbuf[1] = 0x00;
outbuf[2] = 0x00;
@ -448,7 +448,7 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
strcpy(symbol->errtxt, "613: Insufficient memory for LZW buffer");
return ZINT_ERROR_MEMORY;
}
fm_write((const char *) State.pOut, 1, State.OutPosCur, State.fmp);
fm_write(State.pOut, 1, State.OutPosCur, State.fmp);
free(State.pOut);
/* GIF terminator */

View file

@ -137,7 +137,7 @@ static void gm_define_mode(char *mode, const unsigned int ddata[], const int len
};
/* Cost of switching modes from k to j - see AIMD014 Rev. 1.63 Table 9 Type conversion codes */
static const unsigned int switch_costs[GM_NUM_MODES][GM_NUM_MODES] = {
static const unsigned char switch_costs[GM_NUM_MODES][GM_NUM_MODES] = {
/* H N L U M B */
/*H*/ { 0, (13 + 2) * GM_MULT, 13 * GM_MULT, 13 * GM_MULT, 13 * GM_MULT, (13 + 9) * GM_MULT },
/*N*/ { 10 * GM_MULT, 0, 10 * GM_MULT, 10 * GM_MULT, 10 * GM_MULT, (10 + 9) * GM_MULT },
@ -148,7 +148,7 @@ static void gm_define_mode(char *mode, const unsigned int ddata[], const int len
};
/* Final end-of-data cost - see AIMD014 Rev. 1.63 Table 9 Type conversion codes */
static const unsigned int eod_costs[GM_NUM_MODES] = {
static const unsigned char eod_costs[GM_NUM_MODES] = {
/* H N L U M B */
13 * GM_MULT, 10 * GM_MULT, 5 * GM_MULT, 5 * GM_MULT, 10 * GM_MULT, 4 * GM_MULT
};

View file

@ -364,7 +364,7 @@ static void hx_define_mode(char *mode, const unsigned int ddata[], const int len
};
/* Cost of switching modes from k to j */
static const unsigned int switch_costs[HX_NUM_MODES][HX_NUM_MODES] = {
static const unsigned char switch_costs[HX_NUM_MODES][HX_NUM_MODES] = {
/* N T B 1 2 D F */
/*N*/ { 0, (10 + 4) * HX_MULT, (10 + 4 + 13) * HX_MULT, (10 + 4) * HX_MULT, (10 + 4) * HX_MULT, (10 + 4) * HX_MULT, 10 * HX_MULT },
/*T*/ { (6 + 4) * HX_MULT, 0, (6 + 4 + 13) * HX_MULT, (6 + 4) * HX_MULT, (6 + 4) * HX_MULT, (6 + 4) * HX_MULT, 6 * HX_MULT },
@ -376,7 +376,7 @@ static void hx_define_mode(char *mode, const unsigned int ddata[], const int len
};
/* Final end-of-data costs */
static const unsigned int eod_costs[HX_NUM_MODES] = {
static const unsigned char eod_costs[HX_NUM_MODES] = {
/* N T B 1 2 D F */
10 * HX_MULT, 6 * HX_MULT, 0, 12 * HX_MULT, 12 * HX_MULT, 15 * HX_MULT, 0
};

View file

@ -40,8 +40,8 @@
/* The following lookup tables were generated using the code in Appendix C */
/* Appendix D Table 1 - 5 of 13 characters */
static const unsigned short AppxD_I[1287] = {
/* Appendix D Table 1 - 5 of 13 characters */
0x001F, 0x1F00, 0x002F, 0x1E80, 0x0037, 0x1D80, 0x003B, 0x1B80, 0x003D, 0x1780,
0x003E, 0x0F80, 0x004F, 0x1E40, 0x0057, 0x1D40, 0x005B, 0x1B40, 0x005D, 0x1740,
0x005E, 0x0F40, 0x0067, 0x1CC0, 0x006B, 0x1AC0, 0x006D, 0x16C0, 0x006E, 0x0EC0,
@ -173,8 +173,8 @@ static const unsigned short AppxD_I[1287] = {
0x08E2, 0x064C, 0x0554, 0x04E4, 0x0358, 0x02E8, 0x01F0
};
/* Appendix D Table II - 2 of 13 characters */
static const unsigned short AppxD_II[78] = {
/* Appendix D Table II - 2 of 13 characters */
0x0003, 0x1800, 0x0005, 0x1400, 0x0006, 0x0C00, 0x0009, 0x1200, 0x000A, 0x0A00,
0x000C, 0x0600, 0x0011, 0x1100, 0x0012, 0x0900, 0x0014, 0x0500, 0x0018, 0x0300,
0x0021, 0x1080, 0x0022, 0x0880, 0x0024, 0x0480, 0x0028, 0x0280, 0x0030, 0x0180,
@ -185,14 +185,15 @@ static const unsigned short AppxD_II[78] = {
0x0801, 0x1002, 0x1001, 0x0802, 0x0404, 0x0208, 0x0110, 0x00A0
};
static const unsigned short AppxD_IV[130] = {
/* Appendix D Table IV - Bar-to-Character Mapping (reverse lookup) */
67, 6, 78, 16, 86, 95, 34, 40, 45, 113, 117, 121, 62, 87, 18, 104, 41, 76, 57, 119, 115, 72, 97,
2, 127, 26, 105, 35, 122, 52, 114, 7, 24, 82, 68, 63, 94, 44, 77, 112, 70, 100, 39, 30, 107,
15, 125, 85, 10, 65, 54, 88, 20, 106, 46, 66, 8, 116, 29, 61, 99, 80, 90, 37, 123, 51, 25, 84,
129, 56, 4, 109, 96, 28, 36, 47, 11, 71, 33, 102, 21, 9, 17, 49, 124, 79, 64, 91, 42, 69, 53,
60, 14, 1, 27, 103, 126, 75, 89, 50, 120, 19, 32, 110, 92, 111, 130, 59, 31, 12, 81, 43, 55,
5, 74, 22, 101, 128, 58, 118, 48, 108, 38, 98, 93, 23, 83, 13, 73, 3
/* Appendix D Table IV - Bar-to-Character Mapping (reverse lookup) */
static const unsigned char AppxD_IV[130] = {
67, 6, 78, 16, 86, 95, 34, 40, 45, 113, 117, 121, 62, 87, 18, 104, 41, 76, 57, 119,
115, 72, 97, 2, 127, 26, 105, 35, 122, 52, 114, 7, 24, 82, 68, 63, 94, 44, 77, 112,
70, 100, 39, 30, 107, 15, 125, 85, 10, 65, 54, 88, 20, 106, 46, 66, 8, 116, 29, 61,
99, 80, 90, 37, 123, 51, 25, 84, 129, 56, 4, 109, 96, 28, 36, 47, 11, 71, 33, 102,
21, 9, 17, 49, 124, 79, 64, 91, 42, 69, 53, 60, 14, 1, 27, 103, 126, 75, 89, 50,
120, 19, 32, 110, 92, 111, 130, 59, 31, 12, 81, 43, 55, 5, 74, 22, 101, 128, 58, 118,
48, 108, 38, 98, 93, 23, 83, 13, 73, 3
};
/***************************************************************************

View file

@ -711,7 +711,8 @@ INTERNAL void strip_bom_test(unsigned char *source, int *input_length) {
#endif
/* Helper to convert base octal, decimal, hexadecimal escape sequence */
static int esc_base(struct zint_symbol *symbol, unsigned char *input_string, int length, int in_posn, int base) {
static int esc_base(struct zint_symbol *symbol, const unsigned char *input_string, const int length,
const int in_posn, const unsigned char base) {
int c1, c2, c3;
int min_len = base == 'x' ? 2 : 3;
@ -743,14 +744,14 @@ static int esc_base(struct zint_symbol *symbol, unsigned char *input_string, int
}
/* Helper to parse escape sequences. If `escaped_string` NULL, calculates length only */
static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, int *p_length,
static int escape_char_process(struct zint_symbol *symbol, const unsigned char *input_string, int *p_length,
unsigned char *escaped_string) {
/* NUL EOT BEL BS HT LF VT FF CR ESC GS RS \ */
static const char escs[] = { '0', 'E', 'a', 'b', 't', 'n', 'v', 'f', 'r', 'e', 'G', 'R', '\\', '\0' };
static const char vals[] = { 0x00, 0x04, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x1B, 0x1D, 0x1E, 0x5C };
const int length = *p_length;
int in_posn = 0, out_posn = 0;
int ch;
unsigned char ch;
int val;
int i;
unsigned long unicode;
@ -886,7 +887,7 @@ static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_
}
#ifdef ZINT_TEST /* Wrapper for direct testing (also used by `testUtilZXingCPPCmp()` in "tests/testcommon.c") */
INTERNAL int escape_char_process_test(struct zint_symbol *symbol, unsigned char *input_string, int *p_length,
INTERNAL int escape_char_process_test(struct zint_symbol *symbol, const unsigned char *input_string, int *p_length,
unsigned char *escaped_string) {
return escape_char_process(symbol, input_string, p_length, escaped_string);
}
@ -1235,7 +1236,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
if (error_number) {
static const char in_2d_comp[] = " in 2D component";
if (is_composite(symbol->symbology)
&& strlen(symbol->errtxt) + strlen(in_2d_comp) < sizeof(symbol->errtxt)) {
&& strlen(symbol->errtxt) + sizeof(in_2d_comp) <= sizeof(symbol->errtxt)) {
strcat(symbol->errtxt, in_2d_comp);
}
error_number = error_tag(symbol, error_number, NULL);

View file

@ -72,11 +72,11 @@ static const unsigned char mailmark_data_symbol_even[30] = {
0x33, 0x35, 0x36, 0x39, 0x3A, 0x3C
};
static const unsigned short mailmark_extender_group_c[22] = {
static const unsigned char mailmark_extender_group_c[22] = {
3, 5, 7, 11, 13, 14, 16, 17, 19, 0, 1, 2, 4, 6, 8, 9, 10, 12, 15, 18, 20, 21
};
static const unsigned short mailmark_extender_group_l[26] = {
static const unsigned char mailmark_extender_group_l[26] = {
2, 5, 7, 8, 13, 14, 15, 16, 21, 22, 23, 0, 1, 3, 4, 6, 9, 10, 11, 12, 17, 18, 19, 20, 24, 25
};

View file

@ -507,7 +507,7 @@ static void pdf_textprocess_minimal(short *chainemc, int *p_mclength, const unsi
}
for (i = *p_i; i < indexliste && PDF_REAL_MODE(liste[1][i]) == PDF_TEX; i++) {
static const int newtables[5] = { 0, T_ALPHA, T_LOWER, T_MIXED, T_PUNCT };
static const unsigned char newtables[5] = { 0, T_ALPHA, T_LOWER, T_MIXED, T_PUNCT };
const int newtable = newtables[liste[1][i]];
const int from = liste[2][i];
for (j = 0; j < liste[0][i]; j++) {
@ -1202,7 +1202,7 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int
int structapp_cp = 0;
int error_number;
const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
static const int ecc_num_cws[] = { 2, 4, 8, 16, 32, 64, 128, 256, 512 };
static const short ecc_num_cws[] = { 2, 4, 8, 16, 32, 64, 128, 256, 512 };
if (segs_length(segs, seg_count) > PDF_MAX_LEN) {
strcpy(symbol->errtxt, "463: Input string too long");

View file

@ -1,7 +1,7 @@
/* plessey.c - Handles Plessey and MSI Plessey */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -123,7 +123,7 @@ INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int len
/* Modulo 10 check digit - Luhn algorithm
See https://en.wikipedia.org/wiki/Luhn_algorithm */
static char msi_check_digit_mod10(const unsigned char source[], const int length) {
static const int vals[2][10] = {
static const char vals[2][10] = {
{ 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 }, /* Doubled and digits summed */
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, /* Single */
};

View file

@ -339,7 +339,7 @@ static void qr_define_mode(char mode[], const unsigned int ddata[], const int le
/* Returns mode indicator based on version and mode */
static int qr_mode_indicator(const int version, const int mode) {
static const int mode_indicators[6][QR_NUM_MODES] = {
static const char mode_indicators[6][QR_NUM_MODES] = {
/*N A B K */
{ 1, 2, 4, 8, }, /* QRCODE */
{ 1, 2, 3, 4, }, /* RMQR */
@ -373,7 +373,7 @@ static int qr_mode_bits(const int version) {
/* Return character count indicator bits based on version and mode */
static int qr_cci_bits(const int version, const int mode) {
static const int cci_bits[7][QR_NUM_MODES] = {
static const char cci_bits[7][QR_NUM_MODES] = {
/* N A B K */
{ 10, 9, 8, 8, }, /* QRCODE */
{ 12, 11, 16, 10, },
@ -383,7 +383,7 @@ static int qr_cci_bits(const int version, const int mode) {
{ 5, 4, 4, 3, },
{ 6, 5, 5, 4, }
};
static const unsigned short *rmqr_ccis[QR_NUM_MODES] = {
static const unsigned char *rmqr_ccis[QR_NUM_MODES] = {
rmqr_numeric_cci, rmqr_alphanum_cci, rmqr_byte_cci, rmqr_kanji_cci,
};
int mode_index = posn(qr_mode_types, (const char) mode);

View file

@ -1,7 +1,7 @@
/* qr.h Data for QR Code, Micro QR Code and rMQR */
/*
libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2006 Kentaro Fukuchi <fukuchi@megaui.net>
Redistribution and use in source and binary forms, with or without
@ -34,96 +34,106 @@
#ifndef Z_QR_H
#define Z_QR_H
/* From ISO/IEC 18004:2015 Table 5 Encoding/decoding table for Alphanumeric mode */
static const char qr_alphanumeric[59] = {
/* From ISO/IEC 18004:2015 Table 5 - Encoding/decoding table for Alphanumeric mode */
static const signed char qr_alphanumeric[59] = {
36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, /* SP-/ */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, /* 0-? */
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, /* @-O */
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 /* P-Z */
};
/* From ISO/IEC 18004:2015 Table 7 */
static const unsigned short qr_data_codewords_L[] = {
19, 34, 55, 80, 108, 136, 156, 194, 232, 274, 324, 370, 428, 461, 523, 589, 647,
721, 795, 861, 932, 1006, 1094, 1174, 1276, 1370, 1468, 1531, 1631,
1735, 1843, 1955, 2071, 2191, 2306, 2434, 2566, 2702, 2812, 2956
/* From ISO/IEC 18004:2015 Table 7 - Number of symbol characters and input data capacity for QR Code */
static const unsigned short qr_data_codewords_L[40] = {
19, 34, 55, 80, 108, 136, 156, 194, 232, 274,
324, 370, 428, 461, 523, 589, 647, 721, 795, 861,
932, 1006, 1094, 1174, 1276, 1370, 1468, 1531, 1631, 1735,
1843, 1955, 2071, 2191, 2306, 2434, 2566, 2702, 2812, 2956
};
static const unsigned short qr_data_codewords_M[] = {
16, 28, 44, 64, 86, 108, 124, 154, 182, 216, 254, 290, 334, 365, 415, 453, 507,
563, 627, 669, 714, 782, 860, 914, 1000, 1062, 1128, 1193, 1267,
1373, 1455, 1541, 1631, 1725, 1812, 1914, 1992, 2102, 2216, 2334
static const unsigned short qr_data_codewords_M[40] = {
16, 28, 44, 64, 86, 108, 124, 154, 182, 216,
254, 290, 334, 365, 415, 453, 507, 563, 627, 669,
714, 782, 860, 914, 1000, 1062, 1128, 1193, 1267, 1373,
1455, 1541, 1631, 1725, 1812, 1914, 1992, 2102, 2216, 2334
};
static const unsigned short qr_data_codewords_Q[] = {
13, 22, 34, 48, 62, 76, 88, 110, 132, 154, 180, 206, 244, 261, 295, 325, 367,
397, 445, 485, 512, 568, 614, 664, 718, 754, 808, 871, 911,
985, 1033, 1115, 1171, 1231, 1286, 1354, 1426, 1502, 1582, 1666
static const unsigned short qr_data_codewords_Q[40] = {
13, 22, 34, 48, 62, 76, 88, 110, 132, 154,
180, 206, 244, 261, 295, 325, 367, 397, 445, 485,
512, 568, 614, 664, 718, 754, 808, 871, 911, 985,
1033, 1115, 1171, 1231, 1286, 1354, 1426, 1502, 1582, 1666
};
static const unsigned short qr_data_codewords_H[] = {
9, 16, 26, 36, 46, 60, 66, 86, 100, 122, 140, 158, 180, 197, 223, 253, 283,
313, 341, 385, 406, 442, 464, 514, 538, 596, 628, 661, 701,
745, 793, 845, 901, 961, 986, 1054, 1096, 1142, 1222, 1276
static const unsigned short qr_data_codewords_H[40] = {
9, 16, 26, 36, 46, 60, 66, 86, 100, 122,
140, 158, 180, 197, 223, 253, 283, 313, 341, 385,
406, 442, 464, 514, 538, 596, 628, 661, 701, 745,
793, 845, 901, 961, 986, 1054, 1096, 1142, 1222, 1276
};
static const unsigned short qr_total_codewords[] = {
26, 44, 70, 100, 134, 172, 196, 242, 292, 346, 404, 466, 532, 581, 655, 733, 815,
901, 991, 1085, 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051,
2185, 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
/* From ISO/IEC 18004:2015 Table 1 - Codeword capacity of all versions of QRCode */
static const unsigned short qr_total_codewords[40] = {
26, 44, 70, 100, 134, 172, 196, 242, 292, 346,
404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,
1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,
2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
};
static const unsigned short rmqr_height[] = {
7, 7, 7, 7, 7,
9, 9, 9, 9, 9,
/* From ISO/IEC 23941:2022 Table 1 - Codeword capacity of all versions of rMQR symbols */
static const unsigned char rmqr_height[32] = {
7, 7, 7, 7, 7,
9, 9, 9, 9, 9,
11, 11, 11, 11, 11, 11,
13, 13, 13, 13, 13, 13,
15, 15, 15, 15, 15,
17, 17, 17, 17, 17
};
static const unsigned short rmqr_width[] = {
static const unsigned char rmqr_width[32] = {
43, 59, 77, 99, 139,
43, 59, 77, 99, 139,
27, 43, 59, 77, 99, 139,
27, 43, 59, 77, 99, 139,
27, 43, 59, 77, 99, 139,
27, 43, 59, 77, 99, 139,
43, 59, 77, 99, 139,
43, 59, 77, 99, 139
};
static const unsigned short rmqr_data_codewords_M[] = {
6, 12, 20, 28, 44, /* R7x */
12, 21, 31, 42, 63, /* R9x */
7, 19, 31, 43, 57, 84, /* R11x */
12, 27, 38, 53, 73, 106, /* R13x */
33, 48, 67, 88, 127, /* R15x */
/* From ISO/IEC 23941:2022 Table 6 - Number of data codewords and input data capacity for rMQR */
static const unsigned char rmqr_data_codewords_M[32] = {
6, 12, 20, 28, 44, /* R7x */
12, 21, 31, 42, 63, /* R9x */
7, 19, 31, 43, 57, 84, /* R11x */
12, 27, 38, 53, 73, 106, /* R13x */
33, 48, 67, 88, 127, /* R15x */
39, 56, 78, 100, 152 /* R17x */
};
static const unsigned short rmqr_data_codewords_H[] = {
3, 7, 10, 14, 24, /* R7x */
7, 11, 17, 22, 33, /* R9x */
5, 11, 15, 23, 29, 42, /* R11x */
7, 13, 20, 29, 35, 54, /* R13x */
static const unsigned char rmqr_data_codewords_H[32] = {
3, 7, 10, 14, 24, /* R7x */
7, 11, 17, 22, 33, /* R9x */
5, 11, 15, 23, 29, 42, /* R11x */
7, 13, 20, 29, 35, 54, /* R13x */
15, 26, 31, 48, 69, /* R15x */
21, 28, 38, 56, 76 /* R17x */
};
static const short rmqr_fixed_height_upper_bound[] = {
/* Highest index in `rmqr_total_codewords` for each given row (R7x, R9x etc) */
static const signed char rmqr_fixed_height_upper_bound[7] = {
-1, 4, 9, 15, 21, 26, 31
};
static const unsigned short rmqr_total_codewords[] = {
13, 21, 32, 44, 68, /* R7x */
21, 33, 49, 66, 99, /* R9x */
15, 31, 47, 67, 89, 132, /* R11x */
21, 41, 60, 85, 113, 166, /* R13x */
/* From ISO/IEC 23941:2022 Table 1 - Codeword capacity of all versions of rMQR symbols */
static const unsigned char rmqr_total_codewords[32] = {
13, 21, 32, 44, 68, /* R7x */
21, 33, 49, 66, 99, /* R9x */
15, 31, 47, 67, 89, 132, /* R11x */
21, 41, 60, 85, 113, 166, /* R13x */
51, 74, 103, 136, 199, /* R15x */
61, 88, 122, 160, 232 /* R17x */
};
static const unsigned short rmqr_numeric_cci[] = {
/* From ISO/IEC 23941:2022 Table 3 - Number of bits of character count indicator */
static const unsigned char rmqr_numeric_cci[32] = {
4, 5, 6, 7, 7,
5, 6, 7, 7, 8,
4, 6, 7, 7, 8, 8,
@ -132,7 +142,7 @@ static const unsigned short rmqr_numeric_cci[] = {
7, 8, 8, 8, 9
};
static const unsigned short rmqr_alphanum_cci[] = {
static const unsigned char rmqr_alphanum_cci[32] = {
3, 5, 5, 6, 6,
5, 5, 6, 6, 7,
4, 5, 6, 6, 7, 7,
@ -141,7 +151,7 @@ static const unsigned short rmqr_alphanum_cci[] = {
6, 7, 7, 8, 8
};
static const unsigned short rmqr_byte_cci[] = {
static const unsigned char rmqr_byte_cci[32] = {
3, 4, 5, 5, 6,
4, 5, 5, 6, 6,
3, 5, 5, 6, 6, 7,
@ -150,7 +160,7 @@ static const unsigned short rmqr_byte_cci[] = {
6, 6, 7, 7, 8
};
static const unsigned short rmqr_kanji_cci[] = {
static const unsigned char rmqr_kanji_cci[32] = {
2, 3, 4, 5, 5,
3, 4, 5, 5, 6,
2, 4, 5, 5, 6, 6,
@ -159,27 +169,37 @@ static const unsigned short rmqr_kanji_cci[] = {
5, 6, 6, 6, 7
};
static const char qr_blocks_L[] = {
1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12,
12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25
/* From ISO/IEC 18004:2015 Table 9 - Error correction characteristics for QR Code */
static const char qr_blocks_L[40] = {
1, 1, 1, 1, 1, 2, 2, 2, 2, 4,
4, 4, 4, 4, 6, 6, 6, 6, 7, 8,
8, 9, 9, 10, 12, 12, 12, 13, 14, 15,
16, 17, 18, 19, 19, 20, 21, 22, 24, 25
};
static const char qr_blocks_M[] = {
1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20,
21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49
static const char qr_blocks_M[40] = {
1, 1, 1, 2, 2, 4, 4, 4, 5, 5,
5, 8, 9, 9, 10, 10, 11, 13, 14, 16,
17, 17, 18, 20, 21, 23, 25, 26, 28, 29,
31, 33, 35, 37, 38, 40, 43, 45, 47, 49
};
static const char qr_blocks_Q[] = {
1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25,
27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68
static const char qr_blocks_Q[40] = {
1, 1, 2, 2, 4, 4, 6, 6, 8, 8,
8, 10, 12, 16, 12, 17, 16, 18, 21, 20,
23, 23, 25, 27, 29, 34, 34, 35, 38, 40,
43, 45, 48, 51, 53, 56, 59, 62, 65, 68
};
static const char qr_blocks_H[] = {
1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30,
32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81
static const char qr_blocks_H[40] = {
1, 1, 2, 4, 4, 4, 5, 6, 8, 8,
11, 11, 16, 16, 18, 16, 19, 21, 25, 25,
25, 34, 30, 32, 35, 37, 40, 42, 45, 48,
51, 54, 57, 60, 63, 66, 70, 74, 77, 81
};
static const char rmqr_blocks_M[] = {
/* From ISO/IEC 23941:2022 Table 8 - Error correction characteristics for rMQR */
static const char rmqr_blocks_M[32] = {
1, 1, 1, 1, 1, /* R7x */
1, 1, 1, 1, 2, /* R9x */
1, 1, 1, 1, 2, 2, /* R11x */
@ -188,7 +208,7 @@ static const char rmqr_blocks_M[] = {
1, 2, 2, 3, 4 /* R17x */
};
static const char rmqr_blocks_H[] = {
static const char rmqr_blocks_H[32] = {
1, 1, 1, 1, 2, /* R7x */
1, 1, 2, 2, 3, /* R9x */
1, 1, 2, 2, 2, 3, /* R11x */
@ -197,54 +217,61 @@ static const char rmqr_blocks_H[] = {
2, 2, 3, 4, 6 /* R17x */
};
static const unsigned short qr_sizes[] = {
21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177
/* From ISO/IEC 18004:2015 Table 1 - Codeword capacity of all versions of QRCode */
static const unsigned char qr_sizes[40] = {
21, 25, 29, 33, 37, 41, 45, 49, 53, 57,
61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
101, 105, 109, 113, 117, 121, 125, 129, 133, 137,
141, 145, 149, 153, 157, 161, 165, 169, 173, 177
};
static const char micro_qr_sizes[] = {
static const char micro_qr_sizes[4] = {
11, 13, 15, 17
};
static const char qr_align_loopsize[] = {
0, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7
/* No. of entries in `qr_table_e1` (Table E.1) per version */
static const char qr_align_loopsize[40] = {
0, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 6, 6, 6,
6, 6, 6, 6, 7, 7, 7, 7, 7, 7
};
/* Table E1 - Row/column coordinates of center module of alignment patterns */
static const unsigned short qr_table_e1[] = {
6, 18, 0, 0, 0, 0, 0,
6, 22, 0, 0, 0, 0, 0,
6, 26, 0, 0, 0, 0, 0,
6, 30, 0, 0, 0, 0, 0,
6, 34, 0, 0, 0, 0, 0,
6, 22, 38, 0, 0, 0, 0,
6, 24, 42, 0, 0, 0, 0,
6, 26, 46, 0, 0, 0, 0,
6, 28, 50, 0, 0, 0, 0,
6, 30, 54, 0, 0, 0, 0,
6, 32, 58, 0, 0, 0, 0,
6, 34, 62, 0, 0, 0, 0,
6, 26, 46, 66, 0, 0, 0,
6, 26, 48, 70, 0, 0, 0,
6, 26, 50, 74, 0, 0, 0,
6, 30, 54, 78, 0, 0, 0,
6, 30, 56, 82, 0, 0, 0,
6, 30, 58, 86, 0, 0, 0,
6, 34, 62, 90, 0, 0, 0,
6, 28, 50, 72, 94, 0, 0,
6, 26, 50, 74, 98, 0, 0,
6, 30, 54, 78, 102, 0, 0,
6, 28, 54, 80, 106, 0, 0,
6, 32, 58, 84, 110, 0, 0,
6, 30, 58, 86, 114, 0, 0,
6, 34, 62, 90, 118, 0, 0,
6, 26, 50, 74, 98, 122, 0,
6, 30, 54, 78, 102, 126, 0,
6, 26, 52, 78, 104, 130, 0,
6, 30, 56, 82, 108, 134, 0,
6, 34, 60, 86, 112, 138, 0,
6, 30, 58, 86, 114, 142, 0,
6, 34, 62, 90, 118, 146, 0,
/* Table E.1 - Row/column coordinates of center module of alignment patterns */
static const unsigned char qr_table_e1[40 * 7] = {
6, 18, 0, 0, 0, 0, 0,
6, 22, 0, 0, 0, 0, 0,
6, 26, 0, 0, 0, 0, 0,
6, 30, 0, 0, 0, 0, 0,
6, 34, 0, 0, 0, 0, 0,
6, 22, 38, 0, 0, 0, 0,
6, 24, 42, 0, 0, 0, 0,
6, 26, 46, 0, 0, 0, 0,
6, 28, 50, 0, 0, 0, 0,
6, 30, 54, 0, 0, 0, 0,
6, 32, 58, 0, 0, 0, 0,
6, 34, 62, 0, 0, 0, 0,
6, 26, 46, 66, 0, 0, 0,
6, 26, 48, 70, 0, 0, 0,
6, 26, 50, 74, 0, 0, 0,
6, 30, 54, 78, 0, 0, 0,
6, 30, 56, 82, 0, 0, 0,
6, 30, 58, 86, 0, 0, 0,
6, 34, 62, 90, 0, 0, 0,
6, 28, 50, 72, 94, 0, 0,
6, 26, 50, 74, 98, 0, 0,
6, 30, 54, 78, 102, 0, 0,
6, 28, 54, 80, 106, 0, 0,
6, 32, 58, 84, 110, 0, 0,
6, 30, 58, 86, 114, 0, 0,
6, 34, 62, 90, 118, 0, 0,
6, 26, 50, 74, 98, 122, 0,
6, 30, 54, 78, 102, 126, 0,
6, 26, 52, 78, 104, 130, 0,
6, 30, 56, 82, 108, 134, 0,
6, 34, 60, 86, 112, 138, 0,
6, 30, 58, 86, 114, 142, 0,
6, 34, 62, 90, 118, 146, 0,
6, 30, 54, 78, 102, 126, 150,
6, 24, 50, 76, 102, 128, 154,
6, 28, 54, 80, 106, 132, 158,
@ -253,39 +280,41 @@ static const unsigned short qr_table_e1[] = {
6, 30, 58, 86, 114, 142, 170
};
/* Table D1 - Column coordinates of centre module of alignment patterns */
static const unsigned short rmqr_table_d1[] = {
21, 0, 0, 0,
19, 39, 0, 0,
25, 51, 0, 0,
23, 49, 75, 0,
/* Table D.1 - Column coordinates of centre module of alignment patterns */
static const unsigned char rmqr_table_d1[20] = {
21, 0, 0, 0,
19, 39, 0, 0,
25, 51, 0, 0,
23, 49, 75, 0,
27, 55, 83, 111
};
static const unsigned int qr_annex_c[] = {
/* Format information bit sequences */
0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, 0x77c4, 0x72f3, 0x7daa, 0x789d,
0x662f, 0x6318, 0x6c41, 0x6976, 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b,
0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed
/* Format information bit sequences */
static const unsigned short qr_annex_c[32] = {
0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, 0x77c4, 0x72f3,
0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, 0x1689, 0x13be, 0x1ce7, 0x19d0,
0x0762, 0x0255, 0x0d0c, 0x083b, 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183,
0x2eda, 0x2bed
};
static const unsigned int qr_annex_d[] = {
/* Version information bit sequences */
/* Version information bit sequences */
static const unsigned int qr_annex_d[34] = {
0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, 0x0f928, 0x10b78,
0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, 0x177ec, 0x18ec4, 0x191e1, 0x1afab,
0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b,
0x2542e, 0x26a64, 0x27541, 0x28c69
};
static const unsigned int qr_annex_c1[] = {
/* Micro QR Code format information */
0x4445, 0x4172, 0x4e2b, 0x4b1c, 0x55ae, 0x5099, 0x5fc0, 0x5af7, 0x6793, 0x62a4, 0x6dfd, 0x68ca, 0x7678, 0x734f,
0x7c16, 0x7921, 0x06de, 0x03e9, 0x0cb0, 0x0987, 0x1735, 0x1202, 0x1d5b, 0x186c, 0x2508, 0x203f, 0x2f66, 0x2a51, 0x34e3,
0x31d4, 0x3e8d, 0x3bba
/* Micro QR Code format information */
static const unsigned short qr_annex_c1[32] = {
0x4445, 0x4172, 0x4e2b, 0x4b1c, 0x55ae, 0x5099, 0x5fc0, 0x5af7, 0x6793, 0x62a4,
0x6dfd, 0x68ca, 0x7678, 0x734f, 0x7c16, 0x7921, 0x06de, 0x03e9, 0x0cb0, 0x0987,
0x1735, 0x1202, 0x1d5b, 0x186c, 0x2508, 0x203f, 0x2f66, 0x2a51, 0x34e3, 0x31d4,
0x3e8d, 0x3bba
};
static const unsigned int rmqr_format_info_left[] = {
/* rMQR format information for finder pattern side */
/* rMQR format information for finder pattern side */
static const unsigned int rmqr_format_info_left[64] = {
0x1FAB2, 0x1E597, 0x1DBDD, 0x1C4F8, 0x1B86C, 0x1A749, 0x19903, 0x18626, 0x17F0E, 0x1602B,
0x15E61, 0x14144, 0x13DD0, 0x122F5, 0x11CBF, 0x1039A, 0x0F1CA, 0x0EEEF, 0x0D0A5, 0x0CF80,
0x0B314, 0x0AC31, 0x0927B, 0x08D5E, 0x07476, 0x06B53, 0x05519, 0x04A3C, 0x036A8, 0x0298D,
@ -295,8 +324,8 @@ static const unsigned int rmqr_format_info_left[] = {
0x23F7D, 0x22058, 0x21E12, 0x20137
};
static const unsigned int rmqr_format_info_right[] = {
/* rMQR format information for subfinder pattern side */
/* rMQR format information for subfinder pattern side */
static const unsigned int rmqr_format_info_right[64] = {
0x20A7B, 0x2155E, 0x22B14, 0x23431, 0x248A5, 0x25780, 0x269CA, 0x276EF, 0x28FC7, 0x290E2,
0x2AEA8, 0x2B18D, 0x2CD19, 0x2D23C, 0x2EC76, 0x2F353, 0x30103, 0x31E26, 0x3206C, 0x33F49,
0x343DD, 0x35CF8, 0x362B2, 0x37D97, 0x384BF, 0x39B9A, 0x3A5D0, 0x3BAF5, 0x3C661, 0x3D944,

View file

@ -1,7 +1,7 @@
/* rss.c - GS1 DataBar (formerly Reduced Space Symbology) */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -390,35 +390,35 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
data_group[2] = 4;
}
v_odd[0] = (data_character[0] - g_sum_table[data_group[0]]) / t_table[data_group[0]];
v_even[0] = (data_character[0] - g_sum_table[data_group[0]]) % t_table[data_group[0]];
v_odd[1] = (data_character[1] - g_sum_table[data_group[1]]) % t_table[data_group[1]];
v_even[1] = (data_character[1] - g_sum_table[data_group[1]]) / t_table[data_group[1]];
v_odd[3] = (data_character[3] - g_sum_table[data_group[3]]) % t_table[data_group[3]];
v_even[3] = (data_character[3] - g_sum_table[data_group[3]]) / t_table[data_group[3]];
v_odd[2] = (data_character[2] - g_sum_table[data_group[2]]) / t_table[data_group[2]];
v_even[2] = (data_character[2] - g_sum_table[data_group[2]]) % t_table[data_group[2]];
v_odd[0] = (data_character[0] - dbar_g_sum_table[data_group[0]]) / dbar_t_table[data_group[0]];
v_even[0] = (data_character[0] - dbar_g_sum_table[data_group[0]]) % dbar_t_table[data_group[0]];
v_odd[1] = (data_character[1] - dbar_g_sum_table[data_group[1]]) % dbar_t_table[data_group[1]];
v_even[1] = (data_character[1] - dbar_g_sum_table[data_group[1]]) / dbar_t_table[data_group[1]];
v_odd[3] = (data_character[3] - dbar_g_sum_table[data_group[3]]) % dbar_t_table[data_group[3]];
v_even[3] = (data_character[3] - dbar_g_sum_table[data_group[3]]) / dbar_t_table[data_group[3]];
v_odd[2] = (data_character[2] - dbar_g_sum_table[data_group[2]]) / dbar_t_table[data_group[2]];
v_even[2] = (data_character[2] - dbar_g_sum_table[data_group[2]]) % dbar_t_table[data_group[2]];
/* Use DataBar subset width algorithm */
for (i = 0; i < 4; i++) {
if ((i == 0) || (i == 2)) {
getRSSwidths(widths, v_odd[i], modules_odd[data_group[i]], 4, widest_odd[data_group[i]], 1);
getRSSwidths(widths, v_odd[i], dbar_modules_odd[data_group[i]], 4, dbar_widest_odd[data_group[i]], 1);
data_widths[0][i] = widths[0];
data_widths[2][i] = widths[1];
data_widths[4][i] = widths[2];
data_widths[6][i] = widths[3];
getRSSwidths(widths, v_even[i], modules_even[data_group[i]], 4, widest_even[data_group[i]], 0);
getRSSwidths(widths, v_even[i], dbar_modules_even[data_group[i]], 4, dbar_widest_even[data_group[i]], 0);
data_widths[1][i] = widths[0];
data_widths[3][i] = widths[1];
data_widths[5][i] = widths[2];
data_widths[7][i] = widths[3];
} else {
getRSSwidths(widths, v_odd[i], modules_odd[data_group[i]], 4, widest_odd[data_group[i]], 0);
getRSSwidths(widths, v_odd[i], dbar_modules_odd[data_group[i]], 4, dbar_widest_odd[data_group[i]], 0);
data_widths[0][i] = widths[0];
data_widths[2][i] = widths[1];
data_widths[4][i] = widths[2];
data_widths[6][i] = widths[3];
getRSSwidths(widths, v_even[i], modules_even[data_group[i]], 4, widest_even[data_group[i]], 1);
getRSSwidths(widths, v_even[i], dbar_modules_even[data_group[i]], 4, dbar_widest_even[data_group[i]], 1);
data_widths[1][i] = widths[0];
data_widths[3][i] = widths[1];
data_widths[5][i] = widths[2];
@ -429,10 +429,10 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
checksum = 0;
/* Calculate the checksum */
for (i = 0; i < 8; i++) {
checksum += checksum_weight[i] * data_widths[i][0];
checksum += checksum_weight[i + 8] * data_widths[i][1];
checksum += checksum_weight[i + 16] * data_widths[i][2];
checksum += checksum_weight[i + 24] * data_widths[i][3];
checksum += dbar_checksum_weight[i] * data_widths[i][0];
checksum += dbar_checksum_weight[i + 8] * data_widths[i][1];
checksum += dbar_checksum_weight[i + 16] * data_widths[i][2];
checksum += dbar_checksum_weight[i + 24] * data_widths[i][3];
}
checksum %= 79;
@ -462,8 +462,8 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
total_widths[i + 36] = data_widths[7 - i][2];
}
for (i = 0; i < 5; i++) {
total_widths[i + 10] = finder_pattern[i + (5 * c_left)];
total_widths[i + 31] = finder_pattern[(4 - i) + (5 * c_right)];
total_widths[i + 10] = dbar_finder_pattern[i + (5 * c_left)];
total_widths[i + 31] = dbar_finder_pattern[(4 - i) + (5 * c_right)];
}
/* Put this data into the symbol */
@ -720,24 +720,24 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int
right_group = 0;
}
left_odd = (int) (left_character / t_even_ltd[left_group]);
left_even = (int) (left_character % t_even_ltd[left_group]);
right_odd = (int) (right_character / t_even_ltd[right_group]);
right_even = (int) (right_character % t_even_ltd[right_group]);
left_odd = (int) (left_character / dbar_ltd_t_even[left_group]);
left_even = (int) (left_character % dbar_ltd_t_even[left_group]);
right_odd = (int) (right_character / dbar_ltd_t_even[right_group]);
right_even = (int) (right_character % dbar_ltd_t_even[right_group]);
getRSSwidths(widths, left_odd, modules_odd_ltd[left_group], 7, widest_odd_ltd[left_group], 1);
getRSSwidths(widths, left_odd, dbar_ltd_modules_odd[left_group], 7, dbar_ltd_widest_odd[left_group], 1);
for (i = 0; i <= 6; i++) {
left_widths[i * 2] = widths[i];
}
getRSSwidths(widths, left_even, modules_even_ltd[left_group], 7, widest_even_ltd[left_group], 0);
getRSSwidths(widths, left_even, dbar_ltd_modules_even[left_group], 7, dbar_ltd_widest_even[left_group], 0);
for (i = 0; i <= 6; i++) {
left_widths[i * 2 + 1] = widths[i];
}
getRSSwidths(widths, right_odd, modules_odd_ltd[right_group], 7, widest_odd_ltd[right_group], 1);
getRSSwidths(widths, right_odd, dbar_ltd_modules_odd[right_group], 7, dbar_ltd_widest_odd[right_group], 1);
for (i = 0; i <= 6; i++) {
right_widths[i * 2] = widths[i];
}
getRSSwidths(widths, right_even, modules_even_ltd[right_group], 7, widest_even_ltd[right_group], 0);
getRSSwidths(widths, right_even, dbar_ltd_modules_even[right_group], 7, dbar_ltd_widest_even[right_group], 0);
for (i = 0; i <= 6; i++) {
right_widths[i * 2 + 1] = widths[i];
}
@ -748,13 +748,13 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int
#if defined(_MSC_VER) && _MSC_VER == 1900 && defined(_WIN64) /* MSVC 2015 x64 */
checksum %= 89; /* Hack to get around optimizer bug */
#endif
checksum += checksum_weight_ltd[i] * left_widths[i];
checksum += checksum_weight_ltd[i + 14] * right_widths[i];
checksum += dbar_ltd_checksum_weight[i] * left_widths[i];
checksum += dbar_ltd_checksum_weight[i + 14] * right_widths[i];
}
checksum %= 89;
for (i = 0; i < 14; i++) {
check_elements[i] = finder_pattern_ltd[i + (checksum * 14)];
check_elements[i] = dbar_ltd_finder_pattern[i + (checksum * 14)];
}
total_widths[0] = 1;
@ -1350,16 +1350,16 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
} else {
group = 5;
}
v_odd = (vs - g_sum_exp[group - 1]) / t_even_exp[group - 1];
v_even = (vs - g_sum_exp[group - 1]) % t_even_exp[group - 1];
v_odd = (vs - dbar_exp_g_sum[group - 1]) / dbar_exp_t_even[group - 1];
v_even = (vs - dbar_exp_g_sum[group - 1]) % dbar_exp_t_even[group - 1];
if (debug_print) printf("%s%d", i == 0 || (i & 1) ? " " : ",", vs);
getRSSwidths(widths, v_odd, modules_odd_exp[group - 1], 4, widest_odd_exp[group - 1], 0);
getRSSwidths(widths, v_odd, dbar_exp_modules_odd[group - 1], 4, dbar_exp_widest_odd[group - 1], 0);
char_widths[i][0] = widths[0];
char_widths[i][2] = widths[1];
char_widths[i][4] = widths[2];
char_widths[i][6] = widths[3];
getRSSwidths(widths, v_even, modules_even_exp[group - 1], 4, widest_even_exp[group - 1], 1);
getRSSwidths(widths, v_even, dbar_exp_modules_even[group - 1], 4, dbar_exp_widest_even[group - 1], 1);
char_widths[i][1] = widths[0];
char_widths[i][3] = widths[1];
char_widths[i][5] = widths[2];
@ -1372,9 +1372,9 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
elements in the data characters. */
checksum = 0;
for (i = 0; i < data_chars; i++) {
int row = weight_rows[(((data_chars - 2) / 2) * 21) + i];
int row = dbar_exp_weight_rows[(((data_chars - 2) / 2) * 21) + i];
for (j = 0; j < 8; j++) {
checksum += (char_widths[i][j] * checksum_weight_exp[(row * 8) + j]);
checksum += (char_widths[i][j] * dbar_exp_checksum_weight[(row * 8) + j]);
}
}
@ -1397,15 +1397,15 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
c_group = 5;
}
c_odd = (check_char - g_sum_exp[c_group - 1]) / t_even_exp[c_group - 1];
c_even = (check_char - g_sum_exp[c_group - 1]) % t_even_exp[c_group - 1];
c_odd = (check_char - dbar_exp_g_sum[c_group - 1]) / dbar_exp_t_even[c_group - 1];
c_even = (check_char - dbar_exp_g_sum[c_group - 1]) % dbar_exp_t_even[c_group - 1];
getRSSwidths(widths, c_odd, modules_odd_exp[c_group - 1], 4, widest_odd_exp[c_group - 1], 0);
getRSSwidths(widths, c_odd, dbar_exp_modules_odd[c_group - 1], 4, dbar_exp_widest_odd[c_group - 1], 0);
check_widths[0] = widths[0];
check_widths[2] = widths[1];
check_widths[4] = widths[2];
check_widths[6] = widths[3];
getRSSwidths(widths, c_even, modules_even_exp[c_group - 1], 4, widest_even_exp[c_group - 1], 1);
getRSSwidths(widths, c_even, dbar_exp_modules_even[c_group - 1], 4, dbar_exp_widest_even[c_group - 1], 1);
check_widths[1] = widths[0];
check_widths[3] = widths[1];
check_widths[5] = widths[2];
@ -1421,7 +1421,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
for (i = 0; i < codeblocks; i++) {
k = p + i;
for (j = 0; j < 5; j++) {
elements[(21 * i) + j + 10] = finder_pattern_exp[((finder_sequence[k] - 1) * 5) + j];
elements[(21 * i) + j + 10] = dbar_exp_finder_pattern[((dbar_exp_finder_sequence[k] - 1) * 5) + j];
}
}

View file

@ -1,7 +1,7 @@
/* rss.h - Data tables for Reduced Space Symbology */
/*
libzint - the open source barcode library
Copyright (C) 2007-2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2007-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -34,31 +34,31 @@
#define Z_RSS_H
/* RSS-14 Tables */
static const unsigned short g_sum_table[9] = {
static const unsigned short dbar_g_sum_table[9] = {
0, 161, 961, 2015, 2715, 0, 336, 1036, 1516
};
static const char t_table[9] = {
static const char dbar_t_table[9] = {
1, 10, 34, 70, 126, 4, 20, 48, 81
};
static const char modules_odd[9] = {
static const char dbar_modules_odd[9] = {
12, 10, 8, 6, 4, 5, 7, 9, 11
};
static const char modules_even[9] = {
static const char dbar_modules_even[9] = {
4, 6, 8, 10, 12, 10, 8, 6, 4
};
static const char widest_odd[9] = {
static const char dbar_widest_odd[9] = {
8, 6, 4, 3, 1, 2, 4, 6, 8
};
static const char widest_even[9] = {
static const char dbar_widest_even[9] = {
1, 3, 5, 6, 8, 7, 5, 3, 1
};
static const char finder_pattern[45] = {
static const char dbar_finder_pattern[45] = {
3, 8, 2, 1, 1,
3, 5, 5, 1, 1,
3, 3, 7, 1, 1,
@ -70,42 +70,42 @@ static const char finder_pattern[45] = {
1, 3, 9, 1, 1
};
static const char checksum_weight[32] = {
/* Table 5 */
1, 3, 9, 27, 2, 6, 18, 54,
4, 12, 36, 29, 8, 24, 72, 58,
/* Table 5 */
static const char dbar_checksum_weight[32] = {
1, 3, 9, 27, 2, 6, 18, 54,
4, 12, 36, 29, 8, 24, 72, 58,
16, 48, 65, 37, 32, 17, 51, 74,
64, 34, 23, 69, 49, 68, 46, 59
};
/* RSS Limited Tables */
static const unsigned short t_even_ltd[7] = {
static const unsigned short dbar_ltd_t_even[7] = {
28, 728, 6454, 203, 2408, 1, 16632
};
static const char modules_odd_ltd[7] = {
static const char dbar_ltd_modules_odd[7] = {
17, 13, 9, 15, 11, 19, 7
};
static const char modules_even_ltd[7] = {
static const char dbar_ltd_modules_even[7] = {
9, 13, 17, 11, 15, 7, 19
};
static const char widest_odd_ltd[7] = {
static const char dbar_ltd_widest_odd[7] = {
6, 5, 3, 5, 4, 8, 1
};
static const char widest_even_ltd[7] = {
static const char dbar_ltd_widest_even[7] = {
3, 4, 6, 4, 5, 1, 8
};
static const char checksum_weight_ltd[28] = {
/* Table 7 */
1, 3, 9, 27, 81, 65, 17, 51, 64, 14, 42, 37, 22, 66,
20, 60, 2, 6, 18, 54, 73, 41, 34, 13, 39, 28, 84, 74
/* Table 7 */
static const char dbar_ltd_checksum_weight[28] = {
1, 3, 9, 27, 81, 65, 17, 51, 64, 14, 42, 37, 22, 66,
20, 60, 2, 6, 18, 54, 73, 41, 34, 13, 39, 28, 84, 74
};
static const char finder_pattern_ltd[1246] = {
static const char dbar_ltd_finder_pattern[1246] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1,
@ -198,59 +198,59 @@ static const char finder_pattern_ltd[1246] = {
};
/* RSS Expanded Tables */
static const unsigned short g_sum_exp[5] = {
static const unsigned short dbar_exp_g_sum[5] = {
0, 348, 1388, 2948, 3988
};
static const unsigned short t_even_exp[5] = {
static const unsigned char dbar_exp_t_even[5] = {
4, 20, 52, 104, 204
};
static const char modules_odd_exp[5] = {
static const char dbar_exp_modules_odd[5] = {
12, 10, 8, 6, 4
};
static const char modules_even_exp[5] = {
static const char dbar_exp_modules_even[5] = {
5, 7, 9, 11, 13
};
static const char widest_odd_exp[5] = {
static const char dbar_exp_widest_odd[5] = {
7, 5, 4, 3, 1
};
static const char widest_even_exp[5] = {
static const char dbar_exp_widest_even[5] = {
2, 4, 5, 6, 8
};
static const unsigned short checksum_weight_exp[184] = {
/* Table 14 */
1, 3, 9, 27, 81, 32, 96, 77,
20, 60, 180, 118, 143, 7, 21, 63,
189, 145, 13, 39, 117, 140, 209, 205,
193, 157, 49, 147, 19, 57, 171, 91,
62, 186, 136, 197, 169, 85, 44, 132,
185, 133, 188, 142, 4, 12, 36, 108,
113, 128, 173, 97, 80, 29, 87, 50,
150, 28, 84, 41, 123, 158, 52, 156,
46, 138, 203, 187, 139, 206, 196, 166,
76, 17, 51, 153, 37, 111, 122, 155,
43, 129, 176, 106, 107, 110, 119, 146,
16, 48, 144, 10, 30, 90, 59, 177,
static const unsigned char dbar_exp_checksum_weight[184] = {
1, 3, 9, 27, 81, 32, 96, 77,
20, 60, 180, 118, 143, 7, 21, 63,
189, 145, 13, 39, 117, 140, 209, 205,
193, 157, 49, 147, 19, 57, 171, 91,
62, 186, 136, 197, 169, 85, 44, 132,
185, 133, 188, 142, 4, 12, 36, 108,
113, 128, 173, 97, 80, 29, 87, 50,
150, 28, 84, 41, 123, 158, 52, 156,
46, 138, 203, 187, 139, 206, 196, 166,
76, 17, 51, 153, 37, 111, 122, 155,
43, 129, 176, 106, 107, 110, 119, 146,
16, 48, 144, 10, 30, 90, 59, 177,
109, 116, 137, 200, 178, 112, 125, 164,
70, 210, 208, 202, 184, 130, 179, 115,
134, 191, 151, 31, 93, 68, 204, 190,
148, 22, 66, 198, 172, 94, 71, 2,
6, 18, 54, 162, 64, 192, 154, 40,
120, 149, 25, 75, 14, 42, 126, 167,
79, 26, 78, 23, 69, 207, 199, 175,
103, 98, 83, 38, 114, 131, 182, 124,
161, 61, 183, 127, 170, 88, 53, 159,
55, 165, 73, 8, 24, 72, 5, 15,
45, 135, 194, 160, 58, 174, 100, 89
70, 210, 208, 202, 184, 130, 179, 115,
134, 191, 151, 31, 93, 68, 204, 190,
148, 22, 66, 198, 172, 94, 71, 2,
6, 18, 54, 162, 64, 192, 154, 40,
120, 149, 25, 75, 14, 42, 126, 167,
79, 26, 78, 23, 69, 207, 199, 175,
103, 98, 83, 38, 114, 131, 182, 124,
161, 61, 183, 127, 170, 88, 53, 159,
55, 165, 73, 8, 24, 72, 5, 15,
45, 135, 194, 160, 58, 174, 100, 89
};
static const char finder_pattern_exp[60] = {
/* Table 15 */
/* Table 15 */
static const char dbar_exp_finder_pattern[60] = {
1, 8, 4, 1, 1,
1, 1, 4, 8, 1,
3, 6, 4, 1, 1,
@ -265,31 +265,31 @@ static const char finder_pattern_exp[60] = {
1, 1, 9, 2, 2
};
static const char finder_sequence[198] = {
/* Table 16 */
1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0,
1, 6, 3, 8, 0, 0, 0, 0, 0, 0, 0,
1, 10, 3, 8, 5, 0, 0, 0, 0, 0, 0,
1, 10, 3, 8, 7, 12, 0, 0, 0, 0, 0,
1, 10, 3, 8, 9, 12, 11, 0, 0, 0, 0,
1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0,
1, 2, 3, 4, 5, 6, 7, 10, 9, 0, 0,
1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 0,
1, 2, 3, 4, 5, 8, 7, 10, 9, 12, 11
/* Table 16 */
static const char dbar_exp_finder_sequence[198] = {
1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0,
1, 6, 3, 8, 0, 0, 0, 0, 0, 0, 0,
1, 10, 3, 8, 5, 0, 0, 0, 0, 0, 0,
1, 10, 3, 8, 7, 12, 0, 0, 0, 0, 0,
1, 10, 3, 8, 9, 12, 11, 0, 0, 0, 0,
1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0,
1, 2, 3, 4, 5, 6, 7, 10, 9, 0, 0,
1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 0,
1, 2, 3, 4, 5, 8, 7, 10, 9, 12, 11
};
static const char weight_rows[210] = {
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 5, 6, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 9, 10, 3, 4, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 18, 3, 4, 13, 14, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 18, 3, 4, 13, 14, 11, 12, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 18, 3, 4, 13, 14, 15, 16, 21, 22, 19, 20, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 18, 15, 16, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 18, 19, 20, 21, 22, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 11, 12, 17, 18, 15, 16, 21, 22, 19, 20
static const char dbar_exp_weight_rows[210] = {
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 5, 6, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 9, 10, 3, 4, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 18, 3, 4, 13, 14, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 18, 3, 4, 13, 14, 11, 12, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 18, 3, 4, 13, 14, 15, 16, 21, 22, 19, 20, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 18, 15, 16, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 18, 19, 20, 21, 22, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 11, 12, 17, 18, 15, 16, 21, 22, 19, 20
};
/* vim: set ts=4 sw=4 et : */

View file

@ -349,7 +349,7 @@ static void test_input(const testCtx *const p_ctx) {
/* 57*/ { UNICODE_MODE, "aééééébcdeééé", -1, 0, 244, 1, "(22) 104 65 100 100 73 73 73 73 73 100 66 100 67 100 68 100 69 73 73 73 83 106", "StartB a Latch é (5) Shift b Shift c Shift d Shift e é (3)" },
/* 58*/ { UNICODE_MODE, "aééééébcdefééé", -1, 0, 255, 1, "(23) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 70 100 100 73 73 73 67 106", "StartB a Latch é (5) Unlatch b c d e f Latch é (3)" },
/* 59*/ { DATA_MODE, "\200\200\200\200\200\101\060\060\060\060\101\200", -1, 0, 222, 1, "(20) 103 101 101 64 64 64 64 64 101 101 33 99 0 0 101 33 101 64 73 106", "StartA Latch PAD (4) Unlatch A CodeC 00 00 CodeA A FNC4 PAD" },
/* 60*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999", -1, 0, 211, 0, "(19) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 63 106", "Okapi code129/extended-mode-exit-before-code-set-c.png (chose different solution); BWIPP different encodation" },
/* 60*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999", -1, 0, 211, 0, "(19) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 63 106", "Okapi code128/extended-mode-exit-before-code-set-c.png (chose different solution); BWIPP different encodation" },
/* 61*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 233, 0, "(21) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 100 33 91 106", "Above with trailing non-shifted (as still latched) extended; BWIPP different encodation" },
/* 62*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "@g(\302\302\302\302\3025555\302\302\302\302\302\302\302\302", -1, 0, 277, 0, "(25) 104 32 71 8 100 100 34 34 34 34 34 99 55 55 100 34 34 34 34 34 34 34 34 25 106", "Okapi code128/extended-mode-with-short-embedded-code-set-c.png (chose different solution); BWIPP different encodation" },
/* 63*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "@g(\302\302\302\302\302555555\302\302\302\302\302\302\302", -1, 0, 277, 0, "(25) 104 32 71 8 100 100 34 34 34 34 34 99 55 55 55 100 34 34 34 34 34 34 34 76 106", "Above with extra 55 instead of \xC2; BWIPP different encodation" },

View file

@ -42,7 +42,7 @@
# endif
# if defined(__clang__)
# pragma GCC diagnostic ignored "-Wformat-non-iso"
# elif defined(__GNUC__)
# elif defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
# pragma GCC diagnostic ignored "-Wformat" /* Doesn't seem to be way to only avoid non-ISO warnings */
# endif
#elif (defined(__WORDSIZE) && __WORDSIZE == 32) || (defined(ULONG_MAX) && ULONG_MAX <= 0xFFFFFFFF) \

View file

@ -64,7 +64,7 @@ static const char *testFunc = NULL;
/* Visual C++ 6 doesn't support variadic args to macros, so make do with functions, which have inferior behaviour,
e.g. don't exit on failure, `assert_equal()` type-specific */
#if (defined(_MSC_VER) && _MSC_VER == 1200) || defined(ZINT_IS_C89) /* VC6 or C89 */
#if (defined(_MSC_VER) && _MSC_VER <= 1200) || defined(ZINT_IS_C89) /* VC6 or C89 */
#include <stdarg.h>
void assert_zero(int exp, const char *fmt, ...) {
assertionNum++;
@ -3895,7 +3895,7 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
return 0;
}
INTERNAL int escape_char_process_test(struct zint_symbol *symbol, unsigned char *input_string, int *length,
INTERNAL int escape_char_process_test(struct zint_symbol *symbol, const unsigned char *input_string, int *length,
unsigned char *escaped_string);
#include "../gs1.h"

View file

@ -65,7 +65,7 @@ extern "C" {
#define testutil_pclose(stream) pclose(stream)
#endif
#if defined(__clang__) || defined(__GNUC__)
#if defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wpedantic"
# pragma GCC diagnostic ignored "-Woverlength-strings"
#elif defined(_MSC_VER)
@ -105,7 +105,7 @@ typedef struct s_testFunction {
void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size);
int testContinue(const testCtx *const p_ctx, const int i);
#if (defined(_MSC_VER) &&_MSC_VER == 1200) || defined(ZINT_IS_C89) /* VC6 or C89 */
#if (defined(_MSC_VER) &&_MSC_VER <= 1200) || defined(ZINT_IS_C89) /* VC6 or C89 */
void assert_zero(int exp, const char *fmt, ...);
void assert_nonzero(int exp, const char *fmt, ...);
void assert_null(const void *exp, const char *fmt, ...);

View file

@ -115,7 +115,7 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
(void) out_colour_get_rgb(symbol->bgcolour, &bg[0], &bg[1], &bg[2], &bg[3]);
if (symbol->symbology == BARCODE_ULTRA) {
static const int ultra_chars[8] = { 'W', 'C', 'B', 'M', 'R', 'Y', 'G', 'K' };
static const unsigned char ultra_chars[8] = { 'W', 'C', 'B', 'M', 'R', 'Y', 'G', 'K' };
if (symbol->output_options & CMYK_COLOUR) {
static const unsigned char ultra_cmyks[8][4] = {

View file

@ -2,9 +2,9 @@
/* Generate mod 928 powers table for `encode928()` in "composite.c" */
/*
libzint - the open source barcode library
Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
/* The functions "getBit", "init928" and "encode928" are copyright BSI and are
released with permission under the following terms:
@ -35,7 +35,7 @@ for ($j = 1; $j < 69; $j++) {
$pwr928[$j][0] = $cw[0] = (2 * $cw[0]) + (int)($v / 928);
}
printf("static const UINT pwr928[69][7] = {\n");
printf("static const unsigned short cc_pwr928[69][7] = {\n");
for ($i = 0; $i < 69; $i++) {
printf(" { ");
for ($j = 0; $j < 7; $j++) {
@ -44,3 +44,5 @@ for ($i = 0; $i < 69; $i++) {
printf("},\n");
}
printf("};\n");
/* vim: set ts=4 sw=4 et : */

View file

@ -1,7 +1,7 @@
/* ultra.c - Ultracode */
/*
libzint - the open source barcode library
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -58,11 +58,11 @@ static const char ult_colour[] = "0CBMRYGKW";
/* Max size and min cols adjusted to BWIPP values as updated 2021-07-14
https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc */
static const int ult_maxsize[] = {37, 84, 161, 282};
static const short ult_maxsize[] = { 37, 84, 161, 282 };
static const int ult_mincols[] = {5, 13, 22, 29};
static const char ult_mincols[] = { 5, 13, 22, 29 };
static const int ult_kec[] = {0, 1, 2, 4, 6, 8}; /* Value K(EC) from Table 12 */
static const char ult_kec[] = { 0, 1, 2, 4, 6, 8 }; /* Value K(EC) from Table 12 */
/* Taken from BWIPP - change in DCCU/DCCL tiles for revision 2 2021-09-28 */
static const unsigned short ult_dccu[2][32] = {
@ -95,7 +95,7 @@ static const unsigned short ult_dccl[2][32] = {
},
};
static const int ult_tiles[] = {
static const unsigned short ult_tiles[] = {
013135, 013136, 013153, 013156, 013163, 013165, 013513, 013515, 013516, 013531, /* 0-9 */
013535, 013536, 013561, 013563, 013565, 013613, 013615, 013616, 013631, 013635, /* 10-19 */
013636, 013651, 013653, 013656, 015135, 015136, 015153, 015163, 015165, 015313, /* 20-29 */

View file

@ -1,7 +1,7 @@
/* zint.h - definitions for libzint */
/*
libzint - the open source barcode library
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -378,7 +378,7 @@ extern "C" {
# define ZINT_EXTERN extern
# endif
#elif defined(__GNUC__) && __GNUC__ >= 4
# define ZINT_EXTERN extern __attribute__((visibility("default")))
# define ZINT_EXTERN extern __attribute__((__visibility__("default")))
#else
# define ZINT_EXTERN extern
#endif

View file

@ -1,11 +1,11 @@
% docs/README 2024-03-03
% docs/README 2024-05-27
For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" using a recent version of pandoc
On Ubuntu/Debian (tested on Ubuntu 22.04)
wget https://github.com/jgm/pandoc/releases/download/3.1.12.2/pandoc-3.1.12.2-1-amd64.deb
sudo dpkg -i pandoc-3.1.12.2-1-amd64.deb
wget https://github.com/jgm/pandoc/releases/download/3.2/pandoc-3.2-1-amd64.deb
sudo dpkg -i pandoc-3.2-1-amd64.deb
sudo apt install python3-pip
pip install pandoc-tablenos --user
export PATH=~/.local/bin:"$PATH"
@ -20,9 +20,9 @@ On Ubuntu/Debian (tested on Ubuntu 22.04)
On Fedora (tested on Fedora Linux 38 (Workstation Edition))
wget https://github.com/jgm/pandoc/releases/download/3.1.12.2/pandoc-3.1.12.2-linux-amd64.tar.gz
tar xf pandoc-3.1.12.2-linux-amd64.tar.gz
sudo mv -i pandoc-3.1.12.2/bin/pandoc /usr/local/bin
wget https://github.com/jgm/pandoc/releases/download/3.2/pandoc-3.2-linux-amd64.tar.gz
tar xf pandoc-3.2-linux-amd64.tar.gz
sudo mv -i pandoc-3.2/bin/pandoc /usr/local/bin
sudo dnf install python3-pip
pip install pandoc-tablenos --user
export PATH=~/.local/bin:"$PATH"

View file

@ -332,7 +332,7 @@
<h1 class="title">Zint Barcode Generator and Zint Barcode Studio User
Manual</h1>
<p class="author">Version 2.13.0.9</p>
<p class="date">March 2024</p>
<p class="date">May 2024</p>
</header>
<nav id="TOC" role="doc-toc">
<ul>

View file

@ -1,6 +1,6 @@
% Zint Barcode Generator and Zint Barcode Studio User Manual
% Version 2.13.0.9
% March 2024
% May 2024
# 1. Introduction

View file

@ -1,6 +1,6 @@
Zint Barcode Generator and Zint Barcode Studio User Manual
Version 2.13.0.9
March 2024
May 2024
*******************************************************************************
* For reference the following is a text-only version of the Zint manual, *
@ -4814,7 +4814,7 @@ configured barcode is displayed once the "Generate" button is pressed.
Annex D. Man Page ZINT(1)
% ZINT(1) Version 2.13.0.9 % % March 2024
% ZINT(1) Version 2.13.0.9 % % May 2024
NAME

View file

@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.12.2
.\" Automatically generated by Pandoc 3.2
.\"
.TH "ZINT" "1" "March 2024" "Version 2.13.0.9" ""
.TH "ZINT" "1" "May 2024" "Version 2.13.0.9" ""
.SH NAME
\f[CR]zint\f[R] \- encode data as a barcode image
.SH SYNOPSIS

View file

@ -1,6 +1,6 @@
% ZINT(1) Version 2.13.0.9
%
% March 2024
% May 2024
# NAME

View file

@ -32,7 +32,7 @@
# include "../getopt/getopt.h"
# ifdef _MSC_VER
# include "zint.h"
# if _MSC_VER != 1200 /* VC6 */
# if _MSC_VER > 1200 /* VC6 */
# pragma warning(disable: 4996) /* function or variable may be unsafe */
# endif
# else

View file

@ -45,7 +45,6 @@ static int utf8_to_wchar(const char *str, wchar_t *out) {
decode_utf8(&state, &codepoint, *str++);
} while (*str && state != 0 && state != 12);
if (state != 0) {
fprintf(stderr, "utf8_to_wchar: warning: invalid UTF-8\n");
return 0;
}
*out++ = codepoint;

View file

@ -355,6 +355,8 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
connect(btnSave, SIGNAL(clicked(bool)), SLOT(save()));
connect(spnScale, SIGNAL(valueChanged(double)), SLOT(update_preview()));
connect(btnExit, SIGNAL(clicked(bool)), SLOT(quit_now()));
connect(fgcolor, SIGNAL(clicked(bool)), SLOT(fgcolor_clicked()));
connect(bgcolor, SIGNAL(clicked(bool)), SLOT(bgcolor_clicked()));
connect(btnReset, SIGNAL(clicked(bool)), SLOT(reset_colours()));
connect(btnReverse, SIGNAL(clicked(bool)), SLOT(reverse_colours()));
connect(btnMoreData, SIGNAL(clicked(bool)), SLOT(open_data_dialog()));