PDF417: fix cols/rows calculation to require multiple <= 928 codewords;

add specify rows option (option_3) (#204);
  warn if cols increased from specified (back-incompatible);
  move table definitions from "pdf417.h" to new "pdf417_tabs.h" and
  make INTERNAL_DATA and share with composite.c (saves ~10K);
  prefix routines and tables with "pdf_";
  some small performance improvements through if/elses, pdf_textprocess()
  & pdf_numbprocess() loop simplifications
MICROQR: fix debug access crash on printing non-NUL-terminating binary
DATAMATRIX: fix missing ++ from "[tp]" at C40/TEXT EOD processing of GS1
  (though probably never reached); use "[tp++]" throughout
Add const to static tables missing it and also to some variables
Change "debug" -> "debug_print" throughout
This commit is contained in:
gitlost 2021-10-30 22:00:31 +01:00
parent 706f021637
commit 4e72a541f7
47 changed files with 1949 additions and 1231 deletions

View file

@ -100,7 +100,7 @@ INTERNAL int chr_cnt(const unsigned char string[], const int length, const unsig
/* Verifies that a string only uses valid characters */
INTERNAL int is_sane(const unsigned int flg, const unsigned char source[], const int length) {
#define IS_CLS_F (IS_CLI_F | IS_SIL_F)
static unsigned short flgs[256] = {
static const unsigned short flgs[256] = {
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, 0, 0, 0, 0, 0, 0, /*00-1F*/
IS_SPC_F, IS_C82_F, IS_C82_F, IS_HSH_F, /*20-23*/ /* !"# */
IS_CLS_F, IS_SIL_F | IS_C82_F, IS_C82_F, IS_C82_F, /*24-27*/ /* $%&' */
@ -221,7 +221,7 @@ INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int le
int reader;
int writer, i;
int latch, num;
int row = symbol->rows;
const int row = symbol->rows;
symbol->rows++;
@ -344,7 +344,7 @@ INTERNAL unsigned int decode_utf8(unsigned int *state, unsigned int *codep, cons
12,36,12,12,12,12,12,12,12,12,12,12,
};
unsigned int type = utf8d[byte];
const unsigned int type = utf8d[byte];
*codep = *state != 0 ? (byte & 0x3fu) | (*codep << 6) : (0xff >> type) & byte;
@ -410,7 +410,7 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height,
int zero_count = 0;
float row_height;
int i;
int rows = symbol->rows ? symbol->rows : 1; /* Sometimes called before expand() */
const int rows = symbol->rows ? symbol->rows : 1; /* Sometimes called before expand() */
for (i = 0; i < rows; i++) {
if (symbol->row_height[i]) {