Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility

Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
  static get_zint_version() method, use QStringLiteral (QSL shorthand),
  use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
  add saveAs shortcut, add main menu, context menus and actions, add help,
  reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
  lessen triggering of update_preview(), shorten names of getters/setters,
  simplify/shorten some update_preview() logic in switch,
  CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
This commit is contained in:
gitlost 2021-10-09 00:13:39 +01:00
parent 206ae26d20
commit 72eac41c34
82 changed files with 5570 additions and 3774 deletions

View file

@ -55,16 +55,15 @@ INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int len
unsigned char *checkptr;
static const char grid[9] = {1, 1, 1, 1, 0, 1, 0, 0, 1};
char dest[554]; /* 8 + 65 * 8 + 8 * 2 + 9 + 1 = 554 */
int error_number;
int error_number = 0;
if (length > 65) {
strcpy(symbol->errtxt, "370: Input too long (65 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
error_number = is_sane(SSET, source, length);
if (error_number == ZINT_ERROR_INVALID_DATA) {
if (is_sane(SSET, source, length) != 0) {
strcpy(symbol->errtxt, "371: Invalid character in data (digits and \"ABCDEF\" only)");
return error_number;
return ZINT_ERROR_INVALID_DATA;
}
if (!(checkptr = (unsigned char *) calloc(1, length * 4 + 8))) {
@ -155,7 +154,8 @@ static char msi_check_digit_mod11(const unsigned char source[], const int length
}
/* Plain MSI Plessey - does not calculate any check character */
static void msi_plessey(struct zint_symbol *symbol, const unsigned char source[], const int length, char dest[]) {
static void msi_plessey_nomod(struct zint_symbol *symbol, const unsigned char source[], const int length,
char dest[]) {
int i;
@ -290,8 +290,8 @@ static void msi_plessey_mod1110(struct zint_symbol *symbol, const unsigned char
}
}
INTERNAL int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length) {
int error_number;
INTERNAL int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
int error_number = 0;
char dest[550]; /* 2 + 65 * 8 + 3 * 8 + 3 + 1 = 550 */
int check_option = symbol->option_2;
int no_checktext = 0;
@ -300,8 +300,7 @@ INTERNAL int msi_handle(struct zint_symbol *symbol, unsigned char source[], int
strcpy(symbol->errtxt, "372: Input too long (65 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
error_number = is_sane(NEON, source, length);
if (error_number != 0) {
if (is_sane(NEON, source, length) != 0) {
strcpy(symbol->errtxt, "377: Invalid character in data (digits only)");
return ZINT_ERROR_INVALID_DATA;
}
@ -318,7 +317,7 @@ INTERNAL int msi_handle(struct zint_symbol *symbol, unsigned char source[], int
strcpy(dest, "21");
switch (check_option) {
case 0: msi_plessey(symbol, source, length, dest);
case 0: msi_plessey_nomod(symbol, source, length, dest);
break;
case 1: msi_plessey_mod10(symbol, source, length, no_checktext, dest);
break;