Commit graph

288 commits

Author SHA1 Message Date
gitlost
fcb3f9b422 GS1PARENS_MODE: allow parentheses in AI data if backslashed and
in `ESCAPE_MODE`
composite: empty primary now returns `ZINT_ERROR_INVALID_DATA`
  rather than `ZINT_ERROR_INVALID_OPTION`;
  check that primary NUL-terminated
library: check that `outfile` NUL-terminated
gs1: preface all routines and linters with "gs1_"
general: some code fiddling
2025-04-24 18:40:50 +01:00
gitlost
51ebca182c Re commit [789e04] and [86363f] allow prefixes without check digit 2025-04-21 18:45:23 +01:00
gitlost
3592edd64e - Add new symbologies BARCODE_EAN8, BARCODE_EAN_2ADDON,
`BARCODE_EAN_5ADDON`, `BARCODE_EAN13`, `BARCODE_EAN8_CC` and
  `BARCODE_EAN13_CC` as replacements for `BARCODE_EANX`,
  `BARCODE_EANX_CHK` and `BARCODE_EANX_CC` and use in CLI/GUI
  (`BARCODE_EANX` etc. marked as legacy)
- For EAN/UPC accept space as alternative add-on separator to '+',
  and accept GTIN-13 format with & without 2-digit or 5-digit
  add-on (no separator)
- Buffer length of member `errtxt` in `zint_symbol` extended 100
  -> 160 (will be sufficient for eventual translation and
  gs1-syntax-dictionary errors hopefully)
- UPC-E: warn if first digit of 7 (or 8 if check digit given) not
  '0' or '1'
- manual: update for new EAN symbologies and mention EANX now
  legacy but still supported
2025-04-16 22:26:43 +01:00
gitlost
26805338f8 RAW_TEXT: expand UPC-A, UPC-E to EAN-13, and EAN-8 if has add-on,
and place any add-on data directly after (no separator)
EAN-8 + add-on: warn as non-compliant (see ZXing-C++ issue #883,
  https://github.com/zxing-cpp/zxing-cpp/issues/883)
test suite: BWIPP: use new EAN-8 + add-on option "permitaddon";
  fix dumps of RAW_TEXT `memcmp()`s fails; various re-formatting
bwipp_dump.ps: update to latest BWIPP
2025-04-11 13:02:59 +01:00
gitlost
182c84fa4d MAILMARK_2D: fix postcode validation: no limited alphanumerics,
spaced-out DPS "outward"-only allowed, all-blank DPS allowed
  (ticket #334, props Milton Neal)
2025-04-09 00:10:51 +01:00
gitlost
86363ff0f7 ITF-14/EAN-14/NVE-18: allow check digit to be given and then
verified;
  allow and ignore prefixes "01", "[01]" and "(01)" (or "00" etc
  if NVE-18) if check digit given, following commit [789e04]
  (ticket #333)
2025-04-07 17:25:44 +01:00
gitlost
a74871a7de - CODABLOCKF: fix misencodation of extended ASCII 0xB0-0xB9 when
followed by digit (ignore 2nd byte of FNC4 when categorizing
  Code C characters)
- New `ZBarcode_Cap()` flag `ZINT_CAP_BINDABLE`, differentiated
  from `ZINT_CAP_STACKABLE`, and new Qt Backend method
  `isBindable()`
- CLI: fix `separator` check to use new `ZINT_CAP_BINDABLE` instead
  of `ZINT_CAP_STACKABLE`
- ZBarcode_Cap: add missing symbologies to `ZINT_CAP_BINDABLE` (was
  `ZINT_CAP_STACKABLE`)
- DOTCODE: pad rows if given number of columns instead of failing
  if rows below min (5)
- DBAR/composites: ensure stacked symbologies and composites are
  not stacked (set `symbol->rows` to 0)
- test suite: move `test_perf` routines into single test
  "test_perf";
  new "test_random" (based on "test_bwipp") to test various
  symbologies with random binary - discovered CODABLOCKF bug;
  expand "test_bwipp"
manual: Feeback: mention AZTEC -1 meaning min & MICROPDF417:
  doc new `ZINT_CAP_BINDABLE`
general: various code fiddlings and re-formattings
2025-04-03 16:08:15 +01:00
gitlost
a6c225447e 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++
2025-03-28 10:02:19 +00:00
gitlost
e12c5ed3ba DBAR_STK/DBAR_OMNSTK/DBAR_EXPSTK (including composites): output HRT
if `BARCODE_RAW_TEXT`
manual: default to always making html
2025-03-10 01:22:52 +00:00
gitlost
d222add96d - AZTEC/CHANNEL/CODABLOCKF/CODE16K/CODE49/CODEONE/DATAMATRIX/
DOTCODE/GRIDMATRIX/HANXIN/MICROPDF417/MICROQR/PDF417/QRCODE/
  RMQR/ULTRA: set `option_1/2/3` to values used in encodation
  ("Feedback options"), and add new access methods
  `encodedOption1()` etc. to Qt Backend, and use in GUI to provide
  better feedback on "Automatic" selections
- AZTEC: give more precise warnings in low ECC situations, and
  indicate via `option_1` by setting to -1 (min 3 words), 0
  (<5% + 3 words) (`ecc_ratio`)
- set_height: fix non-compliance false positives by using epsilon
  in checks (prompted by CODABLOCKF non-compliant warning for
  zint-generated compliant height - floating point `rows` mult !=
  `zero_count` div; one test regression for CODE93);
  better warning messages on non-compliant heights (min/max)
- manual/man page: fix DATAMATRIX Sizes tables "28 12x26" ->
  "27 12x26"
- GUI: AZTEC/CODEONE: add Zint versions to comboboxes
- DOTCODE: improve error messages re size too small/large
- ULTRA: better ZINT_TEST codeword dump (ZINT_DEBUG_TEST)
- general: various tabs -> spaces; prettify main .rc files;
  trailing spaces; small amount of code fiddling (CODE16K)
2025-03-07 16:51:36 +00:00
gitlost
d0465375bb Add convenience API funcs ZBarcode_UTF8_To_ECI() and
`ZBarcode_Dest_Len_ECI()`, primarily for ZXingC++ but also useful
  in general
2025-03-02 20:50:55 +00:00
gitlost
81308f4957 Reinstate BARCODE_RAW_TEXT (note forgot to remove mention of
`ZINT_WARN_HRT_RAW_TEXT` in man page zint.1.pmd last time)
2025-02-25 16:45:28 +00:00
gitlost
d24ba5edc0 Bump to version 2.15.0.9 (dev) 2025-02-25 15:29:08 +00:00
gitlost
4896136bdb Version 2.15.0
To be released tomorrow 2025-02-25
2025-02-24 20:21:03 +00:00
gitlost
e4663e48cf Temporarily disable BARCODE_RAW_TEXT prior to 2.15.0 release, as
it's not stable yet. `text_length` is kept.
2025-02-24 14:11:03 +00:00
gitlost
c499620ff6 upcean: BARCODE_RAW_TEST: need "+" separator for add-ons, else can't
differentiate between EAN-13 and EAN-8 + EAN-5
cli: append "Ital. Pharma" to Code 32 description
dxfilmedge: code fiddle
2025-02-20 22:57:54 +00:00
gitlost
8e7931b147 Rename BARCODE_PLAIN_HRT -> BARCODE_RAW_TEXT and add warning
`ZINT_WARN_HRT_RAW_TEXT` if set when outputting HRT (ZXing-C++
  issue 883, props Axel Waggershauser)
README: Pharmacode -> One-Track, Pharmacode 2-trace -> Two-Track
2025-02-20 02:10:19 +00:00
gitlost
fef8b083b4 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
2025-02-15 20:32:55 +00:00
gitlost
b753382353 man page: fix Code 93 --vers=1 hide -> show default check digits 2025-02-06 22:45:54 +00:00
gitlost
3dcf99175e Bump to version 2.14.0.9 (dev) 2025-02-05 10:07:03 +00:00
gitlost
b157911e78 manual: update other GUI images (no real change) 2025-02-04 20:36:36 +00:00
gitlost
8e72d1919d manual: update GUI images 2025-02-04 16:13:39 +00:00
gitlost
e38185121e Version 2.14.0
To be released tomorrow 2025-02-05
2025-02-04 15:17:47 +00:00
gitlost
01d72607c6 GUI: suppress shadow var warning (macOS); update year
zint.h: update year
man: mention no HRT for raster scale < 1
README.bsd: NetBSD 10.0 -> 10.1
README.linux: Fedora 40 -> 41
update_version.php: mention make manual.html
2025-02-02 09:58:41 +00:00
gitlost
3f7cfd47c7 gs1: update to latest gs1-syntax-dictionary (new lint keyoff1());
in `key()` (& hence `keyoff1()`) check for GS1 Company Prefix
  length >= 4 (same as gs1-syntax-dictionary lints)
manual: update some standard years
2025-01-31 21:20:43 +00:00
gitlost
53cb29dbc6 backend_tcl/zint_tcl.vcsproj: put ZINT_VERSION in general defines
and remove from individual .c files;
  rename include dirs "C:\myprograms\tcl9.0" -> "C:\Tcl" and lib
  dirs "C:\myprograms\tcl9.0\lib" -> "C:\Tcl\lib";
  suppress some warnings
backend_tcl/zint.c: suppress some warnings
tools/update_version.php: update for "backend_tcl/zint_tcl.dsp" ->
  ".vcxproj"
manual.pmd: backend_tcl: fix "require package" -> "package require"
  and explain "C:\Tcl" may need adjusting
general: update copyright years in ".rc" files
library: remove needless `eci` zeroing in `set_symbol_defaults()`
  and make `barcode_seg_funcs` initialization consistent (147 now)
2025-01-29 16:54:59 +00:00
gitlost
a4b557786f backend_tcl: add "win/readme.txt"; fiddle with "readme.txt"
README:  copyright 2024 -> 2025; remove primarily Linux bit
manual: update Tcl instructions; copyright 2024 -> 2025;
  Data Matrix ECC200 -> ECC 200, mention previous standards by
  name;
manual/GUI: Pharmacode -> Pharmacode One-Track, 2-track Pharmacode
  -> Pharmacode Two-Track
backend/DEVELOPER: update
2025-01-22 08:13:42 +00:00
gitlost
62c54adb56 DATAMATRIX: fix mis-encodation by only doing special end-of-data
processing on last segment
DXFILMEDGE: error message XXX-XX -> NNN-NN, fix comments
README.bsd: update to latest Free/Open/Net, "Run" section
test suite: CODABLOCKF: extra tests from Okapi
test suite: support DATAMATRIX ^PROG, ZXing++ AZRUNE
manual/man page: CODEONE: fix WxH -> HxW and Version C width
manual: backtick literals
2025-01-18 04:20:53 +00:00
gitlost
7a9fdd6cd0 docs: fix url for DXFILMEDGE, add parity bit detail 2024-12-24 13:46:47 +00:00
gitlost
c2d79836ba DXFILMEDGE: revert barcode # 127 -> 147 for TEC-IT compatibility 2024-12-23 22:05:33 +00:00
gitlost
fe3907c2cb DXFILMEDGE: various tweaks:
change # 147 -> 127 to use up barcode # holes;
  use "common.h" funcs `str_to_uppercase()` -> `to_upper()`,
  `count_char_occurrences()` -> `chr_cnt()`;
  prefix defines with `DX_` and funcs with `dx_`;
  `ZINT_DEBUG_PRINT` -> `symbol->debug & ZINT_DEBUG_PRINT`;
  bools to ints; use `posn()` to check for slash (returns length);
  restrict line lengths to 118; suppress some clang-tidy warnings;
  normalize some error messages;
  check for single "A" if any (`sscanf()`);
  use compliant height default; some whitespace formatting;
Tcl: add DXFILMEDGE support
docs: document DXFILMEDGE; update to latest pandoc
test suite: ZXingCPP: DXFILMEDGE support
2024-12-23 20:52:08 +00:00
gitlost
86b6a0553b CODE128: optimize for extended ASCII as well using techniques from
BWIPP minimal encoding by Bue Jensen (BWIPP PR #278);
  new extra escape `\^@` to turn off manual switching
zint.h: increase `symbol->text` size 200 -> 256 (means that for
  the moment can no longer generate ZINT_WARN_HRT_TRUNCATED)
GS1_128/GS1_128_CC: warn if READER_INIT option used
CODE16K: move `c16k_set_a/b/c()` routines from "code128.c" and
  rename `c16k_` (also `C128_` defines to `C16K_`)
common: make `itoc()` simple macro which adds '0' (>= 10 now ':',
  ';' etc) and adjust `expand()` accordingly for slight speed-up
general: EXTRA_ESCAPE_MODE now implies ESCAPE_MODE
tests: update BWIPP to latest and enable CODE128AB ("suppressc");
  new test args '-n' (exclude func) and '-m' (match func)
2024-11-18 05:08:52 +00:00
gitlost
f1f283d6a1 docs: update doc images and ChangeLog for last commit [705b72] 2024-11-05 23:18:42 +00:00
gitlost
5e2044ff2e CODE128: reduce extended latch cut-off from 5 to 4 for better
encodation in certain cases (and no pessimizations found so far),
  props lyngklip (BWIPP);
  fix extended char latching when exactly 3 extended chars at end;
  count code set C (not digits) in loop deciding when to
  shift/latch to extended for better estimate
AZTEC: return warning if ECC < 5% (due to bit-stuffing when version
  given); return error if > 22 layers (Zint 26) for Reader
  Initialisation symbol requested for better error message
AZTEC/HANXIN/QRCODE: consolidate different ECC data size tables
  into one indexed by ECC
DBAR_EXP: check for reduced length <= 77 up front for better error
  message
HANXIN: use `malloc()` rather than `z_alloca()` for large binary
  array
QRCODE: `ecc_level` now 0-based (not 1-based)
MICROQR: consolidate different version end routines into one
  `microqr_end()` and use new `microqr_data` table to simplify code
MICROPDF417: use table for max codewords per column
library: centralize all error messages using new `errtxt()`,
  `errtxtf()`, `errtxt_adj()` funcs that protect `symbol->errtxt`
  from overflow, & try to make error messages more consistent
  thru-out, adding more feedback info to many, & use positional
  args "%n$" in prep for l10n (maybe);
  `is_sane/is_sane_lookup()` -> `not_sane/not_sane_lookup()`,
  returning 1-based position (zero on failure) instead of bool;
  `long` ints -> plain `int` (except those dealing with `ftell()`,
  `fread()` etc) as depend on int being 32-bits already
GUI: in "grpDATF.ui" use "PlainText" rather than "RichText" for
  tracker ratio examples as height of text messing up sometimes
manual: clarify Codablock-F length maximum & add examples
docs: README: pandoc 3.5, Ubuntu 24.04
CMake: use "-Wpedantic" for Clang only as GNU complains about
  `errtxtf()` positional args "%n$"
2024-10-27 21:33:33 +00:00
gitlost
34be69d241 library: check d/o escape seq value <= 255, better error messages
GUI: cliwindow: `#if _WIN32` -> `#ifdef _WIN32`, add "-Wundef"
  check to cmake
cmake: backend: add C90 (C89) compat compiler check
docs: update "README" pandoc, "README.linux" (Fedora 39 -> 40)
tests: test_png: add some more text examples
2024-09-29 15:18:56 +01:00
gitlost
b42d5baf4c gs1: New AIs 7041 (GSCN 23-272) (packagetype) and 716 (GSCN-24-157)
CODE49: Better error message on ZINT_ERROR_TOO_LONG
manual: Use floating pt notation for floating pt args on options
backend/tools/data: Remove overlooked "GB2312.TXT" from git
raster: `size2` -> `prev_size`; one line `malloc()`s
C25/CODE128: some code fiddling
tests/PNG: Add some more text examples
2024-09-18 03:40:45 +01:00
gitlost
93c3e27fba CODE128: Add minimal encodation algorithm (non-extended ASCII only)
from ZXing (props Alex Geller) - about 25-60% slower depending on
  data & stack heavy but does improve some outcomes when FNC1s
  present (GS1_MODE or manual) although not much else it appears
  (the previous algorithm was very good), but has a logical clarity
  the other lacked - funcs `c128_dxsmooth()` etc shared with
  CODE16K now moved there and renamed as `c16k_`;
  also fix extended char latching when exactly 4 extended chars
  at end
  also manual code set switching now honoured exactly even if
  immediate shift required;
manual: make explicit that AI "(00)" and "(01)" prefixes added by
  Zint are HRT-only
general: add `extern "C"` wrappers to a few header files
2024-09-07 12:44:16 +01:00
gitlost
10747d6385 CODE128: Add new extra escape \^1 for manual insertion of FNC1s,
ticket #324, props Jim Shank;
  also improve encodation for a few limited cases;
  also some code fiddling
BWIPP: update to latest
raster: check for overflow on `size + size2` in `raster_malloc()`
vector: put `malloc()`s on one line for grep ease
docs: pandoc-3.3, clang-tidy-20
2024-09-03 11:55:55 +01:00
gitlost
fb3b3001aa - GS1: fix square brackets treated as FNC1 in GS1PARENS_MODE by
changing internal FNC1 marker '[' -> '\x1D' (GS), ticket #319,
  props Moli Sojet;
  also fix non-AI square brackets -> round brackets in GS1_128 HRT
- BWIPP: update to latest
2024-07-11 00:35:13 +01:00
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
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
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
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
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
6ff485e6fa Bump version to 2.13.0.9 (dev) 2023-12-18 10:28:14 +00:00