Commit graph

1182 commits

Author SHA1 Message Date
gitlost
ab3cf4f395 eci.c: replace libiconv-adapted code with own implementations so
as to fully comply with BSD license (for why Library GPL 2+ not
  compatible see https://opensource.stackexchange.com/a/6701),
  ~3% slower (maybe), +~6K extra in data
  (gb18030.c, gb2313.c & sjis.c removed, mapping .TXT files moved
  to backend/tools/data & extra ones added, 2 new PHP generators)
GUI: CODE39/EXCODE39: show/hide HIBC check digit option in addition
  to enable/disable (less confusing)
CLI: batch: pedantic check for EOF using intChar in newline fgetc()
  loop
test_args.c: don't use WIFEXITED(), WEXITSTATUS() on Windows
manual: lessen some copy/paste verbiage by referring back, other
  small tweaks/typos
2022-06-02 20:32:25 +01:00
gitlost
d9f2e85246 GUI: export dialog: add postfix field for filename (#252)
man page: expand --scale spiel, mention MaxiCode exceptionalism
manual: make MaxiCode scale exceptionalism a bit clearer
2022-05-25 13:44:45 +01:00
gitlost
71e72d7ecb Bump version to 2.11.0.9 (dev) 2022-05-24 21:52:02 +01:00
gitlost
6ac8c85dbb Update zint version to 2.11.0 2022-05-24 21:08:51 +01:00
gitlost
719613d4c3 GRIDMATRIX: default char set is GB 2312 only, not Latin-1 with GB 2312 alt
HANXIN/QRCODE: use Hanzi/Kanji modes when compatible ECIs given
manual: one true source now manual.pmd from which manual.txt is generated
CLI: man page moved from frontend/zint.1.gz to docs/zint.1.gz, now
  generated from docs/zint.1.pmd
add README.linux to root dir
2022-05-19 10:17:51 +01:00
gitlost
9aae557cdc CLI/Tcl: fix version check (need <= 999 for DAFT permille)
UPNQR: fix required binary mode using mode_preset
UPNQR: allow mask to be manually specified
GUI: use non-native QColorDialog on Unix also; no noEXE for CLI equivalent;
  add shortcuts for copy-to-clipboard and CLI equivalent
CLI: new --version option to print Zint version
2022-05-12 20:35:06 +01:00
gitlost
f58c80e290 Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
  better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
  namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-09 19:50:50 +01:00
gitlost
624d40021e ECI: Update ECIs to AIM ITS/04-023:2022, adding UTF-16BE (was USC-2BE),
UTF-16LE, GBK, separate GB18030, UTF-32BE, UTF-32LE
  add examples to tests for DATAMATRIX, HANXIN, QRCODE
HANXIN: Remove alternating filler in function information;
  GB 18030 now ECI 32 (previously used ECI 29);
  fix gate-posts on codeword limits
  use new ZXing-C++ HanXin detector (diagnostics2 branch) for tests
  check against ISO/IEC 20830:2021 (no substantive changes)
backend_tcl: update ECIs; NOTE: changed names "unicode" -> "utf-16be",
  "euc-cn" -> "gb2312"
GRIDMATRIX/HANXIN/QRCODE/RMQR: warn if auto-conversion (i.e. no ECI given)
  occurs to resp. specialized char sets (GB 2312/GB 18030/Shift JIS)
2022-04-10 11:12:18 +01:00
gitlost
69876619dd clang-tidy-14: suppress some further warnings using asserts (removed remaining NOLINT) 2022-04-02 10:43:45 +01:00
gitlost
8950f10c00 tests: zxing-cpp: allow EAN-8 with add-on 2022-03-30 14:39:31 +01:00
gitlost
f1c5a0e91a Update bwipp_dump.ps; fix DATAMATRIX bwipp test & run_bwipp_tests.sh 2022-02-13 13:53:18 +00:00
gitlost
d9b6284a67 gs1_lint.h: update to latest gs1-format-spec.txt, new AI 715 2022-02-10 22:18:35 +00:00
gitlost
e9d5bf8d88 FIM: add support for FIM E; update bwipp_dump.ps 2022-01-02 23:22:22 +00:00
gitlost
25807ad43c Matrix symbols: change horizontal boundary bars to appear outside any
vertical whitespace, as they're decorative rather than functional (#247)
Allow for dot overspill in height of vertical box sides (dotty mode)
Move is_dotty(), is_fixed_ratio() from library.c to common.c
2022-01-01 15:24:59 +00:00
gitlost
e8163c7933 Add missing dmatrix_trace.h ([b36fba]) 2022-01-01 15:20:30 +00:00
gitlost
eabf2ea10e FAST_MODE: update manual.txt ([b36fba]) 2021-12-18 17:18:35 +00:00
gitlost
b36fba8ba6 DATAMATRIX: new algorithm for (near-)minimal encoding, props Alex Geller
Add FAST_MODE input_mode flag and --fast CLI/Tcl option that selects older
  faster ISO algorithm (may be used by other symbologies in the future)
  and "Fast Encoding" checkbox to Data Matrix GUI
GUI: adds Zint version numbers to DATAMATRIX sizes.
2021-12-18 16:22:02 +00: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
0641a39530 gs1_lint.h: update to latest gs1-format-spec.txt (revert [41a050]) 2021-11-30 14:40:15 +00:00
gitlost
41a05077bc gs1_lint.h: update to latest gs1-format-spec.txt;
fix some bugs in gen_gs1_lint.php
2021-11-26 17:54:22 +00:00
liufanmin
c0e1af9859 fix function warning for testcommon.c and testcommon.h
Signed-off-by: liufanmin <liufanmin@xiaomi.com>
2021-11-25 20:09:30 +08:00
bijian
f761746011 ZBarcode_Create() -> ZBarcode_Create(void)
Signed-off-by: bijian <bijian@xiaomi.com>
2021-11-25 15:28:20 +08:00
gitlost
739a64a6ff GUI: add CLI equivalent dialog (#163); use spinboxes in Sequence dialog
and restrict sequence to max 10,000, add button icons;
   make Export dialog sizable and show every 100 results, add button icon;
   fix saving CHANNEL option, fix Export painting main window (Windows), fix
   guard descent not-resetting
 qzint: add getAsCLI(), warnLevel(), extra isStackable()/isComposite() etc
 Add ZBarcode_BarcodeName()
 manual: doc above, some fixes, tweaks
2021-11-23 19:12:48 +00:00
b'Git Lost
9d85c425f4 Merge /u/alonsoschaich/zint/ branch enable-qt-test-on-win32 into master
https://sourceforge.net/p/zint/code/merge-requests/141/
2021-11-23 13:05:37 +00:00
Schaich
1c31c92fd4 Enable the qt backend test on windows
The ```configuration``` is required by the visual studio generator to determine
whether to use a Debug or a Release setup (or a user customized one). It's
required by whatever uses that generator rather then just the GUI code.

Add instructions for the Visual Studio Project File generator to the README
and enable the test on Windows.
2021-11-23 21:51:31 +09:00
Schaich
609fbeb008 Pull addon_row_height out of the loop
The ```addon_row_height``` variable is conditionally initialized in some
branches, which also set ```addon_latch``` to one(true). Later in the loop's
body, ```addon_row_height``` is accessed if ```addon_latch``` is true.

Unlike ```addon_row_height```, ```addon_latch``` is defined outside of the
loop's body, and as it is never reset to zero, keeps it's value of one once
it has been assigned. Future iterations of the loop can therefore not branch
into the code that initializes ```addon_row_height``` and (re)assigns
```addon_latch```, and ```addon_latch``` will be true, which causes
```addon_row_height``` to be accessed without having been initialized.

On most platforms, the ```addon_row_height``` variable will always be
allocated on the same memory, while skipping the initialization causes
the value that was previously assigned to ```addon_row_height``` to
remain on that memory.

Pull the variable declaration out of the for loop's body to assure the
previous iteration's value remains there independend of compiler or
platform specific behaviour.
2021-11-23 20:04:56 +09:00
gitlost
9e4ecb638f CODE128/EAN14: fix debug printf bar spaces (not NUL-terminated) 2021-11-21 15:49:32 +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
96cf5aa668 DATAMATRIX: re [e9b8ee] add dm_text_sp_cnt() & dm_switch_mode() to get around
exiting B256 if have less than break-even sequence of TEXT chars;
  rename some vars to be more consistent
2021-11-16 18:37:51 +00:00
gitlost
e9b8ee9c1b DATAMATRIX: some changes to dm_look_ahead_test to allow exiting from B256
other than for digits (worse for TEX 7-11 embedded in extended) and for
  returning X12/EDI at EOD - will cause changes in encodation;
  allow for GS1 GS in B256 (should never happen);
  some re-jigging of dm200encode and fiddling with dm_isXXX;
  remove some DM_DEBUG from dm_placementbit
2021-11-14 12:09:51 +00:00
gitlost
21d015a84a TELEPEN: fix stop length (14 -> 12)
reedsol.c: some performance gain by stashing generated poly logs and
  pre-checking if has a zero coeff to avoid inner loop branch
2021-11-11 13:30:58 +00:00
gitlost
6c7f3300a0 DATAMATRIX: fix mis-encoding of FNC1/GS in EDIFACT in GS1 mode
(was writing a literal ']');
  improve performance by removing use of intermediate grid array;
  DEBUG -> DM_DEBUG
2021-11-09 13:43:56 +00:00
gitlost
68566fefd2 DATAMATRIX: fix mis-encodation of X12 and EDIFACT non-encodables by
checking in main dm200encode() loop, props Alex Geller;
  prefix routines and tables with "dm_"
reedsol.c: add const to a few variables
2021-11-08 13:05:37 +00:00
gitlost
f7ad0ed1e3 raster.c: fix possible blank rows appearing in CODE16K, CODE49, PHARMA_TWO,
PDF417 & CODABLOCKF due to height/scale rounding by changing
  out_large_bar_height() to return scaled int values for raster,
  props codemonkey82 (#204)
raster/vector.c: const some vars
vector.c: rect_count, last_start_row UPC/EAN only
library.c: check for stacking symbols >= 200
2021-11-07 00:21:02 +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
706f021637 gs1_verify(): fix zero-length AI no data and single-digit AI checks 2021-10-28 12:05:54 +01:00
gitlost
e8bde7f4c3 ZBarcode_Version() -> ZBarcode_Version(void) 2021-10-27 19:05:57 +01:00
b'Git Lost
9c3a346dbd Merge /u/gitlost/zint/ branch perf_is_sane into master
https://sourceforge.net/p/zint/code/merge-requests/134/
2021-10-21 23:00:40 +00:00
Jeff Skaistis
1f4691fbbb Fix version number format for STRINGFILEINFO resources. 2021-10-21 15:39:46 -05:00
Jeff Skaistis
d151f29ee5 Add .rc file to Windows backend build. 2021-10-21 09:53:22 -05: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
e8b59aa696 height max 500 -> 2000 to allow for 44 row CODABLOCKF at 45X each 2021-10-18 14:05:51 +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
206ae26d20 ULTRA: add revision 2 support (based on BWIPP 2021-09-28 update)
GUI: DMATRIX: disable DMRE if SQUARE checked; ULTRA: Size/Ecc buttongroup
2021-09-29 16:25:59 +01:00
gitlost
14c236644f Structured Append: fix DOTCODE codeword length allowance; manual.txt fixes 2021-09-29 15:06:33 +01:00
gitlost
c0791ad85e Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
  performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
  shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-28 21:42:44 +01:00
gitlost
e8b1f7a12e raster.c: fix clang garbage value warning 2021-09-27 11:11:22 +01:00
gitlost
eb6e5daa2d raster.c: need ceilf(large_bar_height * si) to avoid zero height rows;
also improve non-half-int interpolation performance
raster/vector.c: use new stripf() func in "common.c" to workaround gcc
  32-bit float calculation variations
gs1.c: allow dummy AI "[]" if GS1NOCHECK_MODE and has data (#204);
  also add note re TPX AI 235 and terminating FNC1
Remove trailing whitespace in various files
2021-09-26 23:55:16 +01:00
gitlost
9884875fd5 GUI: fix dot size label position 2021-09-25 14:44:32 +01:00
gitlost
4284f3c578 Add output_options BARCODE_QUIET_ZONES and BARCODE_NO_QUIET_ZONES 2021-09-24 13:21:24 +01:00
gitlost
4009c86c5f UPC/EAN: Add guard_bar descent (guard_descent)
zint.h: Adjust field order to improve alignments; encoded_data 143 -> 144
2021-09-22 00:04:15 +01:00
gitlost
9bae0b86f9 - raster.c: Need ceilf(symbol->height * si) to avoid heap-buffer-overflow;
also avoid distributive multiplication with floats to lessen chances of
  platform variation (#204 ARM-Cortex crash)
- raster.c: Don't allow for text if scale < 1.0
- raster.c: Cast some indexes to (size_t) to allow for large scale
- vector.c: Check malloc()s and return ZINT_ERROR_MEMORY on fail
- raster/vector.c: various var name changes & other code fiddling
- library.c: Check that scale/height/whitespace/border are reasonable values:
  scale (0.01-100), height (0-500), whitespace_width/height (0-100),
  border_width (0-100)
- CLI: allow both e.g. '-height' and '--height' (getopt_long_only())
- gif.c: fix GIF_ZLW_PAGE_SIZE -> GIF_LZW_PAGE_SIZE
- GUI: allow whitespace/scale to 100
2021-09-20 14:56:27 +01:00
gitlost
5766b39845 gif.c: use malloc instead of alloca for LZW buffer as fails for large scale 2021-09-18 17:15:16 +01:00
gitlost
bd06400a5b CODE93: add option_2 = 1 to display check chars in HRT 2021-09-13 18:49:25 +01:00
gitlost
86c15741d8 gs1.c: Allow 0-length AI data if GS1NOCHECK_MODE, props codemonkey82 (#204) 2021-09-13 17:54:46 +01:00
gitlost
9229634826 Suppress some pedantic warnings, props codemonkey82 (#204) 2021-09-12 23:37:44 +01:00
gitlost
f84f82d9a2 GUI: Separate out SCM fields for MAXICODE (Ticket #212)
vector.c: Enforce minimum scale 0.1 and allow down to 0.1 in GUI
2021-09-09 21:50:02 +01:00
gitlost
c4b7921819 library.c: error_tag(): check error_number < ZINT_ERROR on WARN_FAIL_ALL 2021-08-31 18:34:29 +01:00
gitlost
603f5931de CODE93: don't display check characters in HRT (as per standard Figure B1) 2021-08-28 20:17:26 +01:00
gitlost
bb6bb1e5ee emf.c: truncate multiplication to 3 decimal places (ticket #242) 2021-08-27 18:07:05 +01:00
gitlost
b568201574 MICROQR: some debug output, test case for ticket #241 2021-08-26 17:49:05 +01:00
gitlost
b7adbf4e5b vector: Add width to struct zint_vector_circle: fix qzint render 2021-08-23 22:54:27 +01:00
gitlost
3388f98c00 vector: Add width to struct zint_vector_circle & use for MaxiCode bullseye
**Incompatible change**
2021-08-22 13:59:01 +01:00
gitlost
67b2a9c99d RMQR: add ECI support; GUI/CLI: fix dev version test 2021-08-20 16:50:39 +01:00
gitlost
62cc9e49f5 Bump version to 2.10.0.9 (dev) 2021-08-14 16:11:25 +01:00
gitlost
71af3b530e win32/zint_cmdline_vc6/zint.rc, backend/libzint.rc: update copyright year 2021-08-11 21:46:57 +01:00
gitlost
a04a44f1e6 Update zint version to 2.10.0 2021-08-10 16:14:10 +01:00
gitlost
14d1140d09 CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow
RMQR: update to new draft ISO/IEC JTC1/SC31N000 (Draft 2019-6-24);
  allow for righthand vertical timing pattern in populate_grid()
ULTRA: update max size and min cols based on BWIPP 2021-07-14 update
backend_tcl/zint_tcl.dsp: use /MD instead of /MT for tcl lib compat;
  change include/lib path to more standard one
manual.txt: highlight that rMQR is still in development
GUI: use cross-platform smaller font func instead of explicit values for notes
2021-08-10 12:04:25 +01:00
gitlost
4d0fff7cf5 Changelog: update 2021-08-05 18:24:51 +01:00
gitlost
b015e38da0 composite: fix buffer overflow for large linear, small composite (500 -> 1000)
composite: clear errtxt when bumping from CC-A -> CC-B -> CC-C
composite: CC-C adjustment 53 -> 52 (same as BWIPP) with proper explanation
composite: remove unneeded > 11805 length check
CODEONE: remove unneeded extended ASCII check in C40 count
GS1_128/CODE16K: remove unneeded initial GS1 mode '[' check
PDF417: remove unneeded second option_2 > 30 check
Document some "Not reached" lines (code coverage)
Update bwipp_dump.ps
GUI: window/tab height +5 so 2 full lines for composite edit box (Ubuntu)
manual: dash -> hyphen, PDF417 "check digit" -> "error correction", DMRE ref
tests: further test cases for CODEONE/CODE16K/common/composite/DATAMATRIX/
DOTCODE/gs1/MAXICODE/PDF417/postal/QRCODE
2021-08-05 16:34:45 +01:00
gitlost
aa964ef91a emf.c: suppress clang-tidy warning 2021-07-26 15:55:34 +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
b'Git Lost
059abdf6a1 Merge /u/gitlost/zint/ branch gs1_nocheck_mode into master
https://sourceforge.net/p/zint/code/merge-requests/128/
2021-07-20 09:08:25 +00:00
gitlost
141cc0b866 cmake min 3.9 -> 3.13 so LINK_LIBRARIES available in try_compile()
cmake: hardcode -fsanitize=address for MSVC 2019
cmake: non-MSVC simplify setting sanitize address, undefined
test_code128: test_hibc_input: extra tests
2021-07-19 15:58:44 +01:00
gitlost
ef6e1ca1e3 POSTNET/PLANET: allow up to 38 chars (ZINT_WARN_NONCOMPLIANT) (see [d7ac9c]) 2021-07-13 19:56:53 +01:00
gitlost
2e84fd5157 Replace WARN_ZPL_COMPAT with GS1NOCHECK_MODE 2021-07-13 17:39:03 +01:00
gitlost
7cc2095d3c UPCE/UPCE_CC: allow check digit (same as UPCA/UPCA_CC) so selecting composite doesn't give error
composite.c: warning wasn't been passed back
zint.h/library.c: add const to char pointer args; move func defs around a bit
2021-07-12 22:27:16 +01:00
gitlost
7a1500afeb backend/CMakeLists.txt: output dir for zintconfig.h, props Andre Maute (#238); copyright/guard 2021-07-12 16:57:32 +01:00
gitlost
d7d787383e backend/tests/CMakeLists.txt: cmake min 3.18 -> 3.9, bwipp_dump.ps tar (#235) 2021-07-08 12:08:59 +01:00
gitlost
e1f22e0e72 CODE128: make cppcheck out-of-bounds suppression clearer (#233), props Andre Maute 2021-07-07 15:46:02 +01:00
gitlost
4d9aa96453 testUtilDataPath: use CMAKE_CURRENT_SOURCE_DIR env to work out-of-tree (#234) 2021-07-07 14:47:25 +01:00
gitlost
7379acd4a4 backend/tests/CMakeLists.txt: fix bwipp_dump.ps tar (#235), props Alonso Schaich, Andre Maute 2021-07-07 14:42:16 +01:00
gitlost
f03da2f4ba CODE128: suppress cppcheck out-of-bounds warning; plus others (#233) 2021-07-07 13:58:04 +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
7cd0d9ae22 CODABLOCKF: suppress cppcheck warning (#233) 2021-07-06 17:21:42 +01:00
gitlost
4d3aae45d0 testcommon: fix sizeof bug; AZTEC/QR: suppress cppcheck warnings (#233) 2021-07-06 12:13:34 +01:00
gitlost
9b02cd5221 CODEONE: is_last_single_ascii() out-of-bounds sp + 1, #232 CI-Fuzz, props Jan Schrewe 2021-07-05 11:52:43 +01:00
gitlost
bcf6eff93c testUtilDataPath: fix running from build subdir (#230) 2021-07-02 16:13:48 +01:00
gitlost
a312cd8e8e raster/output: use new isfintf() to test floats integral (CodeQL) 2021-06-30 11:57:21 +01:00
gitlost
37fac73cb1 DATAMATRIX/CODEONE: Use LCM in look ahead tests to avoid floats (#228) 2021-06-29 22:02:24 +01:00
gitlost
368633bda4 malloc/calloc: check for NULL always (11.1.0 gcc -fanalyzer -c backend/*.c)
ZBarcode_Encode: don't reinit symbol->outfile, props Alonso Schaich
frontend/test_args: skip long filename tests on Windows, props Alonso Schaich
2021-06-29 15:43:42 +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
542fed1d4f DATAMATRIX: strip extra precision in loop also (#228); AZTEC: move assert after error check (#229) 2021-06-26 00:27:04 +01:00
Schaich
ee3f25fada Detect Sanitizer support
Sanitizers require both front and backend support on the target platform.
Detect whether applications can be compiled and linked with sanitizer support
and enable sanitizers that can be both compiled and linked with.
check_c_compiler_flags is insufficient here, because we need library support
on top of just compiler support.

This implicitly disables sanitizer support for most cross-compiling and
embedded targets which use gcc or llvm based toolchains but don't have library
support, while enabling it on MSVC and Intel compilers.

While here, bind the sanitizer dependency to the zint library targets, and
remove the hardcoded no-var-tracking-assignments. variable assignment
tracking is a very powerful tool to find the true source of uninitialized
value based conditional jumps, and, if undesired, it can be disabled by
configuring the ASAN_OPTIONS environment variable.
2021-06-25 03:26:12 +09:00
gitlost
70801d8932 tests: VC6 compatible; plot_raster_dotty: avoid float rounding difference 2021-06-23 15:00:49 +01:00
gitlost
e5115bad07 Change height and row_height array to floats: VC6, CodeQL fixes 2021-06-20 00:05:45 +01:00
gitlost
c693482aa1 Change height and row_height array to floats; DAFT tracker ratio 2021-06-19 13:11:23 +01:00
gitlost
22a6c583af test_raster/vector: add height test in prep for float height MR; AZTEC: suppress clang-tidy warning 2021-06-18 01:03:33 +01:00
gitlost
21a4e2c1f6 data file tests: fix [32af28] generate data directory test 2021-06-16 17:56:32 +01:00
gitlost
f6a90c5a48 AZTEC: re MR #122, use printf .* for debug, remove unneeded inits 2021-06-16 17:45:25 +01:00
Schaich
6673289944 Initialize local variable
In `aztec_text_process`, `binary_string`, which aliases to `aztec`'s
`bit_pattern` has it's first element set to NUL. However, when the string
is later written into using `bin_append_posn`, that NUL is overwritten and
further NUL to replace it is not appended.

In general, the garbage collected memory content should never be assumed to
have a specific value unless a value was explicitly assigned, so the content
of `bit_pattern` cannot be safely assumed to be NUL.

If the string is not NUL terminated, functions relying on NUL termination,
such as the printf call at the end of `aztec_text_proccess` itself,
will overrun the array bounds.

Explicitly initialize `bit_pattern`
2021-06-15 17:42:28 +09:00
gitlost
32af280254 testcommon: add testUtilDataPath() (uses getcwd()) so generate works for data files, remove copy 2021-06-14 00:48:29 +01:00
gitlost
8ff15d805a CODABAR: fix [69c1b4] errtxt; CLI: _WIN32, fuller error messages; win32/README: Administrat-or 2021-06-12 16:01:16 +01:00
gitlost
69c1b4cbf0 CODABAR: better error messages; win32/README, zint_cmdline_vc6/readme.txt: fixes 2021-06-10 18:04:27 +01:00
gitlost
ede1234b8f Re MR #121 calcium -> static; reinstate STATIC_UNLESS_ZINT_TEST error_tag/strip_bom; whitespace 2021-06-10 16:20:14 +01:00
Schaich
43d7493cf2 Remove unused variable 2021-06-10 22:46:10 +09:00
Schaich
dce51ceb6d Use "human readable" file mode 2021-06-10 21:01:34 +09:00
Schaich
afea0ad2c3 Get test_library compiled on windows
test_file_unreadable cannot be implemented easily, as files are always
readable by their owner on windows. While `_chmod` is available in the POSIX
compatibility function set, it cannot be used to take away read permissions,
either.

While here, move functional code out of any assert statements. It shall be
executed even when the assertions are disabled
2021-06-10 21:00:42 +09:00
Schaich
e7947dc9a4 Merge String Constant
The `CALCIUM` "name" is a macro which expands to a string constant.

Referencing the macro twice will cause it to be expanded twice, resulting
in two string instances which have identical content. By default, gcc will
deduplicate these two strings into the same memory region as gcc detects
the duplicated constant, even when optimization turned off (see
-fmerge-constants and -fmerge-all-constants GCC options).

The C Language specification does not require duplicated constants to be
deduplicated, and, in fact, the GCC manual page also explicitly states
this optimization is not performed for all targets.

Visual C++, in debug mode, does not deduplicate constants. This results
in `count += strchr(CALCIUM,x) - CALCIUM` yielding to negative values as
the substracted CALCIUM's expansion resides on a greater memory address
then the memory allocated for the expansion passed to `strchr`. The
value of `count` is used to compute the checksum, which then is not only
faulty, but also used as an array index without previously checking
whether or not the index is within the array bounds (modulo of a negative
integer is negative, which means out of bounds). This will cause very
difficult to predict behavior, in most cases, however, it will cause a
segmentation fault.

Manually allocate a memory range to contain the string, and use
this range instead of expanding the macro multiple times.
2021-06-10 20:29:04 +09:00
gitlost
4a8cac2a5a CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs
PLESSEY: add options NCR weighted mod-10, hide check digit(s) in HRT
test suite: now runnable under MSVC 2019, 2017, 2015, MinGW/MSYS
win32/README: update with MSVC 2019 and CMake instructions
2021-06-10 11:15:39 +01:00
Schaich
f471bb6e50 Export the INTERNAL functions
The testcommon library, which is outside of this link unit, is
referencing the INTERNAL functions, so despite the name they
need to be exported. The export code is copy&pasted from the
ZINT_EXTERN definition which can't be reused over preprocessor
limitations.

We might just use ZINT_EXTERN instead though
2021-06-02 21:14:14 +09:00
Schaich
00199c7ef5 The zint library always is shared
The SHARED attribute is forced via the add_library, so the default
value of cmake is ignored. Also, this option should obviously not
be set for the `zint-static` library
2021-06-02 21:14:14 +09:00
Schaich
2221cb1e83 Fix "most" compilation issues MSVC has
test_library is still broken
2021-06-02 21:14:14 +09:00
Schaich
88bbeb862b Move getopt out of the frontend, because it's used in the backend's test, too 2021-06-02 21:14:14 +09:00
Schaich
779a318c93 The testRun function uses getopt(), which is troublesome because the bundled implementation is part of the front-end 2021-06-02 21:14:14 +09:00
Schaich
3114a6697b Factor out the zint_add_test macro 2021-06-02 21:14:14 +09:00
Schaich
9ff3f13c19 Optionalize the PNG and the Qt dependencies
Expose the ability to turn these dependencies off, which results in reduced
functionality. However, it enables a developer using the zint library to
instruct cmake to build a libzint as deployed by e.g. build servers which
don't have png/zint installed, without having to uninstall those libraries
from the development system
2021-06-02 21:14:14 +09:00
Schaich
fd656358a3 Add zint-test's testcommon include directory to consumers of the library 2021-06-02 21:14:14 +09:00
Schaich
3f7356e262 Adapt the README 2021-06-02 21:14:14 +09:00
Schaich
eabaf54d74 Test both the dynamic and the static library 2021-06-02 21:14:14 +09:00
Schaich
e5cd0e4ee8 Remove superfluous commas
CMake separates by spaces, not commas. Remove the commas from the strings
2021-06-02 21:14:14 +09:00
Schaich
6de8fe1c62 Move only downwards in the filesystem hierarchy
This will pick up the local copies of the test data by default, without
needing to create a subdirectory in the backend/tests path and executing
the tests from there. The Current Working Directory can be set if this
proves to be insufficient
2021-06-02 21:14:14 +09:00
Schaich
98cd7b231f Copy the test data into the build directory (just in case) 2021-06-02 21:14:14 +09:00
Schaich
c84915e212 Linking the tests against zint-static if available
Linking against the dynamic zint library requires LD_LIBRARY_PATH and friends
to be set, which complicates the test setup. On the long run, we want to be
able to test both the dynamic and the static (at the same time), though
2021-06-02 21:14:14 +09:00
Schaich
acd12e1754 Add and use helper to set all flags to both the shared and the static library 2021-06-02 21:14:14 +09:00
Schaich
3e89058051 Turn zint tests into a subproject of backend
All dependency handling is implied via linking to the zint target. Options
are inherited from the backend build
2021-06-02 21:14:14 +09:00
Schaich
83bac8c8a5 Bind macro definitions to the zint library target
The libpng dependency is exported to consumers, while the ZINT_TEST option
affects the build output. Both are therefore marked public
2021-06-02 21:14:14 +09:00
gitlost
9b63e2ae22 DOTCODE: allow for max 200 cols in CLI, GUI, Tcl; more detailed size error messages 2021-05-28 15:05:06 +01:00
gitlost
dfb9345b75 png: ULTRA: allow for fgcolour if bind/box, bug introduced by [ed3cc5] (MR #111) 2021-05-28 14:37:57 +01:00
gitlost
0337548c77 AZTEC: optimize populate_map (good for small data) 2021-05-27 18:33:19 +01:00
gitlost
00e8cb0904 Add whitespace_height to zint_symbol (vertical whitespace) 2021-05-25 20:42:26 +01:00
gitlost
f3a94f0c0c C25STANDARD/C25INTER/C25IATA/C25LOGIC/C25IND: add check digit option (#216) 2021-05-17 20:04:00 +01:00
gitlost
29d761c795 MAXICODE: Rejig raster output to more closely match ISO 16023:2000 2021-05-16 16:34:42 +01:00
gitlost
79d3c1dc7a Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
gitlost
6fb0d077bc EAN14, NVE18: fix checksum calc for zero-filled input 2021-05-14 16:04:34 +01:00
gitlost
d9e8ae582d tests: small additions for AZTEC READER_INIT, PDF417, Big5 2021-04-20 11:49:14 +01:00
gitlost
5187f2226d MAXICODE: fix shifting from sets C/D/E to A/B (only latch available) 2021-03-28 21:31:45 +01:00
gitlost
89518c4f01 tif.c: fix endianness detection, props Schaich Alonso 2021-03-23 15:37:18 +00:00
gitlost
6dc8a242df test_tif: fix, use tiffinfo if available (big speedup) 2021-03-21 21:20:16 +00:00
gitlost
2d962c6321 get_best_eci: check UTF-8 before returning 26; move is_valid_utf8 to common 2021-03-21 17:35:52 +00:00
gitlost
7f74414666 eci.c: fix bad bug in Korean, return EUC-KR instead of raw KS X 1001 2021-03-20 14:36:21 +00:00
gitlost
2c053c325a tif.c: Use palette/bilevel/LZW to reduce file size, alpha/CMYK support 2021-03-19 13:09:21 +00:00
gitlost
badd9e59ad Fix UPCEAN small font ignored/disabled (introduced [1adba1]) 2021-03-19 00:12:13 +00:00
gitlost
4e501c77da MAXICODE: fix mask typos for ECI 3/4 bytes 2021-03-18 16:21:22 +00:00
gitlost
14f67331c2 #223 Use cmake options to interface command line parameters, props Schaich Alonso 2021-03-16 23:38:47 +00:00
gitlost
20663b4eed Update gen_gs1_lint.php re new Digital Link dlpkey in gs1-format-spec.txt 2021-03-15 15:27:20 +00:00
gitlost
09e7427259 png.c: suppress clobbered warning by moving init of vars from stack 2021-03-11 11:59:30 +00:00
gitlost
7a7210cfa1 testcommon.c: Suppress unused args warning in testUtilCmpPngs if NO_PNG 2021-03-08 13:14:38 +00:00
gitlost
d81b5db271 #220 backend/tests cmake: Use PNG::PNG for libpng (cf #213), props Schaich Alonso 2021-03-08 12:34:34 +00:00