Commit graph

83 commits

Author SHA1 Message Date
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
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
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
323b34502b zint.h: increase symbol->text size 160 -> 200;
rename `ZINT_CAP_EXTENDABLE` -> `ZINT_CAP_EANUPC`
  (`ZINT_CAP_EXTENDABLE` marked as legacy)
CODE128: increase no. symbol chars max 60 -> 99
EAN-2/EAN-5: fix `BARCODE_BIND_TOP/BIND/BOX` output
GS1_128: warn if data > 48 (GS1 General Specifications max)
common: `is_extendable()` -> `is_ucpean()`
raster: add `ZFONT_HALIGN_CENTRE/LEFT/RIGHT` flags and process
  in `draw_string()` (for drawing EAN/UPC outside digits), and
  for `ZFONT_HALIGN_CENTRE` round when calculating centre
  (shifts some texts 1 pixel left)
raster/vector: use offsets into `symbol->text` for EAN/UPC
  instead of `out_upcean_split_text()` (removed)
BMP/EMF/GIF/PCX/PNG/PS/SVG/TIF: use new `out_colour_get_rgb()`
  routine (replaces `colour_to_XXX()`)
general: simplify/fix some `error_number` handling/returning
frontend: truncate overlong `--primary` instead of ignoring;
  negative floating pt option (for `--textgap`)
man page: list size detail for matrix symbols (`--vers`)
manual: further fiddling with scaling text; some typos
2023-11-19 19:39:54 +00:00
gitlost
607e4ed33a EAN/UPC: add quiet zone indicators option (API output_options
`EANUPC_GUARD_WHITESPACE`, CLI `--guardwhitespace`) (ticket #287)
EAN-2/EAN-5: HRT now at top instead of at bottom for standalones,
  following BWIPP
CLI: batch mode: don't close input if stdin
EAN/UPC: fix excess 1X to right of add-ons
Composites: fix excess whitespace; fix quiet zone calcs to allow
  for linear shifting
CLI: use own (Wine) version of `CommandLineToArgvW()` to avoid
  loading "shell32.dll"
Move "font.h" -> "raster_font.h"
EPS/SVG: use new `out_putsf()` func to output floats, avoiding
  trailing zeroes & locale dependency
EPS: simplify "TR" formula
SVG: change font from "Helvetica, sans serif" to "OCR-B, monospace";
  use single "<path>" instead of multiple "<rect>"s to draw boxes
  (reduces file size)
Add `EMBED_VECTOR_FONT` to `output_options` (CLI `--embedfont`) to
  enable embedding of font in vector output - currently only for
  SVG output of EAN/UPC
GUI: use "OCR-B" font for EAN/UPC and "Arimo" for all others (was
  "Helvetica" for both); paint background of screen preview light
  grey so as contrasts with whitespace and quiet zones
EMF: prefix funcs with `emf_`; simplify string `halign` handling
large: rename `large_int` -> `large_uint`
CODE128/common: move `c128_hrt_cpy_iso8859_1()` to
  `hrt_cpy_iso8859_1()` and add `ZINT_WARN_HRT_TRUNCATED` warning
  (for future use)
Various symbologies: replace `printf()` with `fputs()`
  (symbol->debug)
QRCODE: better assert(), removing a NOLINT (2 left)
CLI: add some more barcode synonyms for DBAR
common: various fiddlings
CMake: don't include png.c unless ZINT_USE_PNG (avoids clang
  warning)
2023-06-12 01:25:55 +01:00
Xiang Xiao
b4a20b24a2 fix warning: "_MSC_VER" is not defined, evaluates to 0 [-Wundef]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8e6cae855d7298e7b471ebf6456228f08fcb8918
2022-09-09 05:15:38 +08:00
gitlost
930f458979 backend: define z_alloca() and use for both Unix and Windows;
replace double-slash comments with old-skool slash asterisk ones;
  define uint16_t etc for Windows ourselves and remove ms_stdint.h &
  stdint_msvc.h as no longer used;
  (backend (excepting test suite) now C89 compatible)
LICENSE: move from backend to root and move COPYING to frontend, with
  copies in frontend_qt & backend_qt, so in where it applies;
  add LICENSE section from manual to root README
2022-07-14 16:01:30 +01:00
gitlost
0b3fe8db93 GUI: remove sizeConstraint so squashable again (sigh)
- make Sequence Format textbox bigger (on own line)
  - suppress question mark in Windows dialogs
AUSPOST: more standard error messages
backend: add & use z_isdigit/upper/lower() macros
docs: 20-bit Unicode -> 21-bit Unicode
2022-06-24 14:38:48 +01:00
gitlost
15b8024712 - library: check symbol->primary for escape sequences also
- GUI: error message GS1_MODE -> GS1 mode
- GUI: sequence window: fix initial clear button status
- GUI: make acceptable for macOS; add iconset for macOS, install
- manual: update macOS Homebrew install info; add README.macos
- GUI: export window: add no. of sequences to results label
2022-06-16 16:47:34 +01:00
gitlost
caadc87f7e Add support for ZXing-C++ verification (zxingcppdecoder)
DMATAMATRIX: fix look ahead BASE256 use of dm_text_sp_cnt() on switching;
  simplify dm_add_tail()
GUI: check suffixes on save so don't go into error state;
  use native path for Save As clipboard message
CODE128: use gs1_check_digit() for NVE18 and EAN14
2021-12-08 18:12:20 +00:00
gitlost
e14d9e99d5 Add HEIGHTPERROW_MODE_input mode flag (#204)
backend_qt: add encodedWidth, encodedRows
DBAR_EXPSTK: add max rows option (option_3)
CODE16K/CODE49: add min rows option (option_1)
GUI: HIBC xxx -> HIBC
2021-11-20 11:32:30 +00:00
gitlost
4e72a541f7 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
2021-10-30 22:00:31 +01:00
gitlost
fab7435fac Performance improvements for linear encoding and raster output
- use fixed-length string tables (mostly) instead of (char *) pointer ones
   (saves ~40K)
 - re-use C128Table for CODABLOCKF and CODE16K
   (required removal of Stop character and extra CODE16K-only entry)
 - use pointer to destination and copy (memcpy/strcpy(), bin_append_posn())
   instead of concatenating (strcat()) (mostly)
 - replace last remaining bin_append()s with bin_append_posn();
   bin_append() removed
 - add length arg to toupper() and expand() (avoids strlen())
 - change is_sane() to use table-based flags (avoids an iteration)
 - rename lookup() to is_sane_lookup() and change to check and return posns
   and use in pointer to destination loops (avoids strcat()s)
 - remove special case PHARMA in expand() (dealt with in pharma())
 - make #define SILVER/CALCIUM/TECHNETIUM/KRSET etc static strings
 - replace strchr() -> posn()
 - CODE128: populate destination once in checksum loop; re-use and export
   some more routines (c128_set_a/b/c(), c128_put_in_set()) for sharing;
   prefix defines (SHIFTA -> C128_SHIFTA etc) and existing exported routines
 - use factor XOR toggle trick in checksum calcs (avoids branch)
 - raster.c: fill out single 1-pixel row and copy using new draw_bar_line(),
   copy_bar_line() routines; similarly in buffer_plot compare previous line &
   copy if same (same technique as used to improve non-half-integer scaling,
   significant performance increase, (c) codemonkey82);
   also done for PNG (BMP/GIF/PCX/TIFF not done)
 - raster/vector/output.c: shorten "output_" prefix -> "out_";
   sync vector to other raster changes to try to keep source files similar
 - 2of5.c: prefix "c25_"
JAPANPOST: return error if input data truncated (backward incompatible)
DAFT: max chars 50 -> 100
common.c: istwodigit() -> is_twodigit()
common.c/emf.c/output.c: use some further stripf()s (MSVC6 float variations)
library.c: new check_output_args() helper
zint.h: add BARCODE_LAST marker and use in library.c
QRCODE: remove a NOLINT (requires clang-tidy-13), one remaining
CMake: separate no-optimize from ZINT_DEBUG into new ZINT_NOOPT option
2021-10-20 23:05:30 +01:00
gitlost
72eac41c34 Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
  static get_zint_version() method, use QStringLiteral (QSL shorthand),
  use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
  add saveAs shortcut, add main menu, context menus and actions, add help,
  reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
  lessen triggering of update_preview(), shorten names of getters/setters,
  simplify/shorten some update_preview() logic in switch,
  CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 00:13:39 +01:00
gitlost
3f33ed3eb9 CMakeLists.txt: cmake min required 3.13 -> 3.5 using CMAKE_REQUIRED_LIBRARIES; add ZINT_COVERAGE option
bmp/emf/ps.c: allow for foreground colour in ULTRA
bmp/gif/pcx.c: allow for BARCODE_STDOUT (fflush/fclose)
emf.c: hexagon rotation field not used; dont't use float index in font loop; Windows stdout binary mode
png.c: remove unused 8-bit; simplify libpng error handling and fclose outfile on error
ps.c: fix buffer overflow on colour_to_pscolor() CMYK
tif.c: fix BLACKISZERO indexes
CODE39: simplify check digit setting
reedsol.c: rs_uint_init_gf() log/alog tables must be zeroed
ZBarcode_Encode: debug: fix access out-of-bounds on non-NUL-terminated source if length < 10
manual.txt/zint.h: document NUL-terminated strings
tests: cover further cases for output (bmp/emf/etc), eci/gb18030/gb2312/sjis, reedsol, AZTEC, CODE39
2021-07-26 15:29:05 +01:00
gitlost
2e84fd5157 Replace WARN_ZPL_COMPAT with GS1NOCHECK_MODE 2021-07-13 17:39:03 +01:00
gitlost
3c1869b032 library: compat symbology 39 fix; ISBN: "X" check
WARN_FAIL_ALL: always return error: ZINT_ERROR_USES_ECI/NON_COMPLIANT
Fuller error messages; more comments zint.h
mainwindow.cpp: replace metaobject ENUM with array
  (suppresses virtual in constructor warning)
2021-07-06 19:53:31 +01:00
gitlost
8c419ab4fb DATAMATRIX/DBAR_LTD: some hacks to get around MSVC 2015/2019 x64 optimizer bugs 2021-06-27 15:58:27 +01:00
gitlost
52c00e59ba C25/DBAR: use new func gs1_check_digit() for common GS1 check digit calc
CODE11/CODE39/EXCODE39/CODE93/PZN/CHANNEL/VIN/DBAR/UPCEAN: fuller error messages
DATAMATRIX: look_ahead_test debug counts
DBAR: consolidate option_2 cols_per_row
CMakeLists.txt: restore -fno-var-tracking-assignments for gcc no DEBUG
overall: suppress various warnings on various configs
testcommon.c: clean-up
2021-06-27 11:47:55 +01:00
gitlost
c693482aa1 Change height and row_height array to floats; DAFT tracker ratio 2021-06-19 13:11:23 +01:00
gitlost
f9300cb37e gs1_verify: validate AIs from BWIPP gs1-format-spec.txt 2021-01-18 20:10:52 +00:00
gitlost
bee5f08f50 #209 rss.c, composite.c; DBAR_EXP encodation methods; symbol NO_PNG out.gif 2020-12-21 19:30:07 +00:00
gitlost
e41cb71fd1 DBAR_LTD: add 5 right guard spaces (ISO/IEC 24723:2010 6.2 (e)) 2020-09-11 08:07:21 +01:00
Robin Stuart
0004cfb35a Change symbol names e.g. RSS > GS-1 DataBar
Preserves old names in zint.h to retain backwards compatability.
2020-07-29 20:43:08 +01:00
gitlost
52d08fd9b9 #191 clang-tidy reduce NOLINTs using asserts, remove DeadStores 2020-07-19 10:31:12 +01:00
gitlost
e90c273165 RSS_EXPSTACK: #200 use num_columns logic for right-to-left logic 2020-07-15 11:41:09 +01:00
gitlost
c1fb51ba42 rss.c: some fixes for separators, allow check digit, refactoring; bwipp_dump.ps 2020-07-10 19:39:32 +01:00
gitlost
e8a238aad1 large.c: replace binary_load/add() etc with uint64_t based large_load/add() etc for performance 2020-06-14 14:42:40 +01:00
gitlost
56f0616747 #181 OSS-Fuzz AZTEC fix, check binary_string buffer not full using az_binary_append() func 2020-03-28 22:50:55 +00:00
Robin Stuart
20d5dcc50f Update GS-1 DataBar Stacked seperator
Expected behaviour found to slightly differ from what was implemented
Discovered and documented by Daniel Gredler. Fixes #183
2020-03-28 16:09:24 +00:00
gitlost
bca82ecc0d libzint.so: suppress exporting INTERNAL functions to the shared library; ZINT_TEST 2019-12-19 00:37:55 +00:00
gitlost
3b87cd4ec6 EAN128_CC ecc, cc_width, rows and alignment adjustments 2019-11-05 14:16:48 +00:00
gitlost
c87c86e30a Remove redundant numeric mode check in last digit processing 2019-10-31 02:31:55 +00:00
gitlost
1dd4b08986 Uses general_field_encode in rss_binary_string; min 4 chars; bottom separator 2019-10-31 02:01:42 +00:00
gitlost
739793a215 Always parse input as GS1 for EAN128 and RSS_EXP 2019-10-17 10:06:21 +01:00
Robin Stuart
ff2ceea361 Allow selection of GS1 mode on GS1 symbols
Because some symbols require GS1 data, selecting GS1 mode for them would result in GS1 parsing being done twice, corrupting the data.
Fixes #165 reported by Gregory Van Vooren
2019-10-06 11:30:21 +01:00
gitlost
d76cdd615b Fixes for eci, binary div, upce, other 2019-09-01 20:23:15 +01:00
Robin Stuart
909e307636 Prevent latch to incorrect mode when GTIN starts with 9
Fixes #97 reported by Karl Karlsson
2018-04-18 20:24:21 +01:00
Boris Zentner
31cc0ae78a Remove spaces before EOL 2017-10-25 17:23:57 +01:00
Boris Zentner
45441a6da7 Fix mixed unix / windows EOL 2017-10-25 17:15:35 +01:00
Harald Oehlmann
f83e5b1501 Make compile with MS-VC6 2017-10-16 19:26:54 +02:00
Rodrigo Torres
4963a772db Refactor 2017-09-11 19:21:33 +01:00
Robin Stuart
1882d76b70 Update version to 2.6.1 2017-08-27 09:31:02 +01:00
Robin Stuart
608b4b9134 Audit of error codes 2017-07-27 16:01:53 +01:00
Robin Stuart
19c3755ed0 Simplify conversion to binary with common function
No change to functionality
2017-05-14 08:15:08 +01:00
Robin Stuart
6f4610aa98 Add verbose mode to output debug info without recompiling 2017-04-11 10:05:38 +01:00
Boris Zentner
63a252a573 Remove superfluous code 2016-10-30 17:10:36 +00:00
Robin Stuart
4561a66067 Add identifiers to error messages
To ease the debug process
2016-10-28 22:40:40 +01:00
Robin Stuart
cfda2067b1 Improved handling of partial row data
Bug reported by Edgard Lima and fixed by Milton Neal
2016-10-15 10:54:23 +01:00
Robin Stuart
dd80371b17 Enforce DataBar height restrictions 2016-10-14 18:56:49 +01:00