mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-18 18:37:07 +00:00
Add text_length (length of text) to zint_symbol, and new
`BARCODE_PLAIN_HRT` option for `output_options` - for use primarily by ZXing-C++ but may be generally useful; centralize setting of HRT using new common `hrt_cpy_nochk()` etc. routines to ensure `text_length` always set PLESSEY: add show default check characters option CODE32: ignore `option_2` (check digit options) PZN: ignore `option_2` (check digit options) except when indicates PZN7 only DPD: exclude DEL from ident tag also out_maybe_mkdir: fix `utf8_to_wide()` return (Windows only) general: replace use of `strcpy()` etc. (except for test suite) with `memcpy()`, `hrt_()` etc. in lib & `cpy_str()` etc. in CLI & `cpy_bytearray_left()` in backend_qt clang-tidy: update README reflecting above backend_tcl: use sizeof(primary) to check length; tabs -> spaces general: various code fiddling docs: pandoc 3.6.2 -> 3.6.3
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* pdf417_trace.h - Trace routines for optimal PDF417 optimization algorithm */
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2022-2023 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2022-2025 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@@ -33,12 +33,6 @@
|
||||
#ifndef Z_PDF417_TRACE_H
|
||||
#define Z_PDF417_TRACE_H
|
||||
|
||||
#ifndef PDF_TRACE
|
||||
#define PDF_TRACE_Edges(px, s, l, p, v)
|
||||
#define PDF_TRACE_AddEdge(s, l, es, p, v, t, e) do { (void)(s); (void)(l); } while (0)
|
||||
#define PDF_TRACE_NotAddEdge(s, l, es, p, v, t, e) do { (void)(s); (void)(l); } while (0)
|
||||
#else
|
||||
|
||||
static int PDF_TRACE_getPreviousMode(struct pdf_edge *edges, struct pdf_edge *edge) {
|
||||
struct pdf_edge *previous = PDF_PREVIOUS(edges, edge);
|
||||
return previous == NULL ? PDF_ALP : previous->mode;
|
||||
@@ -61,8 +55,9 @@ static void PDF_TRACE_EdgeToString(char *buf, const unsigned char *source, const
|
||||
|
||||
static void PDF_TRACE_Path(const unsigned char *source, const int length, struct pdf_edge *edges,
|
||||
struct pdf_edge *edge, char *result, const int result_size) {
|
||||
struct pdf_edge *current;
|
||||
PDF_TRACE_EdgeToString(result, source, length, edges, edge);
|
||||
struct pdf_edge *current = PDF_PREVIOUS(edges, edge);
|
||||
current = PDF_PREVIOUS(edges, edge);
|
||||
while (current) {
|
||||
char s[256];
|
||||
char *pos;
|
||||
@@ -72,8 +67,7 @@ static void PDF_TRACE_Path(const unsigned char *source, const int length, struct
|
||||
assert(pos);
|
||||
len = strlen(result);
|
||||
if ((pos - s) + 1 + len + 1 >= result_size) {
|
||||
result[result_size - 4] = '\0';
|
||||
strcat(result, "...");
|
||||
memcpy(result + result_size - 4, "...", 4); /* Include terminating NUL */
|
||||
break;
|
||||
}
|
||||
memmove(result + (pos - s) + 1, result, len + 1);
|
||||
@@ -131,6 +125,5 @@ static void PDF_TRACE_NotAddEdge(const unsigned char *source, const int length,
|
||||
new_size, edge->units, edge->unit_size, edge->size);
|
||||
}
|
||||
|
||||
#endif /* PDF_TRACE */
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif /* Z_PDF417_TRACE_H */
|
||||
|
||||
Reference in New Issue
Block a user