mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-16 08:04:36 -04:00
- ITF14/DPLEIT/DPIDENT: ignore option_2
(check digit options)
- GUI: scalewindow: fix cropping resolution on initial setup (`spnResolution` max 1000 -> 254000) and bound X-dim to <= 10 in `set_maxima()` - GUI: mainwindow: bound X-dim as above and clamp `m_xdimdpVars` members on initial load from INI - GUI: undo `QString::mid()` -> `QString::midRef()` from clazy & explicitly include "QObject" in "qzint.h" (not Qt6 compatible)
This commit is contained in:
parent
7c1bdba8ae
commit
7b41dfbee2
10 changed files with 58 additions and 43 deletions
|
@ -70,7 +70,7 @@ static int c25_common(struct zint_symbol *symbol, const unsigned char source[],
|
|||
char dest[818]; /* Largest destination 4 + (80 + 1) * 10 + 3 + 1 = 818 */
|
||||
char *d = dest;
|
||||
unsigned char temp[113 + 1 + 1]; /* Largest maximum 113 + optional check digit */
|
||||
int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2;
|
||||
const int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2;
|
||||
|
||||
if (length > max) {
|
||||
/* errtxt 301: 303: 305: 307: */
|
||||
|
@ -147,12 +147,12 @@ INTERNAL int c25logic(struct zint_symbol *symbol, unsigned char source[], int le
|
|||
|
||||
/* Common to Interleaved, ITF-14, DP Leitcode, DP Identcode */
|
||||
static int c25_inter_common(struct zint_symbol *symbol, unsigned char source[], int length,
|
||||
const int dont_set_height) {
|
||||
const int checkdigit_option, const int dont_set_height) {
|
||||
int i, j, error_number = 0;
|
||||
char dest[638]; /* 4 + (125 + 1) * 5 + 3 + 1 = 638 */
|
||||
char *d = dest;
|
||||
unsigned char temp[125 + 1 + 1];
|
||||
int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2;
|
||||
const int have_checkdigit = checkdigit_option == 1 || checkdigit_option == 2;
|
||||
|
||||
if (length > 125) { /* 4 + (125 + 1) * 9 + 5 = 1143 */
|
||||
strcpy(symbol->errtxt, "309: Input too long (125 character maximum)");
|
||||
|
@ -202,7 +202,7 @@ static int c25_inter_common(struct zint_symbol *symbol, unsigned char source[],
|
|||
expand(symbol, dest, d - dest);
|
||||
|
||||
ustrcpy(symbol->text, temp);
|
||||
if (symbol->option_2 == 2) {
|
||||
if (checkdigit_option == 2) {
|
||||
/* Remove check digit from HRT */
|
||||
symbol->text[length - 1] = '\0';
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ static int c25_inter_common(struct zint_symbol *symbol, unsigned char source[],
|
|||
|
||||
/* Code 2 of 5 Interleaved ISO/IEC 16390:2007 */
|
||||
INTERNAL int c25inter(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
return c25_inter_common(symbol, source, length, 0 /*dont_set_height*/);
|
||||
return c25_inter_common(symbol, source, length, symbol->option_2 /*checkdigit_option*/, 0 /*dont_set_height*/);
|
||||
}
|
||||
|
||||
/* Interleaved 2-of-5 (ITF-14) */
|
||||
|
@ -259,7 +259,7 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt
|
|||
/* Calculate the check digit - the same method used for EAN-13 */
|
||||
localstr[13] = gs1_check_digit(localstr, 13);
|
||||
localstr[14] = '\0';
|
||||
error_number = c25_inter_common(symbol, localstr, 14, 1 /*dont_set_height*/);
|
||||
error_number = c25_inter_common(symbol, localstr, 14, 0 /*checkdigit_option*/, 1 /*dont_set_height*/);
|
||||
ustrcpy(symbol->text, localstr);
|
||||
|
||||
if (error_number < ZINT_ERROR) {
|
||||
|
@ -320,7 +320,7 @@ INTERNAL int dpleit(struct zint_symbol *symbol, unsigned char source[], int leng
|
|||
}
|
||||
localstr[13] = c25_check_digit(count);
|
||||
localstr[14] = '\0';
|
||||
error_number = c25_inter_common(symbol, localstr, 14, 1 /*dont_set_height*/);
|
||||
error_number = c25_inter_common(symbol, localstr, 14, 0 /*checkdigit_option*/, 1 /*dont_set_height*/);
|
||||
|
||||
/* HRT formatting as per DIALOGPOST SCHWER brochure but TEC-IT differs as do examples at
|
||||
https://www.philaseiten.de/cgi-bin/index.pl?ST=8615&CP=0&F=1#M147 */
|
||||
|
@ -368,7 +368,7 @@ INTERNAL int dpident(struct zint_symbol *symbol, unsigned char source[], int len
|
|||
}
|
||||
localstr[11] = c25_check_digit(count);
|
||||
localstr[12] = '\0';
|
||||
error_number = c25_inter_common(symbol, localstr, 12, 1 /*dont_set_height*/);
|
||||
error_number = c25_inter_common(symbol, localstr, 12, 0 /*checkdigit_option*/, 1 /*dont_set_height*/);
|
||||
|
||||
/* HRT formatting as per DIALOGPOST SCHWER brochure but TEC-IT differs as do other examples (see above) */
|
||||
for (i = 0, j = 0; i <= 12; i++) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
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
|
||||
|
@ -282,31 +282,40 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
/* 15*/ { BARCODE_DPLEIT, -1, "0000087654321", 0, 1, 135, "Deutsche Post Leitcode; verified manually against tec-it",
|
||||
"101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101"
|
||||
},
|
||||
/* 16*/ { BARCODE_DPLEIT, -1, "2045703000360", 0, 1, 135, "Deutsche Post DIALOGPOST SCHWER brochure 3.1 example",
|
||||
/* 16*/ { BARCODE_DPLEIT, 1, "0000087654321", 0, 1, 135, "Check digit option ignored",
|
||||
"101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101"
|
||||
},
|
||||
/* 17*/ { BARCODE_DPLEIT, -1, "2045703000360", 0, 1, 135, "Deutsche Post DIALOGPOST SCHWER brochure 3.1 example",
|
||||
"101010111010001000111010001011100010111010101000111000111011101110100010001010101110001110001011101110001000101010001011100011101011101"
|
||||
},
|
||||
/* 17*/ { BARCODE_DPLEIT, -1, "5082300702800", 0, 1, 135, "Deutsche Post Leitcode https://de.wikipedia.org/wiki/Leitcode example",
|
||||
/* 18*/ { BARCODE_DPLEIT, -1, "5082300702800", 0, 1, 135, "Deutsche Post Leitcode https://de.wikipedia.org/wiki/Leitcode example",
|
||||
"101011101011100010001011101000101110100011101110100010001010101110111000100010100011101110100011101010001110001010001011100011101011101"
|
||||
},
|
||||
/* 18*/ { BARCODE_DPIDENT, -1, "00087654321", 0, 1, 117, "Deutsche Post Identcode; verified manually against tec-it (HRT differently formatted)",
|
||||
/* 19*/ { BARCODE_DPIDENT, -1, "00087654321", 0, 1, 117, "Deutsche Post Identcode; verified manually against tec-it (HRT differently formatted)",
|
||||
"101010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101"
|
||||
},
|
||||
/* 19*/ { BARCODE_DPIDENT, -1, "80420000001", 0, 1, 117, "Deutsche Post DIALOGPOST SCHWER brochure 3.1 example",
|
||||
/* 20*/ { BARCODE_DPIDENT, -1, "00087654321", 0, 1, 117, "Check digit option ignored",
|
||||
"101010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101"
|
||||
},
|
||||
/* 21*/ { BARCODE_DPIDENT, -1, "80420000001", 0, 1, 117, "Deutsche Post DIALOGPOST SCHWER brochure 3.1 example",
|
||||
"101011101010001110001010100011101011100010101110001110001010101110001110001010101110001110001011101010001000111011101"
|
||||
},
|
||||
/* 20*/ { BARCODE_DPIDENT, -1, "39601313414", 0, 1, 117, "Deutsche Post Identcode https://de.wikipedia.org/wiki/Leitcode example",
|
||||
/* 22*/ { BARCODE_DPIDENT, -1, "39601313414", 0, 1, 117, "Deutsche Post Identcode https://de.wikipedia.org/wiki/Leitcode example",
|
||||
"101011101110001010001010111011100010001011100010001010111011100010001010111010001011101011100010101110001000111011101"
|
||||
},
|
||||
/* 21*/ { BARCODE_ITF14, -1, "0000087654321", 0, 1, 135, "ITF-14; verified manually against tec-it",
|
||||
/* 23*/ { BARCODE_ITF14, -1, "0000087654321", 0, 1, 135, "ITF-14; verified manually against tec-it",
|
||||
"101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000101011100011101"
|
||||
},
|
||||
/* 22*/ { BARCODE_ITF14, -1, "0950110153000", 0, 1, 135, "GS1 General Specifications Figure 5.1-2",
|
||||
/* 24*/ { BARCODE_ITF14, 1, "0000087654321", 0, 1, 135, "Check digit option ignored",
|
||||
"101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000101011100011101"
|
||||
},
|
||||
/* 25*/ { BARCODE_ITF14, -1, "0950110153000", 0, 1, 135, "GS1 General Specifications Figure 5.1-2",
|
||||
"101010100011101110001011101011100010001011100010101011100010001011101110100011100010001110101010101110001110001010001000111011101011101"
|
||||
},
|
||||
/* 23*/ { BARCODE_ITF14, -1, "1540014128876", 0, 1, 135, "GS1 General Specifications Figure 5.3.2.4-1",
|
||||
/* 26*/ { BARCODE_ITF14, -1, "1540014128876", 0, 1, 135, "GS1 General Specifications Figure 5.3.2.4-1",
|
||||
"101011100010100010111010101110001000111010001011101110100010001011101011100010001110101000111011101010111000100010001110001110101011101"
|
||||
},
|
||||
/* 24*/ { BARCODE_ITF14, -1, "0950110153001", 0, 1, 135, "GS1 General Specifications Figure 5.3.6-1",
|
||||
/* 27*/ { BARCODE_ITF14, -1, "0950110153001", 0, 1, 135, "GS1 General Specifications Figure 5.3.6-1",
|
||||
"101010100011101110001011101011100010001011100010101011100010001011101110100011100010001110101010101110001110001011101010001000111011101"
|
||||
},
|
||||
};
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue