From 1ae7815d95a08ed93e8841b9c547968760c25102 Mon Sep 17 00:00:00 2001 From: gitlost Date: Mon, 18 Nov 2024 18:50:26 +0000 Subject: [PATCH] zint.h: add version string, mention "manual.html" and website README: mention "manual.html" tools/update_version.php: update for "zint.h" version, README year test suite: fix some clang-tidy-20 warnings --- README | 4 ++-- backend/code128.c | 2 +- backend/tests/test_dmatrix.c | 2 +- backend/tests/testcommon.c | 4 ++++ backend/zint.h | 6 ++++-- tools/update_version.php | 16 ++++++++++++---- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README b/README index e8c4de2e..f5e30e7c 100644 --- a/README +++ b/README @@ -50,7 +50,7 @@ Output can be saved as BMP, EMF, EPS, GIF, PCX, PNG, SVG or TIF. DOCUMENTATION ------------- -For documentation see "docs/manual.txt" or online at +For documentation see "docs/manual.txt" or "docs/manual.html" or online at @@ -62,7 +62,7 @@ Please see "ChangeLog" in the project root directory. LICENSE ------- -Zint, libzint and Zint Barcode Studio are Copyright © 2023 Robin Stuart. All +Zint, libzint and Zint Barcode Studio are Copyright © 2024 Robin Stuart. All historical versions are distributed under the GNU General Public License version 3 or later. Versions 2.5 and later are released under a dual license: the encoding library is released under the BSD (3 clause) license whereas the diff --git a/backend/code128.c b/backend/code128.c index 44946007..55d63c04 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -168,7 +168,7 @@ static int c128_cost(const unsigned char source[], const int length, const int i const int cset = priority[p]; if (C128_C0C1(cset)) { if (can_c && (!manuals[i] || manuals[i] == C128_C0)) { - const int incr = is_fnc1 ? 1 : 2; + const int incr = 2 - is_fnc1; int mode = prior_cset; int cost = 1; if (prior_cset != cset) { diff --git a/backend/tests/test_dmatrix.c b/backend/tests/test_dmatrix.c index 067dd332..3970b62c 100644 --- a/backend/tests/test_dmatrix.c +++ b/backend/tests/test_dmatrix.c @@ -388,7 +388,7 @@ static void test_large(const testCtx *const p_ctx) { testUtilEscape(data[i].pattern, (int) strlen(data[i].pattern), escaped, sizeof(escaped)), data[i].length, testUtilErrorName(ret), symbol->rows, symbol->width, errtxt); symbol->input_mode |= FAST_MODE; - ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); + (void) ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); printf(" \"%s\", \"%s\" },\n", strcmp(errtxt, symbol->errtxt) != 0 ? symbol->errtxt : "", data[i].comment); } else { assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 75778243..cc89bbfe 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -1896,6 +1896,10 @@ int testUtilCmpBins(const char *bin1, const char *bin2) { do { len1 = fread(buf1, 1, sizeof(buf1), fp1); len2 = fread(buf2, 1, sizeof(buf2), fp2); + if (ferror(fp1) || ferror(fp2)) { + ret = 4; + break; + } if (len1 != len2) { ret = 6; break; diff --git a/backend/zint.h b/backend/zint.h index 1c6001c3..c507a0e5 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -31,8 +31,10 @@ /* SPDX-License-Identifier: BSD-3-Clause */ /* - * For version, see "zintconfig.h" - * For documentation, see "../docs/manual.txt" + * Version: 2.13.0.9 (dev) (see "zintconfig.h") + * + * For documentation, see "../docs/manual.txt" or "../docs/manual.html" or online at + * https://zint.org.uk/manual/ */ #ifndef ZINT_H diff --git a/tools/update_version.php b/tools/update_version.php index 6236e1ff..671c8c65 100644 --- a/tools/update_version.php +++ b/tools/update_version.php @@ -2,7 +2,7 @@ /* Update Zint version number in various files */ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart */ /* SPDX-License-Identifier: BSD-3-Clause */ @@ -49,6 +49,8 @@ $v_base_str = $v_str = "$major.$minor.$release"; if ($build) { $v_str .= ".$build"; } +$v_str_dev = $build ? $v_str . ' (dev)' : $v_str; + $rc_str1 = "$major,$minor,$release,$build"; $rc_str2 = "$major.$minor.$release.$build"; @@ -202,6 +204,10 @@ if (!file_put_contents($file, implode("\n", $lines))) { exit("$basename: ERROR: Could not write file \"$file\"" . PHP_EOL); } +// README + +year_replace($data_dirname . 'README', $year); + // README.linux version_replace(4, $data_dirname . 'README.linux', '/zint-[0-9]/', '/[0-9][0-9.]+/', $v_base_str); @@ -218,6 +224,10 @@ version_replace(1, $data_dirname . 'zint.nsi', '/^!define +PRODUCT_VERSION/', '/ rc_replace($data_dirname . 'backend/libzint.rc', $rc_str1, $rc_str2, $year); +// backend/zint.h + +version_replace(1, $data_dirname . 'backend/zint.h', '/^ \* Version: /', '/[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?( \(dev\))?/', $v_str_dev); + // backend/zintconfig.h $file = $data_dirname . 'backend/zintconfig.h'; @@ -296,9 +306,7 @@ version_replace(1, $data_dirname . 'backend_qt/backend_qt.pro', '/^VERSION[ \t]* // docs/manual.pmd version_replace(1, $data_dirname . 'docs/manual.pmd', '/^% Version /', '/[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?( \(dev\))?/', $v_str); -if ($build !== 9) { // Don't update if marking version as dev - version_replace(1, $data_dirname . 'docs/manual.pmd', '/^The current stable version of Zint/', '/[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?/', $v_str); -} +version_replace(1, $data_dirname . 'docs/manual.pmd', '/^The current stable version of Zint/', '/[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?/', $v_base_str); // docs/zint.1.pmd