Commit graph

985 commits

Author SHA1 Message Date
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