1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-18 10:27:09 +00:00

general: change BARCODE_RAW_TEXT to write to new zint_symbol

fields `raw_segs` and `raw_seg_count` instead of `text`, and to
  do so for all symbologies, using new common funcs `rt_cpy()` etc.
MICROPDF417: return ECC percentage in top byte of `option_1`
DBAR_EXP_STK: return `option_2`/`option_3` feedback
CLI: change warning text "ignoring" -> "**IGNORED**"
GUI: show feedback for DBAR_EXP_STK, MICROPDF417, UPNQR
ctest: fix recent inability to run tests via "ctest" on Windows
  (MSVC) by using cmake 3.22 feature `ENVIRONMENT_MODIFICATION`
manual: document feedback and RAW_TEXT in new "Feedback" section;
  rephrase some symbology descriptions
test suite: new general-use arg "-a"; add `func_name` to context;
  new "test_bwipp" test for testing BWIPP against ZXing-C++
This commit is contained in:
gitlost
2025-03-28 10:02:19 +00:00
parent d1bf02e156
commit a6c225447e
120 changed files with 10511 additions and 5620 deletions

View File

@@ -1000,7 +1000,7 @@ static int dc_encode_message(struct zint_symbol *symbol, const unsigned char sou
/* Call `dc_encode_message()` for each segment */
static int dc_encode_message_segs(struct zint_symbol *symbol, const struct zint_seg segs[], const int seg_count,
unsigned char *codeword_array, int *p_binary_finish, unsigned char structapp_array[],
unsigned char *codeword_array, int *p_binary_finish, int *p_data_length, unsigned char structapp_array[],
int *p_structapp_size) {
int i;
@@ -1011,6 +1011,8 @@ static int dc_encode_message_segs(struct zint_symbol *symbol, const struct zint_
int inside_macro = 0;
uint64_t bin_buf = 0;
int bin_buf_size = 0;
/* GS1 raw text dealt with by `ZBarcode_Encode_Segs()` */
const int raw_text = (symbol->input_mode & 0x07) != GS1_MODE && (symbol->output_options & BARCODE_RAW_TEXT);
const struct zint_seg *last_seg = &segs[seg_count - 1];
@@ -1019,15 +1021,23 @@ static int dc_encode_message_segs(struct zint_symbol *symbol, const struct zint_
last_RSEOT = last_seg->source[last_seg->length - 2] == 30; /* RS */
}
if (raw_text && rt_init_segs(symbol, seg_count)) {
return ZINT_ERROR_MEMORY; /* `rt_init_segs()` only fails with OOM */
}
for (i = 0; i < seg_count; i++) {
ap = dc_encode_message(symbol, segs[i].source, segs[i].length, segs[i].eci, i == seg_count - 1 /*last_seg*/,
last_EOT, last_RSEOT, ap, codeword_array, &encoding_mode, &inside_macro, &bin_buf, &bin_buf_size,
structapp_array, p_structapp_size);
if (raw_text && rt_cpy_seg(symbol, i, &segs[i])) { /* Note including macro header and RS + EOT */
return ZINT_ERROR_MEMORY; /* `rt_cpy_seg()` only fails with OOM */
}
}
*p_binary_finish = encoding_mode == 'X';
*p_data_length = ap + *p_structapp_size;
return ap + *p_structapp_size;
return 0;
}
/* Convert codewords to binary data stream */
@@ -1269,8 +1279,10 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
}
}
data_length = dc_encode_message_segs(symbol, segs, seg_count, codeword_array, &binary_finish, structapp_array,
&structapp_size);
if (dc_encode_message_segs(symbol, segs, seg_count, codeword_array, &binary_finish, &data_length,
structapp_array, &structapp_size)) {
return ZINT_ERROR_MEMORY; /* `rt_cpy_seg()` etc. only fail with OOM */
}
/* Suppresses clang-tidy clang-analyzer-core.UndefinedBinaryOperatorResult/uninitialized.ArraySubscript
* warnings */