Commit graph

1221 commits

Author SHA1 Message Date
gitlost
7246d67175 gs1/gs1_lint: update to latest gs1-syntax-dictionary, removing
`iso3166list` linter and adjusting all others to allow for
  multiple optional linters (by checking `data_len` vs `offset`)
library: change invalid `input_mode` reset to return warning;
  split func table into 2 - func declarations without prototype
  will be error in C23;
  make invalid symbology check a separate function using a table
  and call near beginning of `ZBarcode_Encode_Segs()`;
  in `ZBarcode_BarcodeName()` save some bytes by simplifying
  name table and removing "BARCODE_" prefix from entries
output: fix pack logic to use pragma by default (actually more
  portable than `__attribute__`)
common.h: remove C99 detection which was artifice of specifying
  "-std=", and rejig layout to be more logical
BWIPP: update to latest version
general: change `ZINT_VERSION_BUILD` tests to `#if`s
general: further fiddling with some tables to save a few bytes
CLI: change function arg `optarg` -> `arg` so doesn't shadow
  global
general: library now compilable with Comp Cert C (though as it
  doesn't support `alloca()` will have multiple memory leaks)
2024-06-27 23:00:13 +01:00
gitlost
d70edce067 iso4217: new ISO 4217 currency code 924 for ZWG (amendment no. 177)
(gs1-syntax-dictionary commit [d64e28d])
  TODO: remove 932 ZWL 1 Sept 2024
2024-06-21 16:31:19 +01:00
gitlost
d97fc7e110 CMake: use "GNUInstallDirs" instead of old (2008) KDE
"SetPaths.cmake" (removed) - resolves absolute paths in
  "zint-targets.cmake", ticket #318, props John Alexander;
  also remove "FindZint.cmake" install as not best practice
  (Daniel Pfeifer “Effective CMake"), but retain in tree for now;
  also remove APPLE stuff re UNIVERSAL build, obsolete, and
  setting of CMAKE_OSX_SYSROOT, seems unnecessary
2024-06-21 15:18:00 +01:00
gitlost
04e8cacb81 gs1: Update to latest version of gs1-syntax-dictionary with new AIs
7250-7259 (GSCN 22-246), new checkers `yyyymmdd()`, `iso5218()`,
  `posinseqslash()`; allow for new "?" flag in "gen_gs1_lint.php"
2024-05-29 22:52:34 +01:00
gitlost
a1aefdc50b test_library: suppress size_t -> int warning
getopt: suppress `-Wdeprecated-non-prototype` warnings
2024-05-28 02:39:49 +01:00
gitlost
eb035a6372 GUI: fix foreground/background picker invocations (broken
[f3a982c1dd])
AZTEC/CODE16K/CODEONE/DATAMATRIX/DBAR_EXP/GRIDMATRIX/HANXIN
/MAILMARK_4S/PDF417/MSI_PLESSEY/QRCODE/RMQR/TIF/ULTRA/USPS_IMAIL:
  lessen storage of some tables by using least integral size
  required (saves ~3K); reformat some tables, comments
AUSPOST/AZTEC: remove unnecessary int casts on array indexing
CODE11/CODE39: move start/stop chars into one entry in tables to
  save a few bytes; some reformatting, comments
CODEONE: add `c1_` prefixes
common: more precise compiler/version checks
composite: add `cc_` prefixes; UINT -> unsigned short; use
  `sizeof()` instead of `strlen()` for `in_linear_comp` static;
  some reformatting, comments
EMF: use table instead of string for `ultra_chars[]`
GIF: remove unnecessary cast
library: use `sizeof()` instead of `strlen()` for static;
  add `consts` to `escape_char_process()` & use unsigned for `ch`
DBAR: use `dbar_`, `dbar_ltd_`, `dbar_exp_` prefixes
docs: update pandoc version
2024-05-27 23:19:45 +01:00
gitlost
0a00d04ccc CMakeLists.txt: check against c not c++ (CheckCXX -> CheckC etc)
BMP/EMF/PCX/TIF: use more portable packed attribute instead of
  pragma if not MSVC
CHANNEL: pass ptr not struct to `channel_copy_precalc()`
2024-05-27 20:55:04 +01:00
gitlost
3960dfdbfc AZTEC: workaround MSVC optimizer deciding not to emit code for
inner top/right/bottom/left loops of `az_populate_map()` by
  jiggling them around a bit, ticket #317, props Andre Maute
frontend/tests: clean up any directories created in `test_input()`,
  ticket #316, props Andre Maute
2024-05-27 03:06:27 +01:00
gitlost
55a7369cd8 output: out_fopen() fix _WIN32 def check (ticket #313, props
Axel Waggershauser)
2024-03-05 22:15:00 +00:00
gitlost
624574a64c As get_best_eci() can no longer return 0 remove caller checks
library: simplify dealing one-letter escapes into one case;
  other fiddlings (`first_err` -> `warn_number`)
2024-03-05 22:09:05 +00:00
gitlost
11b3c18aed ECI: get_best_eci(): just assert is_valid_utf8() as checked
prior to being called
manual: update to latest GS1 General Specifications (v24), pandoc
  (3.1.12.1)
2024-02-28 02:57:43 +00:00
gitlost
f0d8901d9e QRCODE: check fopen() return in ZINTLOG debugging code
(ticket #181, props Stf Ortm)
CODE128: suppress gcc -Wmaybe-uninitialized false positive (Release
  only)
CLI: add "isbn" synonym; save a few bytes using `char[]` rather
  than `char *`
2024-02-27 13:36:13 +00:00
gitlost
f312cdf630 CODE128: simplify bitmask in qr_add_version_info() (ticket #110,
props Daniel Gredler);
  check for next shift rather than next in `c128_dxsmooth()` to
  improve encodation on A/B shifting, props Daniel Gredler (Okapi)
2024-02-10 16:08:18 +00:00
gitlost
e167f5b534 test suite: zxing-cpp: adjust for returnCodabarStartEnd no-op;
allow for old "libpng" (`png_set_scale_16()` not available)
general: Solaris compat
library: use proper function ptr instead of `void *` for function
  table; warning suppression "-Wpedantic" -> "-Wstrict-prototypes"
GRIDMATRIX/HANXIN/QRCODE: `xx_define_mode()`: multi-dim `char_modes`
2024-02-06 13:01:35 +00:00
gitlost
7b41dfbee2 - 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)
2024-01-25 00:10:34 +00:00
gitlost
7c1bdba8ae output: use doubles when converting in out_colour_get_rgb()
and `out_colour_get_cmyk()`, to lessen chances of rounding
  errors (in particular for VC6)
test_large: fix regression in change to test for formatting
  `uint64_t` for `printf()`
win32/README: update MinGW/MSYS Qt version
2024-01-19 09:28:03 +00:00
gitlost
1449866d18 CMake: check for getopt_long_only() instead of just getopt()
so behaviour of CLI same
general: AIX compat, suppress some warnings
2024-01-17 21:55:11 +00:00
gitlost
bead450f38 - BMP/EMF/PCX/TIF: fix endianness on big-endian machines (note TIF
now always written as little-endian - simplifies testing)
- READMEs: add date updated
2024-01-17 01:45:45 +00:00
gitlost
cf04ac15b0 general: use explicit float consts rather than calced ones
manual: remove extra tags from "manual.txt" and clean up table
  captions
2024-01-09 18:38:21 +00:00
gitlost
f3a982c1dd fuzz.h: fix upper/lowercase flags
GUI: suppress clazy warnings
2024-01-05 22:55:57 +00:00
gitlost
d42eb13841 AZTEC: change max byte count from assert() to if as overlong data
can trigger it (fuzz_data (1st))
2024-01-04 22:43:41 +00:00
gitlost
3cb724253b Add fuzz stuff ("backend/tests/fuzz"), including OSS-Fuzz
"Dockerfile" etc
PDF417: lessen some debug verbosity
gif: use "gif_" prefix; some code fiddling
2024-01-04 20:11:04 +00:00
gitlost
2a55ba0cef GUI/manual/man page: bump year 2023 -> 2024 2024-01-01 13:26:49 +00:00
gitlost
3950b49050 filemem: fix fwrite() return check in fm_write();
test `ferror()` also in `fm_err()` if `err` zero and file
NetBSD: add instructions and some workarounds (`getopt_long_only()`
  in particular)
qzint: check `__GNUC__` version for "-Wstringop-truncation"
  suppression
2023-12-29 19:34:44 +00:00
gitlost
98f86727cc Add BARCODE_MEMORY_FILE to symbol->output_options to allow
outputting to in-memory buffer `symbol->memfile` instead of to
  file `symbol->outfile`, ticket #301
Add "README.clang-tidy" and ".clang-tidy" options file
Suppress some warnings
2023-12-27 19:20:19 +00:00
gitlost
070162214b - raster/BMP/GIF/PCX/TIF: fix dealing with very large data (use
`size_t` as appropriate)
- BMP: lessen heap memory usage by only `malloc()`ing a row, not
  whole file
- GIF: lessen heap memory usage by paging (also simplifies some
  function returns); use standard colour char map
- raster: add `raster_malloc()` to fail > 1GB (avoids very large
  output files that most systems can't handle; also lessens to
  some degree chances of being victim of OOM killer on Linux)
- GUI: printing scale dialog: set maxima on X-dim and resolution
  to keep scale <= 200
2023-12-22 21:29:54 +00:00
gitlost
6ff485e6fa Bump version to 2.13.0.9 (dev) 2023-12-18 10:28:14 +00:00
gitlost
a9b526be08 Version 2.13.0 2023-12-18 09:44:47 +00:00
gitlost
aba04df25e backend_tcl: add USE_TCL_STUBS & USE_TK_STUBS defines to
"zint_tcl.dsp"; remove previous note added to "readme.txt",
  props Harald Oehlmann
2023-12-18 08:57:49 +00:00
gitlost
c9f0e61d78 emf/eps: fix previous gws_left/right_fudge hack 2023-12-15 18:52:41 +00:00
gitlost
40a4bb9da0 vector: make sure BIND_TOP trumps BIND/BOX always (fixes extraneous
whjitespace at bottom of CODABLOCKF/CODE16K/CODE49 if BIND_TOP
  set); add left/right fudge to guard whitespace placements so
  appear closer to edge for SVG/qzint (undone by EMF/EPS)
2023-12-15 10:51:51 +00:00
gitlost
ecbd582cae manual: pandoc latest release (3.1.10)
test suite: UPNQR: input zxing-cpp
2023-12-14 11:03:50 +00:00
gitlost
406fa0b086 test suite: zxing_cpp: -hints -> -opts
BWIPP: update to latest version
2023-12-11 12:21:31 +00:00
gitlost
0a6280dd80 HANXIN/QRCODE: fix incorrect numeric costings (out-by-1) in
`qr_in_numeric()`/`hx_in_numeric()` (restrict to 3, not 4),
  ticket #300 (#16), props Andre Maute
manual: "Maxicode" -> "MaxiCode"; add max capacities for matrix
  barcodes
2023-12-09 10:07:11 +00:00
gitlost
de90de99ae man page: line separate --vers matrix tables
test suite: zxingcpp "rMQR" -> "RMQRCode"
2023-12-06 12:05:45 +00:00
gitlost
fe56c030b0 QRCODE: refactor last commit to separate out GS1 branch in
`qr_in_alpha()`
2023-12-05 22:47:46 +00:00
gitlost
885cf0610d QRCODE: fix qr_in_alpha() uneven percent check to be gs1 only,
causing incorrect mode costings leading to version 40 `binlen`
  < lower version, triggering assert, ticket #300 (#15), props
  Andre Maute
2023-12-05 19:00:01 +00:00
gitlost
ff992a4265 manual: fix rMQR dimension typo
tests: RMQR: do_zxingcpp
2023-12-04 19:22:00 +00:00
Schaich, Alonso
5e0458cb65 Unconditionaly include <stdio.h>
In `debug_print_escape`, `sprintf` is used invariant of `ZINT_TEST`
being defined or not, therefore the definition for `sprintf` also
has to be imported invariant of `ZINT_TEST`
2023-12-01 07:58:54 +09:00
gitlost
888db0bf00 QRCODE: fix out-of-bounds crash due to incorrect mode costings for
GS1 percents in `qr_in_alpha()`, ticket #300, props Andre Maute;
  also defensively re-calc version 40 mode to prevent possible
  further crashes
common: move `debug_print_escape()` from library to common
2023-11-30 09:12:11 +00:00
gitlost
db92c7de57 UPCA_CC/EANX_CC: fix out-of-bounds crash in AI resolve loop in
`gs1_verify()` by checking length before `to_int()`, ticket
  #300 (#11), props Andre Maute
CODEONE: fix out-of-bounds crash for Version T by upping buffer
  size to same as for A to H, ticket #300 (#12), props Andre Maute
GS1_128_CC: fix divide-by-zero crash in `calc_padding_ccc()` by
  allowing for min linear width 68 in `cc_width` calc, ticket #300
  (#13), props Andre Maute
BWIPP: update `bwipp_dump.ps` to latest version, update
  `gen_gs1_lint.php` to accommodate `req` "+"
PDF417: change `liste[]` int -> short to lessen stack usage
Some variable name and code fiddlings
2023-11-28 08:58:56 +00:00
gitlost
e9203439b7 backend/tests: some tabs -> spaces 2023-11-27 13:47:38 +00:00
gitlost
a14fe77aa0 EANX_CC/UPCA_CC: fix crash in dbar_date() on not checking length
in `cc_binary_string()`, ticket #300 (#5 & #6), props Andre Maute;
  add other checks for length on processing encoding mode
PDF417: fix out-of-bounds crash on overrunning string and codeword
  buffers by tripling size (convert to `short` instead of `int` to
  guard against too much stack), ticket #300 (#7 & #10), props Andre
  Maute; (TODO: add some checks instead to bail out earlier?)
CODEONE: fix looping on latch crash in `c1_encode()`, ticket #300 (#8),
  props Andre Maute
CODABLOCKF: fix crash on negative overflow of `columns` (`option_2`),
  ticket #300 (#9), props Andre Maute
library: add `debug_print_escape()` helper for ZINT_DEBUG_PRINT
2023-11-27 12:55:53 +00:00
gitlost
77c1ef1139 CODEONE: fix out-of-bounds crash in c1_c40text_cnt() not
accounting for extended ASCII shifts, ticket #300 (no. 4),
  props Andre Maute
2023-11-25 16:31:48 +00:00
gitlost
dfc4049932 API: add ZBarcode_Reset() to clear and restore zint_symbol to
its default state
library: fix dealing with ZINT_WARN_HRT_TRUNCATED in `error_tag()`
  when `WARN_FAIL_ALL` set
2023-11-24 18:04:33 +00:00
gitlost
0601b580b2 aztec: GUI: fix layers calc from width;
add overrun check of `adjusted_string` before padding in
  user-specified size case but probably can't happen;
  various fiddlings with code to make a bit more concise
2023-11-24 15:34:08 +00:00
gitlost
86748999a4 AZTEC: fix another out-of-bounds crash when user-specified size given
ticket #300 (no. 3), props Andre Maute
2023-11-24 10:30:57 +00:00
gitlost
7c4a538248 AZTEC: fix out-of-bounds crash when user-specified size given,
ticket #300, props Andre Maute;
  fix 4-layer compact block max (76 -> 64);
  fix encoding of byte-blocks > 11-bit limit
library: fix 21-bit Unicode conversion in `escape_char_process()`;
  fix restricting escaped data length by using de-escaped length to
  check (`escape_char_process()` adapted to do length only calc
  also)
2023-11-23 16:31:44 +00:00
gitlost
06ae7c1b7a CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/
MSI_PLESSEY/FLAT/DAFT/TELEPEN/TELEPEN_NUM: increase allowed
  lengths to max or near-max possible in 1152 modules for most
  (all?) variable length input linear barcodes
USPS_IMAIL: suppress bogus clang-tidy warning re garbage value
  (doesn't take `strlen()` into account?)
2023-11-22 00:45:30 +00:00
gitlost
4b57fb8021 PDF417: fix out-of-bounds crash in pdf_text_submode_length() by changing
`pdf_num_stay()` to not call it if previous/next block is BYT;
  also extend `pdf_asciix[]` to full 256 byte range (defensive & also can
  use directly rather than checking range, ticket #300, props Andre Maute
2023-11-21 22:39:07 +00:00