mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
CODEONE: various fixes, ECI support; #209
This commit is contained in:
parent
538efd6e52
commit
6274140c73
1771
backend/code1.c
1771
backend/code1.c
File diff suppressed because it is too large
Load Diff
@ -553,6 +553,7 @@ static int supports_eci(const int symbology) {
|
||||
case BARCODE_PDF417COMP:
|
||||
case BARCODE_QRCODE:
|
||||
case BARCODE_DOTCODE:
|
||||
case BARCODE_CODEONE:
|
||||
case BARCODE_GRIDMATRIX:
|
||||
case BARCODE_HANXIN:
|
||||
case BARCODE_ULTRA:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -339,25 +339,39 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*202*/ { BARCODE_AZRUNE, UNICODE_MODE, 0, "é", ZINT_ERROR_INVALID_DATA, -1, "Numbers <= 255 only" },
|
||||
/*203*/ { BARCODE_CODE32, UNICODE_MODE, 0, "é", ZINT_ERROR_INVALID_DATA, -1, "Numbers only" },
|
||||
/*204*/ { BARCODE_CODEONE, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
/*205*/ { BARCODE_CODEONE, UNICODE_MODE, 3, "é", ZINT_ERROR_INVALID_OPTION, -1, "Does not support ECI" },
|
||||
/*206*/ { BARCODE_CODEONE, UNICODE_MODE, 0, "β", ZINT_ERROR_INVALID_DATA, -1, "β not in ISO 8859-1" },
|
||||
/*207*/ { BARCODE_ULTRA, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
/*208*/ { BARCODE_ULTRA, UNICODE_MODE, 3, "é", 0, 3, "Supports ECI" },
|
||||
/*209*/ { BARCODE_ULTRA, UNICODE_MODE, 0, "β", ZINT_WARN_USES_ECI, 9, "" },
|
||||
/*210*/ { BARCODE_ULTRA, UNICODE_MODE, 9, "β", 0, 9, "" },
|
||||
/*211*/ { BARCODE_ULTRA, UNICODE_MODE, 20, "テ", 0, 20, "In Shift JIS" },
|
||||
/*212*/ { BARCODE_ULTRA, UNICODE_MODE, 20, "テテ", 0, 20, "In Shift JIS" },
|
||||
/*213*/ { BARCODE_ULTRA, UNICODE_MODE, 25, "က", 0, 25, "In UCS-2BE" },
|
||||
/*214*/ { BARCODE_ULTRA, UNICODE_MODE, 25, "ကက", 0, 25, "In UCS-2BE" },
|
||||
/*215*/ { BARCODE_ULTRA, UNICODE_MODE, 25, "12", 0, 25, "ASCII" },
|
||||
/*216*/ { BARCODE_ULTRA, UNICODE_MODE, 26, "テ", 0, 26, "" },
|
||||
/*217*/ { BARCODE_ULTRA, UNICODE_MODE, 26, "テテ", 0, 26, "" },
|
||||
/*218*/ { BARCODE_ULTRA, UNICODE_MODE, 28, "龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*219*/ { BARCODE_ULTRA, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*220*/ { BARCODE_ULTRA, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*221*/ { BARCODE_ULTRA, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*222*/ { BARCODE_ULTRA, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*223*/ { BARCODE_ULTRA, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*205*/ { BARCODE_CODEONE, UNICODE_MODE, 3, "é", 0, 3, "Supports ECI" },
|
||||
/*206*/ { BARCODE_CODEONE, UNICODE_MODE, 0, "β", ZINT_WARN_USES_ECI, 9, "" },
|
||||
/*207*/ { BARCODE_CODEONE, UNICODE_MODE, 9, "β", 0, 9, "" },
|
||||
/*208*/ { BARCODE_CODEONE, UNICODE_MODE, 20, "テ", 0, 20, "In Shift JIS" },
|
||||
/*209*/ { BARCODE_CODEONE, UNICODE_MODE, 20, "テテ", 0, 20, "In Shift JIS" },
|
||||
/*210*/ { BARCODE_CODEONE, UNICODE_MODE, 25, "က", 0, 25, "In UCS-2BE" },
|
||||
/*211*/ { BARCODE_CODEONE, UNICODE_MODE, 25, "ကက", 0, 25, "In UCS-2BE" },
|
||||
/*212*/ { BARCODE_CODEONE, UNICODE_MODE, 25, "12", 0, 25, "ASCII" },
|
||||
/*213*/ { BARCODE_CODEONE, UNICODE_MODE, 26, "テ", 0, 26, "" },
|
||||
/*214*/ { BARCODE_CODEONE, UNICODE_MODE, 26, "テテ", 0, 26, "" },
|
||||
/*215*/ { BARCODE_CODEONE, UNICODE_MODE, 28, "龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*216*/ { BARCODE_CODEONE, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*217*/ { BARCODE_CODEONE, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*218*/ { BARCODE_CODEONE, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*219*/ { BARCODE_CODEONE, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*220*/ { BARCODE_CODEONE, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*221*/ { BARCODE_ULTRA, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
/*222*/ { BARCODE_ULTRA, UNICODE_MODE, 3, "é", 0, 3, "Supports ECI" },
|
||||
/*223*/ { BARCODE_ULTRA, UNICODE_MODE, 0, "β", ZINT_WARN_USES_ECI, 9, "" },
|
||||
/*224*/ { BARCODE_ULTRA, UNICODE_MODE, 9, "β", 0, 9, "" },
|
||||
/*225*/ { BARCODE_ULTRA, UNICODE_MODE, 20, "テ", 0, 20, "In Shift JIS" },
|
||||
/*226*/ { BARCODE_ULTRA, UNICODE_MODE, 20, "テテ", 0, 20, "In Shift JIS" },
|
||||
/*227*/ { BARCODE_ULTRA, UNICODE_MODE, 25, "က", 0, 25, "In UCS-2BE" },
|
||||
/*228*/ { BARCODE_ULTRA, UNICODE_MODE, 25, "ကက", 0, 25, "In UCS-2BE" },
|
||||
/*229*/ { BARCODE_ULTRA, UNICODE_MODE, 25, "12", 0, 25, "ASCII" },
|
||||
/*230*/ { BARCODE_ULTRA, UNICODE_MODE, 26, "テ", 0, 26, "" },
|
||||
/*231*/ { BARCODE_ULTRA, UNICODE_MODE, 26, "テテ", 0, 26, "" },
|
||||
/*232*/ { BARCODE_ULTRA, UNICODE_MODE, 28, "龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*233*/ { BARCODE_ULTRA, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*234*/ { BARCODE_ULTRA, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*235*/ { BARCODE_ULTRA, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*236*/ { BARCODE_ULTRA, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*237*/ { BARCODE_ULTRA, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
|
||||
|
@ -244,7 +244,7 @@ static void test_buffer(int index, int generate, int debug) {
|
||||
/*120*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
|
||||
/*121*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 },
|
||||
/*122*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 116 },
|
||||
/*123*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
|
||||
/*123*/ { BARCODE_CODEONE, "12345678901234567890", "", 16, 16, 18, 36, 32 },
|
||||
/*124*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
|
||||
/*125*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
|
||||
/*126*/ { BARCODE_ULTRA, "1234567890", "", 13, 13, 18, 36, 26 },
|
||||
|
@ -225,46 +225,47 @@ static void test_buffer_vector(int index, int generate, int debug) {
|
||||
/* 84*/ { BARCODE_ITF14, "1234567890", "", 50, 1, 135, 330, 138.89999 },
|
||||
/* 85*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 },
|
||||
/* 86*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 },
|
||||
/* 87*/ { BARCODE_DPD, "0123456789012345678901234567", "", 50, 1, 189, 378, 118.9 },
|
||||
/* 88*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
|
||||
/* 89*/ { BARCODE_HIBC_128, "1234567890", "", 50, 1, 123, 246, 118.9 },
|
||||
/* 90*/ { BARCODE_HIBC_39, "1234567890", "", 50, 1, 223, 446, 118.9 },
|
||||
/* 91*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 },
|
||||
/* 92*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 },
|
||||
/* 93*/ { BARCODE_HIBC_PDF, "1234567890", "", 24, 8, 103, 206, 48 },
|
||||
/* 94*/ { BARCODE_HIBC_MICPDF, "1234567890", "", 28, 14, 38, 76, 56 },
|
||||
/* 95*/ { BARCODE_HIBC_BLOCKF, "1234567890", "", 30, 3, 101, 242, 64 },
|
||||
/* 96*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
|
||||
/* 97*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32, 22 },
|
||||
/* 98*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
|
||||
/* 99*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
|
||||
/*100*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
|
||||
/*101*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118.9 },
|
||||
/*102*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 234, 116.4 },
|
||||
/*103*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 126, 284, 116.4 },
|
||||
/*104*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 153, 338, 116.4 },
|
||||
/*105*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 172, 116.4 },
|
||||
/*106*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 99, 226, 116.4 },
|
||||
/*107*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 126, 280, 116.4 },
|
||||
/*108*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 118.9 },
|
||||
/*109*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60.900002 },
|
||||
/*110*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 56.900002 },
|
||||
/*111*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 100.9 },
|
||||
/*112*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 116.4 },
|
||||
/*113*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 116.4 },
|
||||
/*114*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 116.4 },
|
||||
/*115*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 142, 116.4 },
|
||||
/*116*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 82, 192, 116.4 },
|
||||
/*117*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 116.4 },
|
||||
/*118*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
|
||||
/*119*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
|
||||
/*120*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 },
|
||||
/*121*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 118.9 },
|
||||
/*122*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
|
||||
/*123*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
|
||||
/*124*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
|
||||
/*125*/ { BARCODE_ULTRA, "1234567890", "", 13, 13, 18, 36, 26 },
|
||||
/*126*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
|
||||
/* 87*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
|
||||
/* 88*/ { BARCODE_DPD, "0123456789012345678901234567", "", 50, 1, 189, 378, 118.9 },
|
||||
/* 89*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
|
||||
/* 90*/ { BARCODE_HIBC_128, "1234567890", "", 50, 1, 123, 246, 118.9 },
|
||||
/* 91*/ { BARCODE_HIBC_39, "1234567890", "", 50, 1, 223, 446, 118.9 },
|
||||
/* 92*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 },
|
||||
/* 93*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 },
|
||||
/* 94*/ { BARCODE_HIBC_PDF, "1234567890", "", 24, 8, 103, 206, 48 },
|
||||
/* 95*/ { BARCODE_HIBC_MICPDF, "1234567890", "", 28, 14, 38, 76, 56 },
|
||||
/* 96*/ { BARCODE_HIBC_BLOCKF, "1234567890", "", 30, 3, 101, 242, 64 },
|
||||
/* 97*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
|
||||
/* 98*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32, 22 },
|
||||
/* 99*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
|
||||
/*100*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
|
||||
/*101*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
|
||||
/*102*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118.9 },
|
||||
/*103*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 234, 116.4 },
|
||||
/*104*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 126, 284, 116.4 },
|
||||
/*105*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 153, 338, 116.4 },
|
||||
/*106*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 172, 116.4 },
|
||||
/*107*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 99, 226, 116.4 },
|
||||
/*108*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 126, 280, 116.4 },
|
||||
/*109*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 118.9 },
|
||||
/*110*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60.900002 },
|
||||
/*111*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 56.900002 },
|
||||
/*112*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 100.9 },
|
||||
/*113*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 116.4 },
|
||||
/*114*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 116.4 },
|
||||
/*115*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 116.4 },
|
||||
/*116*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 142, 116.4 },
|
||||
/*117*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 82, 192, 116.4 },
|
||||
/*118*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 116.4 },
|
||||
/*119*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
|
||||
/*120*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
|
||||
/*121*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 },
|
||||
/*122*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 118.9 },
|
||||
/*123*/ { BARCODE_CODEONE, "12345678901234567890", "", 16, 16, 18, 36, 32 },
|
||||
/*124*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
|
||||
/*125*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
|
||||
/*126*/ { BARCODE_ULTRA, "1234567890", "", 13, 13, 18, 36, 26 },
|
||||
/*127*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
|
||||
};
|
||||
int data_size = sizeof(data) / sizeof(struct item);
|
||||
|
||||
|
@ -2285,13 +2285,40 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
||||
bwipp_opts = bwipp_opts_buf;
|
||||
}
|
||||
} else if (symbology == BARCODE_CODEONE) {
|
||||
if ((symbol->input_mode & 0x07) == GS1_MODE) { /* Hack pseudo-GS1 support */
|
||||
int last_ai, ai_latch = 0;
|
||||
for (int i = 0, j = 0, len = (int) strlen(bwipp_data); i <= len; i++) { /* Reduce square brackets (include NUL) */
|
||||
if (bwipp_data[i] == '[') {
|
||||
if (ai_latch == 0) {
|
||||
bwipp_data[j++] = '[';
|
||||
}
|
||||
last_ai = atoi(bwipp_data + i + 1);
|
||||
if ((last_ai >= 0 && last_ai <= 4) || (last_ai >= 11 && last_ai <= 20) || last_ai == 23 || (last_ai >= 31 && last_ai <= 36) || last_ai == 41) {
|
||||
ai_latch = 1;
|
||||
}
|
||||
} else if (bwipp_data[i] != ']') {
|
||||
bwipp_data[j++] = bwipp_data[i];
|
||||
}
|
||||
}
|
||||
for (int len = (int) strlen(bwipp_data), i = len - 1; i >= 0; i--) { /* Replace square brackets with ^FNC1 */
|
||||
if (bwipp_data[i] == '[') {
|
||||
memmove(bwipp_data + i + 5, bwipp_data + i + 1, len - i);
|
||||
memcpy(bwipp_data + i, "^FNC1", 5);
|
||||
len += 4;
|
||||
}
|
||||
}
|
||||
if (symbol->eci == 0) { /* If not already done for ECI */
|
||||
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sparsefnc", strlen(bwipp_opts_buf) ? " " : "");
|
||||
bwipp_opts = bwipp_opts_buf;
|
||||
}
|
||||
}
|
||||
if (option_2 >= 1 && option_2 <= 10) {
|
||||
static const char *codeone_versions[] = { "A", "B", "C", "D", "E", "F", "G", "H" };
|
||||
const char *codeone_version;
|
||||
if (option_2 == 9) {
|
||||
codeone_version = length <= 6 ? "S-10" : length <= 12 ? "S-20" : "S-30";
|
||||
} else if (option_2 == 10) {
|
||||
codeone_version = "T-16"; // TODO: Allow for different T sizes
|
||||
codeone_version = length <= 22 ? "T-16" : length <= 34 ? "T-32" : "T-48"; // TODO: Properly allow for different T sizes
|
||||
} else {
|
||||
codeone_version = codeone_versions[option_2 - 1];
|
||||
}
|
||||
@ -2339,13 +2366,13 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
||||
}
|
||||
|
||||
if (bwipp_opts) {
|
||||
if (data_len >= 2043) { /* Ghostscript's `arg_str_max` 2048 less "-sd=" */
|
||||
if (strlen(bwipp_data) >= 2043) { /* Ghostscript's `arg_str_max` 2048 less "-sd=" */
|
||||
sprintf(cmd, cmd_opts_fmt2, bwipp_barcode, bwipp_data, bwipp_data + 2043, bwipp_opts);
|
||||
} else {
|
||||
sprintf(cmd, cmd_opts_fmt, bwipp_barcode, bwipp_data, bwipp_opts);
|
||||
}
|
||||
} else {
|
||||
if (data_len >= 2043) {
|
||||
if (strlen(bwipp_data) >= 2043) {
|
||||
sprintf(cmd, cmd_fmt2, bwipp_barcode, bwipp_data, bwipp_data + 2043);
|
||||
} else {
|
||||
sprintf(cmd, cmd_fmt, bwipp_barcode, bwipp_data);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2021-01-28 22:23:05.208873553 +0000
|
||||
+++ ../tools/bwipp_dump.ps 2021-01-28 23:31:03.965490583 +0000
|
||||
@@ -26135,34 +26135,80 @@
|
||||
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2021-02-03 09:22:12.524526773 +0000
|
||||
+++ ../tools/bwipp_dump.ps 2021-02-03 09:22:48.752086756 +0000
|
||||
@@ -26162,34 +26162,80 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -100,7 +100,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -26221,7 +26267,7 @@
|
||||
@@ -26248,7 +26294,7 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -109,7 +109,7 @@
|
||||
|
||||
% Get the result of encoding with ean8 and gs1-cc
|
||||
options (lintype) (ean8) put
|
||||
@@ -26229,29 +26275,75 @@
|
||||
@@ -26256,29 +26302,75 @@
|
||||
options (dontdraw) true put
|
||||
|
||||
% Plot the linear part
|
||||
@ -205,7 +205,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -26310,34 +26402,80 @@
|
||||
@@ -26337,34 +26429,80 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -305,7 +305,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -26411,34 +26549,80 @@
|
||||
@@ -26438,34 +26576,80 @@
|
||||
/opt options
|
||||
>> def
|
||||
|
||||
@ -405,7 +405,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -26497,7 +26681,7 @@
|
||||
@@ -26524,7 +26708,7 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -414,7 +414,7 @@
|
||||
|
||||
options (lintype) (databaromni) put
|
||||
options (linkage) true put
|
||||
@@ -26508,7 +26692,7 @@
|
||||
@@ -26535,7 +26719,7 @@
|
||||
linear options //databaromni exec
|
||||
dup (sbs) get /linsbs exch def
|
||||
dup (bhs) get 0 get 72 mul /linheight exch def
|
||||
@ -423,7 +423,7 @@
|
||||
|
||||
% Plot the separator
|
||||
/sepfinder {
|
||||
@@ -26539,20 +26723,66 @@
|
||||
@@ -26566,20 +26750,66 @@
|
||||
sep 0 [0 0 0] putinterval
|
||||
sep sep length 4 sub [0 0 0 0] putinterval
|
||||
18 sepfinder 64 sepfinder
|
||||
@ -502,7 +502,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -26610,7 +26840,7 @@
|
||||
@@ -26637,7 +26867,7 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -511,7 +511,7 @@
|
||||
|
||||
options (lintype) (databarstacked) put
|
||||
options (linkage) true put
|
||||
@@ -26621,7 +26851,7 @@
|
||||
@@ -26648,7 +26878,7 @@
|
||||
linear options //databarstacked exec
|
||||
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
||||
dup (pixy) get /linheight exch def
|
||||
@ -520,7 +520,7 @@
|
||||
|
||||
% Plot the separator
|
||||
/sepfinder {
|
||||
@@ -26649,20 +26879,52 @@
|
||||
@@ -26676,20 +26906,52 @@
|
||||
sep 0 [ 0 0 0 0 ] putinterval
|
||||
sep sep length 4 sub [ 0 0 0 0 ] putinterval
|
||||
18 sepfinder
|
||||
@ -585,7 +585,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -26720,7 +26982,7 @@
|
||||
@@ -26747,7 +27009,7 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -594,7 +594,7 @@
|
||||
|
||||
options (lintype) (databarstackedomni) put
|
||||
options (linkage) true put
|
||||
@@ -26731,7 +26993,7 @@
|
||||
@@ -26758,7 +27020,7 @@
|
||||
linear options //databarstackedomni exec
|
||||
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
||||
dup (pixy) get /linheight exch def
|
||||
@ -603,7 +603,7 @@
|
||||
|
||||
% Plot the separator
|
||||
/sepfinder {
|
||||
@@ -26759,20 +27021,52 @@
|
||||
@@ -26786,20 +27048,52 @@
|
||||
sep 0 [ 0 0 0 0 ] putinterval
|
||||
sep sep length 4 sub [ 0 0 0 0 ] putinterval
|
||||
18 sepfinder
|
||||
@ -668,7 +668,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -26945,7 +27239,7 @@
|
||||
@@ -26972,7 +27266,7 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -677,7 +677,7 @@
|
||||
|
||||
options (lintype) (databarlimited) put
|
||||
options (linkage) true put
|
||||
@@ -26956,7 +27250,7 @@
|
||||
@@ -26983,7 +27277,7 @@
|
||||
linear options //databarlimited exec
|
||||
dup (sbs) get /linsbs exch def
|
||||
dup (bhs) get 0 get 72 mul /linheight exch def
|
||||
@ -686,7 +686,7 @@
|
||||
|
||||
% Plot the separator
|
||||
mark
|
||||
@@ -26964,22 +27258,68 @@
|
||||
@@ -26991,22 +27285,68 @@
|
||||
counttomark 1 sub array astore /sep exch def pop pop
|
||||
sep 0 [0 0 0] putinterval
|
||||
sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces
|
||||
@ -769,7 +769,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -27038,7 +27378,7 @@
|
||||
@@ -27065,7 +27405,7 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -778,7 +778,7 @@
|
||||
|
||||
options (lintype) (databarexpanded) put
|
||||
options (linkage) true put
|
||||
@@ -27049,7 +27389,7 @@
|
||||
@@ -27076,7 +27416,7 @@
|
||||
linear options //databarexpanded exec
|
||||
dup (sbs) get /linsbs exch def
|
||||
dup (bhs) get 0 get 72 mul /linheight exch def
|
||||
@ -787,7 +787,7 @@
|
||||
|
||||
% Plot the separator
|
||||
/sepfinder {
|
||||
@@ -27078,20 +27418,60 @@
|
||||
@@ -27105,20 +27445,60 @@
|
||||
18 98 bot length 13 sub {} for
|
||||
69 98 bot length 13 sub {} for
|
||||
] {sepfinder} forall
|
||||
@ -860,7 +860,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -27149,7 +27529,7 @@
|
||||
@@ -27176,7 +27556,7 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -869,7 +869,7 @@
|
||||
|
||||
options (lintype) (databarexpandedstacked) put
|
||||
options (linkage) true put
|
||||
@@ -27160,7 +27540,7 @@
|
||||
@@ -27187,7 +27567,7 @@
|
||||
linear options //databarexpandedstacked exec
|
||||
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
||||
dup (pixy) get /linheight exch def
|
||||
@ -878,7 +878,7 @@
|
||||
|
||||
% Plot the separator
|
||||
/sepfinder {
|
||||
@@ -27186,21 +27566,49 @@
|
||||
@@ -27213,21 +27593,49 @@
|
||||
19 98 bot length 13 sub {} for
|
||||
70 98 bot length 13 sub {} for
|
||||
] {sepfinder} forall
|
||||
@ -941,7 +941,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -27259,7 +27667,7 @@
|
||||
@@ -27286,7 +27694,7 @@
|
||||
pop
|
||||
} ifelse
|
||||
|
||||
@ -950,7 +950,7 @@
|
||||
|
||||
options (inkspread) (0) put
|
||||
options (dontdraw) true put
|
||||
@@ -27286,35 +27694,87 @@
|
||||
@@ -27313,35 +27721,87 @@
|
||||
linear << options {} forall >> //gs1-128 exec
|
||||
dup (sbs) get /linsbs exch def
|
||||
dup (bhs) get 0 get 72 mul /linheight exch def
|
||||
@ -1052,7 +1052,7 @@
|
||||
|
||||
end
|
||||
|
||||
@@ -28745,3 +29205,183 @@
|
||||
@@ -28772,3 +29232,183 @@
|
||||
% --END ENCODER hibcazteccode--
|
||||
|
||||
% --END TEMPLATE--
|
||||
|
Binary file not shown.
@ -23,6 +23,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <getopt.h>
|
||||
#include <zint.h>
|
||||
@ -32,6 +33,10 @@
|
||||
#include "zint.h"
|
||||
#endif
|
||||
|
||||
/* It's assumed that int is at least 32 bits, the following will compile-time fail if not
|
||||
* https://stackoverflow.com/a/1980056/664741 */
|
||||
typedef int static_assert_int_at_least_32bits[CHAR_BIT != 8 || sizeof(int) < 4 ? -1 : 1];
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
@ -201,8 +206,11 @@ static int validate_int(const char source[], int *p_val) {
|
||||
int i;
|
||||
int length = (int) strlen(source);
|
||||
|
||||
if (length > 9) { /* Prevent overflow */
|
||||
length = 9;
|
||||
}
|
||||
for (i = 0; i < length; i++) {
|
||||
if (source[i] < '0' || source[i] > '9' || val < 0) { /* Neg test checks for overflow */
|
||||
if (source[i] < '0' || source[i] > '9') {
|
||||
return 0;
|
||||
}
|
||||
val *= 10;
|
||||
|
@ -120,6 +120,10 @@
|
||||
<property name="text">
|
||||
<string>GS&1 Data Mode</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>GS1 system (Application Identifiers)
|
||||
(ignored if disabled)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -1151,6 +1151,7 @@ void MainWindow::set_gs1_mode(bool gs1_mode)
|
||||
void MainWindow::update_preview()
|
||||
{
|
||||
int symbology = metaObject()->enumerator(0).value(bstyle->currentIndex());
|
||||
int recheck_eci = true;
|
||||
int width = view->geometry().width();
|
||||
int height = view->geometry().height();
|
||||
int item_val;
|
||||
@ -1537,8 +1538,16 @@ void MainWindow::update_preview()
|
||||
|
||||
case BARCODE_CODEONE:
|
||||
m_bc.bc.setSymbol(BARCODE_CODEONE);
|
||||
set_gs1_mode(m_optionWidget->findChild<QRadioButton*>("radC1GS1")->isChecked());
|
||||
m_bc.bc.setOption2(m_optionWidget->findChild<QComboBox*>("cmbC1Size")->currentIndex());
|
||||
if (m_bc.bc.option2() == 9) { // Version S
|
||||
recheck_eci = false;
|
||||
cmbECI->setEnabled(false);
|
||||
lblECI->setEnabled(false);
|
||||
m_optionWidget->findChild<QRadioButton*>("radC1GS1")->setEnabled(false);
|
||||
} else {
|
||||
m_optionWidget->findChild<QRadioButton*>("radC1GS1")->setEnabled(true);
|
||||
set_gs1_mode(m_optionWidget->findChild<QRadioButton*>("radC1GS1")->isChecked());
|
||||
}
|
||||
break;
|
||||
|
||||
case BARCODE_CODE49:
|
||||
@ -1591,8 +1600,10 @@ void MainWindow::update_preview()
|
||||
m_symbology = m_bc.bc.symbol();
|
||||
|
||||
/* Recheck ECI and Reader Init */
|
||||
if (recheck_eci) {
|
||||
cmbECI->setEnabled(m_bc.bc.supportsECI());
|
||||
lblECI->setEnabled(cmbECI->isEnabled());
|
||||
}
|
||||
chkRInit->setEnabled(m_bc.bc.supportsReaderInit() && (m_bc.bc.inputMode() & 0x07) != GS1_MODE);
|
||||
|
||||
if (!grpComposite->isHidden() && chkComposite->isChecked())
|
||||
|
Loading…
Reference in New Issue
Block a user