Temporarily disable BARCODE_RAW_TEXT prior to 2.15.0 release, as

it's not stable yet. `text_length` is kept.
This commit is contained in:
gitlost 2025-02-24 14:11:03 +00:00
parent c11ab5528d
commit e4663e48cf
23 changed files with 173 additions and 205 deletions

View file

@ -42,6 +42,10 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
#define BARCODE_RAW_TEXT 0 /* BARCODE_RAW_TEXT temporarily disabled */
#define ZINT_WARN_HRT_RAW_TEXT -1 /* BARCODE_RAW_TEXT temporarily disabled */
#define ZINT_ERROR_HRT_RAW_TEXT 16 /* BARCODE_RAW_TEXT temporarily disabled */
/* Determine if C89 (excluding MSVC, which doesn't define __STDC_VERSION__) */
#ifndef _MSC_VER
# if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199000L

View file

@ -181,6 +181,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -143,6 +143,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -123,6 +123,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -196,6 +196,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -270,6 +270,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -779,6 +779,9 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) {
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d symbol->text (%s) != expected (%s)\n",
i, symbol->text, data[i].expected);
#if 1 /* BARCODE_RAW_TEXT temporarily disabled */
(void)expected;
#else
memset(symbol, 0, sizeof(*symbol));
symbol->output_options = BARCODE_RAW_TEXT;
@ -797,6 +800,7 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) {
assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n",
i, symbol->text_length, expected_length);
assert_zero(memcmp(symbol->text, expected, symbol->text_length), "i:%d symbol->text (%s) != expected (%s)\n", i, symbol->text, expected);
#endif
}
testFinish();

View file

@ -3290,6 +3290,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -68,6 +68,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -373,6 +373,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -187,6 +187,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -64,6 +64,8 @@ static void test_4s_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -148,6 +148,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -203,6 +203,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -260,6 +260,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -558,6 +558,8 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
@ -3170,6 +3172,8 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].ret == ZINT_WARN_HRT_RAW_TEXT || !data[i].show_hrt) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -1339,6 +1339,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -130,6 +130,8 @@ static void test_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -1006,6 +1006,8 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].output_options == BARCODE_RAW_TEXT) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
@ -3175,6 +3177,8 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
if (data[i].ret == ZINT_WARN_HRT_RAW_TEXT || !data[i].show_hrt) continue; /* BARCODE_RAW_TEXT temporarily disabled */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -123,7 +123,7 @@ extern "C" {
int warn_level; /* Affects error/warning value returned by Zint API (see WARN_XXX below) */
int debug; /* Debugging flags */
unsigned char text[256]; /* Human Readable Text (HRT) (if any), UTF-8, NUL-terminated (output only) */
int text_length; /* Length of text in bytes, useful if BARCODE_RAW_TEXT when may have NULs (output only) */
int text_length; /* Length of text in bytes (output only) */
int rows; /* Number of rows used by the symbol (output only) */
int width; /* Width of the generated symbol (output only) */
unsigned char encoded_data[200][144]; /* Encoded data (output only). Allows for rows of 1152 modules */
@ -299,9 +299,6 @@ extern "C" {
#define EANUPC_GUARD_WHITESPACE 0x04000 /* Add quiet zone indicators ("<"/">") to HRT whitespace (EAN/UPC) */
#define EMBED_VECTOR_FONT 0x08000 /* Embed font in vector output - currently only for SVG output */
#define BARCODE_MEMORY_FILE 0x10000 /* Write output to in-memory buffer `memfile` instead of to `outfile` */
#define BARCODE_RAW_TEXT 0x20000 /* Set HRT with no decoration (GS1 data will not have parentheses but GS
separators as needed), complete with any control chars and check chars, and
for all linear symbologies, including those that normally don't set it */
/* Input data types (`symbol->input_mode`) */
#define DATA_MODE 0 /* Binary */
@ -329,7 +326,6 @@ extern "C" {
#define ULTRA_COMPRESSION 128 /* Enable Ultracode compression (experimental) */
/* Warning and error conditions (API return values) */
#define ZINT_WARN_HRT_RAW_TEXT -1 /* Human Readable Text outputted with BARCODE_RAW_TEXT */
#define ZINT_WARN_HRT_TRUNCATED 1 /* Human Readable Text was truncated (max 199 bytes) */
#define ZINT_WARN_INVALID_OPTION 2 /* Invalid option given but overridden by Zint */
#define ZINT_WARN_USES_ECI 3 /* Automatic ECI inserted by Zint */
@ -346,7 +342,6 @@ extern "C" {
#define ZINT_ERROR_USES_ECI 13 /* Error counterpart of warning if WARN_FAIL_ALL set (see below) */
#define ZINT_ERROR_NONCOMPLIANT 14 /* Error counterpart of warning if WARN_FAIL_ALL set */
#define ZINT_ERROR_HRT_TRUNCATED 15 /* Error counterpart of warning if WARN_FAIL_ALL set */
#define ZINT_ERROR_HRT_RAW_TEXT 16 /* Error counterpart of warning if WARN_FAIL_ALL set */
/* Warning level (`symbol->warn_level`) */
#define WARN_DEFAULT 0 /* Default behaviour */