mirror of
https://git.code.sf.net/p/zint/code
synced 2026-06-09 23:23:36 +00:00
DXFILMEDGE: various tweaks:
change # 147 -> 127 to use up barcode # holes; use "common.h" funcs `str_to_uppercase()` -> `to_upper()`, `count_char_occurrences()` -> `chr_cnt()`; prefix defines with `DX_` and funcs with `dx_`; `ZINT_DEBUG_PRINT` -> `symbol->debug & ZINT_DEBUG_PRINT`; bools to ints; use `posn()` to check for slash (returns length); restrict line lengths to 118; suppress some clang-tidy warnings; normalize some error messages; check for single "A" if any (`sscanf()`); use compliant height default; some whitespace formatting; Tcl: add DXFILMEDGE support docs: document DXFILMEDGE; update to latest pandoc test suite: ZXingCPP: DXFILMEDGE support
This commit is contained in:
+135
-121
@@ -1,7 +1,7 @@
|
||||
/* dxfilmedge.c - Handles DX Film Edge symbology */
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2024-2025 Antoine Merino <antoine.merino.dev@gmail.com>
|
||||
Copyright (C) 2024 Antoine Merino <antoine.merino.dev@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@@ -40,19 +40,19 @@
|
||||
* https://patents.google.com/patent/US4965628A/en
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
#define DEBUG_STR_LEN 20
|
||||
#define DX_DEBUG_STR_LEN 20
|
||||
/* Max length of the DX info part. Include the \0. Eg: "018500\0", "150-10\0" */
|
||||
#define MAX_DX_INFO_LENGTH 7
|
||||
#define DX_MAX_DX_INFO_LENGTH 6
|
||||
#define DX_MAX_DX_INFO_MAX_STR "6" /* String version of above */
|
||||
/* Max length of the frame info part. Eg: "00A\0", "23A\0" */
|
||||
#define MAX_FRAME_INFO_LENGTH 4
|
||||
#define DX_MAX_FRAME_INFO_LENGTH 3
|
||||
#define DX_MAX_FRAME_INFO_MAX_STR "3" /* String version of above */
|
||||
|
||||
void int_to_binary(int value, int width, char *output) {
|
||||
static void dx_int_to_binary(const int value, const int width, char *output) {
|
||||
int i;
|
||||
for (i = 0; i < width; i++) {
|
||||
output[width - 1 - i] = (value & (1 << i)) ? '1' : '0';
|
||||
@@ -60,134 +60,133 @@ void int_to_binary(int value, int width, char *output) {
|
||||
output[width] = '\0';
|
||||
}
|
||||
|
||||
void str_to_uppercase(char *str) {
|
||||
int i;
|
||||
for (i = 0; str[i] != '\0'; i++) {
|
||||
str[i] = toupper(str[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int count_char_occurrences(const char *str, char target) {
|
||||
int i, count = 0;
|
||||
for (i = 0; str[i] != '\0'; i++) {
|
||||
if (str[i] == target) {
|
||||
count++;
|
||||
if (count > 1) {
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
int parse_dx_code(struct zint_symbol *symbol, const char *source, char *binary_output, int *output_length, bool *has_frame_info) {
|
||||
|
||||
static int dx_parse_code(struct zint_symbol *symbol, const unsigned char *source, const int length,
|
||||
char *binary_output, int *output_length, int *has_frame_info) {
|
||||
int i;
|
||||
int parity_bit = 0;
|
||||
int dx_extract = -1, dx_code_1 = -1, dx_code_2 = -1, frame_number = -1;
|
||||
char binary_dx_code_1[8], binary_dx_code_2[5], binary_frame_number[7];
|
||||
char half_frame_flag = '\0';
|
||||
char dx_info[MAX_DX_INFO_LENGTH] = "\0";
|
||||
char frame_info[MAX_FRAME_INFO_LENGTH] = "\0";
|
||||
char *detected_char = strchr((const char *)(source), ' ');
|
||||
char dx_info[DX_MAX_DX_INFO_LENGTH + 1] = "\0";
|
||||
char frame_info[DX_MAX_FRAME_INFO_LENGTH + 1] = "\0";
|
||||
int dx_length;
|
||||
const char *frame_start;
|
||||
const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
|
||||
|
||||
*has_frame_info = false;
|
||||
*has_frame_info = 0;
|
||||
|
||||
/* All codes should start with a digit*/
|
||||
if (not_sane(IS_NUM_F, (unsigned char *)source, 1)){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1018, "Invalid character \"%c\", DX code should start with a number", source[0]);
|
||||
if (!z_isdigit(source[0])) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 970,
|
||||
"Invalid first character \"%c\", DX code should start with a number", source[0]);
|
||||
}
|
||||
|
||||
/* Check if there is the '/' separator, which indicates the frame number is present. */
|
||||
detected_char = strchr((const char *)(source), '/');
|
||||
if (detected_char){
|
||||
dx_length = posn((const char *) source, '/');
|
||||
if (dx_length != -1) {
|
||||
/* Split the DX information from the frame number */
|
||||
size_t dx_length = detected_char - (char *)source;
|
||||
if (dx_length >= MAX_DX_INFO_LENGTH){
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1014, "DX information is too long");
|
||||
int frame_info_len;
|
||||
if (dx_length > DX_MAX_DX_INFO_LENGTH) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 971,
|
||||
"DX information length %d too long (maximum " DX_MAX_DX_INFO_MAX_STR ")", dx_length);
|
||||
}
|
||||
strncat(dx_info, source, dx_length);
|
||||
ustrncat(dx_info, source, dx_length);
|
||||
dx_info[dx_length] = '\0';
|
||||
frame_start = detected_char + 1;
|
||||
if (strlen(frame_start) >= MAX_FRAME_INFO_LENGTH) {
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1002, "Frame number part is too long");
|
||||
frame_start = (const char *) source + dx_length + 1;
|
||||
frame_info_len = (int) strlen(frame_start);
|
||||
if (frame_info_len > DX_MAX_FRAME_INFO_LENGTH) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 972,
|
||||
"Frame number part length %d too long (maximum " DX_MAX_FRAME_INFO_MAX_STR ")", frame_info_len);
|
||||
}
|
||||
strncat(frame_info, frame_start, sizeof(frame_info) - 1);
|
||||
*has_frame_info = true;
|
||||
str_to_uppercase(frame_info);
|
||||
if ((i = not_sane(IS_UPR_F | IS_NUM_F | IS_MNS_F, (unsigned char *)(frame_info), strlen(frame_info)))){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1012, "Frame number \"%s\" is invalid (expected digits, eventually followed by \'A\')", frame_info);
|
||||
ustrcpy(frame_info, frame_start);
|
||||
*has_frame_info = 1;
|
||||
to_upper((unsigned char *) frame_info, frame_info_len);
|
||||
if (not_sane(IS_UPR_F | IS_NUM_F | IS_MNS_F, (const unsigned char *) frame_info, frame_info_len)) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 973,
|
||||
"Frame number \"%s\" is invalid (expected digits, optionally followed by a single \"A\")",
|
||||
frame_info);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
/* No "/" found, store the entire input in dx_info */
|
||||
if (strlen(source) >= MAX_DX_INFO_LENGTH) {
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1003, "DX information is too long");
|
||||
dx_length = length;
|
||||
if (dx_length > DX_MAX_DX_INFO_LENGTH) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 974,
|
||||
"DX information length %d too long (maximum " DX_MAX_DX_INFO_MAX_STR ")", dx_length);
|
||||
}
|
||||
strncat(dx_info, source, sizeof(dx_info) - 1);
|
||||
ustrcpy(dx_info, source);
|
||||
}
|
||||
|
||||
if ((i = not_sane(IS_NUM_F | IS_MNS_F, (unsigned char *)dx_info, strlen(dx_info)))){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1016, "Invalid character at position %d in DX info (digits and \'-\' character only)", i);
|
||||
if ((i = not_sane(IS_NUM_F | IS_MNS_F, (const unsigned char *) dx_info, dx_length))) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 975,
|
||||
"Invalid character at position %d in DX info (digits and \"-\" character only)", i);
|
||||
}
|
||||
|
||||
if (ZINT_DEBUG_PRINT) printf("\nDX info part: \"%s\", Frame info part: \"%s\"\n", dx_info, frame_info);
|
||||
if (debug_print) printf("\nDX info part: \"%s\", Frame info part: \"%s\"\n", dx_info, frame_info);
|
||||
/* Parse the DX information */
|
||||
if (strchr(dx_info, '-')){
|
||||
if (strchr(dx_info, '-')) {
|
||||
/* DX code parts 1 and 2 are given directly, separated by a '-'. Eg: "79-7" */
|
||||
if (ZINT_DEBUG_PRINT) printf("DX code 1 and 2 are separated by a dash \'-\'\n");
|
||||
if (count_char_occurrences(dx_info, '-') > 1){
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1009, "The \'-\' is used to separate DX parts 1 and 2, and should be used no more than once");
|
||||
if (debug_print) printf("DX code 1 and 2 are separated by a dash \"-\"\n");
|
||||
if (chr_cnt((const unsigned char *) dx_info, dx_length, '-') > 1) {
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 976,
|
||||
"The \"-\" is used to separate DX parts 1 and 2, and should be used no more than once");
|
||||
}
|
||||
if (sscanf(dx_info, "%d-%d", &dx_code_1, &dx_code_2) < 2){
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1004, "Wrong format for DX parts 1 and 2 (expected format: XXX-XX, digits)");
|
||||
if (sscanf(dx_info, "%d-%d", &dx_code_1, &dx_code_2) < 2) {
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 977,
|
||||
"Wrong format for DX parts 1 and 2 (expected format: XXX-XX, digits)");
|
||||
}
|
||||
if (dx_code_1 <= 0 || dx_code_1 > 127){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1006, "DX part 1 \"%d\" must be between 1 and 127", dx_code_1);
|
||||
if (dx_code_1 <= 0 || dx_code_1 > 127) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 978, "DX part 1 \"%d\" out of range (1 to 127)",
|
||||
dx_code_1);
|
||||
}
|
||||
if (dx_code_2 < 0 || dx_code_2 > 15){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1007, "DX part 2 \"%d\" must be between 0 and 15", dx_code_2);
|
||||
if (dx_code_2 < 0 || dx_code_2 > 15) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 979, "DX part 2 \"%d\" out of range (0 to 15)",
|
||||
dx_code_2);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
/* DX format is either 4 digits (DX Extract, eg: 1271) or 6 digits (DX Full, eg: 012710) */
|
||||
if (ZINT_DEBUG_PRINT) printf("No \'-\' separator, computing from DX Extract (4 digits) or DX Full (6 digits)\n");
|
||||
if (strlen(dx_info) == 5 || strlen(dx_info) > 6){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1005, "DX number \"%s\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)", dx_info);
|
||||
if (debug_print) printf("No \"-\" separator, computing from DX Extract (4 digits) or DX Full (6 digits)\n");
|
||||
if (dx_length == 5 || dx_length > 6) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 980,
|
||||
"DX number \"%s\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)", dx_info);
|
||||
}
|
||||
if (strlen(dx_info) == 6){
|
||||
if (ZINT_DEBUG_PRINT) printf("DX full format detected: %s. Removing the first and the last characters.\n", dx_info);
|
||||
if (dx_length == 6) {
|
||||
if (debug_print) {
|
||||
printf("DX full format detected: %s. Removing the first and the last characters.\n", dx_info);
|
||||
}
|
||||
/* Convert DX Full to DX Extract (remove first and last character) */
|
||||
for (i=0; i <= 3; ++i){
|
||||
dx_info[i] = dx_info[i+1];
|
||||
for (i = 0; i <= 3; ++i) {
|
||||
dx_info[i] = dx_info[i + 1];
|
||||
}
|
||||
dx_info[4] = '\0';
|
||||
dx_length = 4;
|
||||
}
|
||||
/* Compute the DX parts 1 and 2 from the DX extract */
|
||||
if (sscanf(dx_info, "%d", &dx_extract) < 1){
|
||||
/* Should not happen (DX info format has been checked above), but better safe than sorry */
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1005, "DX number \"%s\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)", dx_info);
|
||||
dx_extract = to_int((const unsigned char *) dx_info, dx_length);
|
||||
assert(dx_extract != -1);
|
||||
if (dx_extract < 16 || dx_extract > 2047) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 981, "DX extract \"%d\" out of range (16 to 2047)",
|
||||
dx_extract);
|
||||
}
|
||||
if (dx_extract < 16 || dx_extract > 2047){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1015, "DX extract \"%d\" must be between 16 and 2047", dx_extract);
|
||||
}
|
||||
if (ZINT_DEBUG_PRINT) printf("Computed DX extract: %04d\n", dx_extract);
|
||||
if (debug_print) printf("Computed DX extract: %04d\n", dx_extract);
|
||||
dx_code_1 = dx_extract / 16;
|
||||
dx_code_2 = dx_extract % 16;
|
||||
}
|
||||
|
||||
/* Convert components to binary strings */
|
||||
int_to_binary(dx_code_1, 7, binary_dx_code_1);
|
||||
int_to_binary(dx_code_2, 4, binary_dx_code_2);
|
||||
dx_int_to_binary(dx_code_1, 7, binary_dx_code_1);
|
||||
dx_int_to_binary(dx_code_2, 4, binary_dx_code_2);
|
||||
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s%d\t-> %s\n", DEBUG_STR_LEN, "DX code 1:", dx_code_1, binary_dx_code_1);
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s%d\t-> %s\n", DEBUG_STR_LEN, "DX code 2:", dx_code_2, binary_dx_code_2);
|
||||
if (debug_print) {
|
||||
printf("%-*s%d\t-> %s\n", DX_DEBUG_STR_LEN, "DX code 1:", dx_code_1, binary_dx_code_1);
|
||||
printf("%-*s%d\t-> %s\n", DX_DEBUG_STR_LEN, "DX code 2:", dx_code_2, binary_dx_code_2);
|
||||
}
|
||||
|
||||
if (*has_frame_info) {
|
||||
if (strlen(frame_info) < 1){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1017, "Frame number indicator \"/\" at position %d, but frame number is empty", (int)(detected_char - (char *)source + 1));
|
||||
int ret_sscanf, n;
|
||||
if (strlen(frame_info) < 1) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 982,
|
||||
"Frame number indicator \"/\" at position %d, but frame number is empty",
|
||||
dx_length + 1);
|
||||
}
|
||||
/* Some frame numbers are special values, convert them their equivalent number */
|
||||
if (strcmp(frame_info, "S") == 0 || strcmp(frame_info, "X") == 0) {
|
||||
@@ -204,14 +203,20 @@ int parse_dx_code(struct zint_symbol *symbol, const char *source, char *binary_o
|
||||
strcpy(frame_info, "0A");
|
||||
}
|
||||
|
||||
if (sscanf(frame_info, "%d%c", &frame_number, &half_frame_flag) < 1){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1012, "Frame number \"%s\" is invalid (expected digits, eventually followed by \'A\')", frame_info);
|
||||
ret_sscanf = sscanf(frame_info, "%d%c%n", &frame_number, &half_frame_flag, &n);
|
||||
if (ret_sscanf < 1 || (ret_sscanf == 2 && frame_info[n] != '\0')) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 983,
|
||||
"Frame number \"%s\" is invalid (expected digits, optionally followed by a single \"A\")",
|
||||
frame_info);
|
||||
}
|
||||
if (frame_number < 0 || frame_number > 63){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1008, "Frame number \"%d\"should be between 0 and 63", frame_number);
|
||||
if (frame_number < 0 || frame_number > 63) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 984, "Frame number \"%d\" out of range (0 to 63)",
|
||||
frame_number);
|
||||
}
|
||||
dx_int_to_binary(frame_number, 6, binary_frame_number);
|
||||
if (debug_print) {
|
||||
printf("%-*s%d\t-> %s\n", DX_DEBUG_STR_LEN, "Frame number:", frame_number, binary_frame_number);
|
||||
}
|
||||
int_to_binary(frame_number, 6, binary_frame_number);
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s%d\t-> %s\n", DEBUG_STR_LEN, "Frame number:", frame_number, binary_frame_number);
|
||||
}
|
||||
|
||||
/* Build the binary output */
|
||||
@@ -221,19 +226,22 @@ int parse_dx_code(struct zint_symbol *symbol, const char *source, char *binary_o
|
||||
strcat(binary_output, binary_dx_code_2);
|
||||
if (*has_frame_info) {
|
||||
strcat(binary_output, binary_frame_number);
|
||||
if (toupper(half_frame_flag) == 'A') {
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s\'%c\'\t-> 1\n", DEBUG_STR_LEN, "Half frame flag:", half_frame_flag);
|
||||
to_upper((unsigned char *) &half_frame_flag, 1);
|
||||
if (half_frame_flag == 'A') {
|
||||
if (debug_print) printf("%-*s'%c'\t-> 1\n", DX_DEBUG_STR_LEN, "Half frame flag:", half_frame_flag);
|
||||
strcat(binary_output, "1"); /* Half-frame is set */
|
||||
} else {
|
||||
if (half_frame_flag){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1012, "Frame number \"%s\" is invalid (expected digits, eventually followed by \'A\')", frame_info);
|
||||
if (half_frame_flag) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 985,
|
||||
"Frame number \"%s\" is invalid (expected digits, optionally followed by a single \"A\")",
|
||||
frame_info);
|
||||
}
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s\'%c\'\t-> 0\n", DEBUG_STR_LEN, "Half frame flag:", half_frame_flag);
|
||||
if (debug_print) printf("%-*s'%c'\t-> 0\n", DX_DEBUG_STR_LEN, "Half frame flag:", half_frame_flag);
|
||||
strcat(binary_output, "0"); /* Half-frame is NOT set */
|
||||
}
|
||||
strcat(binary_output, "0"); /* Separator between half frame flag and parity bit*/
|
||||
}
|
||||
|
||||
|
||||
/* Parity bit */
|
||||
for (i = 6; binary_output[i] != '\0'; i++) {
|
||||
if (binary_output[i] == '1') {
|
||||
@@ -241,56 +249,56 @@ int parse_dx_code(struct zint_symbol *symbol, const char *source, char *binary_o
|
||||
}
|
||||
}
|
||||
parity_bit %= 2;
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s%s\t-> %d\n", DEBUG_STR_LEN, "Parity bit:", parity_bit?"yes":"no", parity_bit);
|
||||
if (parity_bit){
|
||||
strcat(binary_output, "1");
|
||||
if (debug_print) {
|
||||
printf("%-*s%s\t-> %d\n", DX_DEBUG_STR_LEN, "Parity bit:", parity_bit ? "yes" : "no", parity_bit);
|
||||
}
|
||||
else{
|
||||
if (parity_bit) {
|
||||
strcat(binary_output, "1");
|
||||
} else {
|
||||
strcat(binary_output, "0");
|
||||
}
|
||||
|
||||
|
||||
strcat(binary_output, "0101"); /* Stop pattern */
|
||||
|
||||
*output_length = strlen(binary_output);
|
||||
*output_length = (int) strlen(binary_output);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
INTERNAL int dxfilmedge(struct zint_symbol *symbol, char source[], int length) {
|
||||
INTERNAL int dxfilmedge(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int i;
|
||||
int writer = 0;
|
||||
int error_number = 0;
|
||||
|
||||
char char_data[32];
|
||||
int data_length;
|
||||
bool has_frame_info;
|
||||
int has_frame_info;
|
||||
|
||||
const char long_clock_pattern[] = "1111101010101010101010101010111";
|
||||
const char short_clock_pattern[] = "11111010101010101010111";
|
||||
const char *clock_pattern;
|
||||
int clock_length;
|
||||
int parse_result = -1;
|
||||
const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
|
||||
|
||||
if (length > 10) {
|
||||
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 1013, "Input length %d too long (maximum 10)", length);
|
||||
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 986, "Input length %d too long (maximum 10)", length);
|
||||
}
|
||||
|
||||
parse_result = parse_dx_code(symbol, source, char_data, &data_length, &has_frame_info);
|
||||
if (parse_result != 0){
|
||||
if (ZINT_DEBUG_PRINT) printf("Error %s\n\n", symbol->errtxt);
|
||||
parse_result = dx_parse_code(symbol, source, length, char_data, &data_length, &has_frame_info);
|
||||
if (parse_result != 0) {
|
||||
if (debug_print) printf("Error %s\n\n", symbol->errtxt);
|
||||
return parse_result;
|
||||
}
|
||||
|
||||
/* Clock signal is longer if the frame number is provided */
|
||||
if (has_frame_info){
|
||||
if (has_frame_info) {
|
||||
clock_pattern = long_clock_pattern;
|
||||
clock_length = sizeof(long_clock_pattern) -1;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
clock_pattern = short_clock_pattern;
|
||||
clock_length = sizeof(short_clock_pattern) -1;
|
||||
}
|
||||
|
||||
|
||||
/* First row: clock pattern */
|
||||
for (i = 0; i < clock_length; i++) {
|
||||
if (clock_pattern[i] == '1') {
|
||||
@@ -313,7 +321,7 @@ INTERNAL int dxfilmedge(struct zint_symbol *symbol, char source[], int length) {
|
||||
}
|
||||
writer++;
|
||||
}
|
||||
symbol->rows = 2;
|
||||
symbol->rows = 2;
|
||||
symbol->width = clock_length;
|
||||
|
||||
if (symbol->output_options & COMPLIANT_HEIGHT) {
|
||||
@@ -324,7 +332,13 @@ INTERNAL int dxfilmedge(struct zint_symbol *symbol, char source[], int length) {
|
||||
const float min_row_height = 2.2f;
|
||||
const float max_height = 7.5f;
|
||||
error_number = set_height(symbol, min_row_height, default_height, max_height, 0 /*no_errtxt*/);
|
||||
} else {
|
||||
/* Using compliant height as default as no backwards compatibility to consider */
|
||||
const float default_height = 6.0f;
|
||||
(void) set_height(symbol, 0.0f, default_height, 0.0f, 1 /*no_errtxt*/);
|
||||
}
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
+6
-5
@@ -578,11 +578,11 @@ static const barcode_src_func_t barcode_src_funcs[BARCODE_LAST + 1] = {
|
||||
NULL, NULL, NULL, NULL, NULL, /*110-114*/
|
||||
NULL, NULL, NULL, NULL, mailmark_2d, /*115-119*/
|
||||
upu_s10, mailmark_4s, NULL, NULL, NULL, /*120-124*/
|
||||
NULL, NULL, NULL, azrune, code32, /*125-129*/
|
||||
NULL, NULL, dxfilmedge, azrune, code32, /*125-129*/
|
||||
composite, composite, composite, composite, composite, /*130-134*/
|
||||
composite, composite, composite, composite, composite, /*135-139*/
|
||||
channel, NULL, NULL, upnqr, NULL, /*140-144*/
|
||||
NULL, bc412, dxfilmedge, /*145-147*/
|
||||
NULL, bc412, /*145-146*/
|
||||
};
|
||||
|
||||
#define LIB_SEG_FUNCS_START 55
|
||||
@@ -1638,11 +1638,11 @@ int ZBarcode_BarcodeName(int symbol_id, char name[32]) {
|
||||
"HIBC_BLOCKF", "", "HIBC_AZTEC", "", "", /*110-114*/
|
||||
"DOTCODE", "HANXIN", "", "", "MAILMARK_2D", /*115-119*/
|
||||
"UPU_S10", "MAILMARK_4S", "", "", "", /*120-124*/
|
||||
"", "", "", "AZRUNE", "CODE32", /*125-129*/
|
||||
"", "", "DXFILMEDGE", "AZRUNE", "CODE32", /*125-129*/
|
||||
"EANX_CC", "GS1_128_CC", "DBAR_OMN_CC", "DBAR_LTD_CC", "DBAR_EXP_CC", /*130-134*/
|
||||
"UPCA_CC", "UPCE_CC", "DBAR_STK_CC", "DBAR_OMNSTK_CC", "DBAR_EXPSTK_CC", /*135-139*/
|
||||
"CHANNEL", "CODEONE", "GRIDMATRIX", "UPNQR", "ULTRA", /*140-144*/
|
||||
"RMQR", "BC412", "DXFILMEDGE", /*145-147*/
|
||||
"RMQR", "BC412", /*145-146*/
|
||||
};
|
||||
|
||||
name[0] = '\0';
|
||||
@@ -1870,7 +1870,8 @@ float ZBarcode_Default_Xdim(int symbol_id) {
|
||||
x_dim_mm = 0.33f; /* GS1 General Standards 22.0 Section 5.12.3 Table 1 except DBAR_LTD Table 4 */
|
||||
break;
|
||||
case BARCODE_DXFILMEDGE:
|
||||
x_dim_mm = 0.403548f; /* Measured on Kodak 35mm film, a DX Film Edge with frame number with 31 symbols is 12,51 mm long*/
|
||||
/* Measured on Kodak 35mm film, a DX Film Edge with frame number with 31 symbols is 12,51 mm long */
|
||||
x_dim_mm = 0.403548f;
|
||||
break;
|
||||
/* Specific */
|
||||
case BARCODE_BC412:
|
||||
|
||||
+1
-1
@@ -362,7 +362,7 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
|
||||
break;
|
||||
|
||||
case BARCODE_DXFILMEDGE:
|
||||
/* No known standard. Add a little horizontal space to make the detection easier. Tested with Zxing-CPP. */
|
||||
/* No known standard. Add a little horizontal space to make the detection easier. Tested with Zxing-CPP */
|
||||
*left = *right = 1.8f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2024-2025 Antoine Merino <antoine.merino.dev@gmail.com>
|
||||
Copyright (C) 2024 Antoine Merino <antoine.merino.dev@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "testcommon.h"
|
||||
|
||||
|
||||
static void test_encode(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
@@ -47,8 +46,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
char *expected;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* DX code 1: 79, DX code 2: 7. DX Extract = 1271. DX Full: X1271X (X is any digit)*/
|
||||
/* 0*/ { BARCODE_DXFILMEDGE, -1, "79-7", 0, 2, 23, "",
|
||||
/* 0*/ { BARCODE_DXFILMEDGE, -1, "79-7", 0, 2, 23, "DX code 1: 79, DX code 2: 7. DX Extract = 1271. DX Full: X1271X (X is any digit)",
|
||||
"1111101010101010101011110101010011110011100101"
|
||||
},
|
||||
/* 1*/ { BARCODE_DXFILMEDGE, -1, "1271", 0, 2, 23, "",
|
||||
@@ -60,8 +58,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
/* 3*/ { BARCODE_DXFILMEDGE, -1, "112712", 0, 2, 23, "",
|
||||
"1111101010101010101011110101010011110011100101"
|
||||
},
|
||||
/* Lower limit: DX part 1 = 1, DX part 2 = 0*/
|
||||
/* 4*/ { BARCODE_DXFILMEDGE, -1, "1-0", 0, 2, 23, "",
|
||||
/* 4*/ { BARCODE_DXFILMEDGE, -1, "1-0", 0, 2, 23, "Lower limit: DX part 1 = 1, DX part 2 = 0",
|
||||
"1111101010101010101011110101000000010000010101"
|
||||
},
|
||||
/* 5*/ { BARCODE_DXFILMEDGE, -1, "000160", 0, 2, 23, "",
|
||||
@@ -70,23 +67,19 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
/* 6*/ { BARCODE_DXFILMEDGE, -1, "16", 0, 2, 23, "",
|
||||
"1111101010101010101011110101000000010000010101"
|
||||
},
|
||||
/* Upper limit: DX part 1 = 127, DX part 2 = 15 */
|
||||
/* 7*/ { BARCODE_DXFILMEDGE, -1, "920479/63A", 0, 2, 31, "",
|
||||
/* 7*/ { BARCODE_DXFILMEDGE, -1, "920479/63A", 0, 2, 31, "Upper limit: DX part 1 = 127, DX part 2 = 15",
|
||||
"11111010101010101010101010101111010101111111011111111111000101"
|
||||
},
|
||||
/* 8*/ { BARCODE_DXFILMEDGE, -1, "127-15/00A", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101111111011111111111000101"
|
||||
},
|
||||
|
||||
/* 9*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000010010101"
|
||||
},
|
||||
/* Optional behaviour: leading zeros are accepted*/
|
||||
/* 10*/ { BARCODE_DXFILMEDGE, -1, "0079-7/001", 0, 2, 31, "",
|
||||
/* 10*/ { BARCODE_DXFILMEDGE, -1, "0079-7/001", 0, 2, 31, "Optional behaviour: leading zeros are accepted",
|
||||
"11111010101010101010101010101111010101001111001110000010010101"
|
||||
},
|
||||
/* Frame number */
|
||||
/* 11*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "",
|
||||
/* 11*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "Frame number",
|
||||
"11111010101010101010101010101111010101001111001110000010010101"
|
||||
},
|
||||
/* 12*/ { BARCODE_DXFILMEDGE, -1, "1271/1", 0, 2, 31, "",
|
||||
@@ -104,8 +97,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
/* 16*/ { BARCODE_DXFILMEDGE, -1, "212715/1A", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000011000101"
|
||||
},
|
||||
/* Special frame numbers */
|
||||
/* 17*/ { BARCODE_DXFILMEDGE, -1, "79-7/62", 0, 2, 31, "",
|
||||
/* 17*/ { BARCODE_DXFILMEDGE, -1, "79-7/62", 0, 2, 31, "Special frame numbers",
|
||||
"11111010101010101010101010101111010101001111001111111100010101"
|
||||
},
|
||||
/* 18*/ { BARCODE_DXFILMEDGE, -1, "79-7/S", 0, 2, 31, "",
|
||||
@@ -162,7 +154,6 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
char cmp_buf[4096];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
@@ -195,14 +186,6 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
|
||||
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
|
||||
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
|
||||
}
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
@@ -237,31 +220,31 @@ static void test_input(const testCtx *const p_ctx) {
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_DXFILMEDGE, -1, "79-1/123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1002: Frame number part is too long" },
|
||||
/* 1*/ { BARCODE_DXFILMEDGE, -1, "012312365", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1003: DX information is too long" },
|
||||
/* 2*/ { BARCODE_DXFILMEDGE, -1, "12-", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1004: Wrong format for DX parts 1 and 2 (expected format: XXX-XX, digits)" },
|
||||
/* 3*/ { BARCODE_DXFILMEDGE, -1, "01234/00A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1005: DX number \"01234\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)" },
|
||||
/* 4*/ { BARCODE_DXFILMEDGE, -1, "01234/00A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1005: DX number \"01234\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)" },
|
||||
/* 5*/ { BARCODE_DXFILMEDGE, -1, "128-0/24", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1006: DX part 1 \"128\" must be between 1 and 127" },
|
||||
/* 6*/ { BARCODE_DXFILMEDGE, -1, "127-16", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1007: DX part 2 \"16\" must be between 0 and 15" },
|
||||
/* 7*/ { BARCODE_DXFILMEDGE, -1, "79-2/-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1008: Frame number \"-1\"should be between 0 and 63" },
|
||||
/* 8*/ { BARCODE_DXFILMEDGE, -1, "79-2/64", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1008: Frame number \"64\"should be between 0 and 63" },
|
||||
/* 9*/ { BARCODE_DXFILMEDGE, -1, "79-2-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1009: The \'-\' is used to separate DX parts 1 and 2, and should be used no more than once" },
|
||||
/* 10*/ { BARCODE_DXFILMEDGE, -1, "110-2/2B", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1012: Frame number \"2B\" is invalid (expected digits, eventually followed by \'A\')" },
|
||||
/* 11*/ { BARCODE_DXFILMEDGE, -1, "099990/123A", ZINT_ERROR_TOO_LONG, -1, -1, "Error 1013: Input length 11 too long (maximum 10)" },
|
||||
/* 12*/ { BARCODE_DXFILMEDGE, -1, "0123123/1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1014: DX information is too long" },
|
||||
/* 13*/ { BARCODE_DXFILMEDGE, -1, "120481", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"2048\" must be between 16 and 2047" },
|
||||
/* 14*/ { BARCODE_DXFILMEDGE, -1, "100151", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"15\" must be between 16 and 2047" },
|
||||
/* 15*/ { BARCODE_DXFILMEDGE, -1, "15", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"15\" must be between 16 and 2047" },
|
||||
/* 16*/ { BARCODE_DXFILMEDGE, -1, "12-12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1016: Invalid character at position 6 in DX info (digits and \'-\' character only)" },
|
||||
/* 17*/ { BARCODE_DXFILMEDGE, -1, "012X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1016: Invalid character at position 4 in DX info (digits and \'-\' character only)" },
|
||||
/* 18*/ { BARCODE_DXFILMEDGE, -1, "110-2/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1017: Frame number indicator \"/\" at position 6, but frame number is empty" },
|
||||
/* 19*/ { BARCODE_DXFILMEDGE, -1, "/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"/\", DX code should start with a number" },
|
||||
/* 20*/ { BARCODE_DXFILMEDGE, -1, "-12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"-\", DX code should start with a number" },
|
||||
/* 21*/ { BARCODE_DXFILMEDGE, -1, "X1234X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"X\", DX code should start with a number" },
|
||||
/* 0*/ { BARCODE_DXFILMEDGE, -1, "79-1/123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 972: Frame number part length 4 too long (maximum 3)" },
|
||||
/* 1*/ { BARCODE_DXFILMEDGE, -1, "79-1/1@A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 973: Frame number \"1@A\" is invalid (expected digits, optionally followed by a single \"A\")" },
|
||||
/* 2*/ { BARCODE_DXFILMEDGE, -1, "012312365", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 974: DX information length 9 too long (maximum 6)" },
|
||||
/* 3*/ { BARCODE_DXFILMEDGE, -1, "12-", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 977: Wrong format for DX parts 1 and 2 (expected format: XXX-XX, digits)" },
|
||||
/* 4*/ { BARCODE_DXFILMEDGE, -1, "01234/00A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 980: DX number \"01234\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)" },
|
||||
/* 5*/ { BARCODE_DXFILMEDGE, -1, "0123/0AA", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 983: Frame number \"0AA\" is invalid (expected digits, optionally followed by a single \"A\")" },
|
||||
/* 6*/ { BARCODE_DXFILMEDGE, -1, "128-0/24", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 978: DX part 1 \"128\" out of range (1 to 127)" },
|
||||
/* 7*/ { BARCODE_DXFILMEDGE, -1, "127-16", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 979: DX part 2 \"16\" out of range (0 to 15)" },
|
||||
/* 8*/ { BARCODE_DXFILMEDGE, -1, "79-2/A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 983: Frame number \"A\" is invalid (expected digits, optionally followed by a single \"A\")" },
|
||||
/* 9*/ { BARCODE_DXFILMEDGE, -1, "79-2/-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 984: Frame number \"-1\" out of range (0 to 63)" },
|
||||
/* 10*/ { BARCODE_DXFILMEDGE, -1, "79-2/64", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 984: Frame number \"64\" out of range (0 to 63)" },
|
||||
/* 11*/ { BARCODE_DXFILMEDGE, -1, "79-2-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 976: The \"-\" is used to separate DX parts 1 and 2, and should be used no more than once" },
|
||||
/* 12*/ { BARCODE_DXFILMEDGE, -1, "110-2/2B", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 985: Frame number \"2B\" is invalid (expected digits, optionally followed by a single \"A\")" },
|
||||
/* 13*/ { BARCODE_DXFILMEDGE, -1, "099990/123A", ZINT_ERROR_TOO_LONG, -1, -1, "Error 986: Input length 11 too long (maximum 10)" },
|
||||
/* 14*/ { BARCODE_DXFILMEDGE, -1, "0123123/1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 971: DX information length 7 too long (maximum 6)" },
|
||||
/* 15*/ { BARCODE_DXFILMEDGE, -1, "120481", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 981: DX extract \"2048\" out of range (16 to 2047)" },
|
||||
/* 16*/ { BARCODE_DXFILMEDGE, -1, "100151", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 981: DX extract \"15\" out of range (16 to 2047)" },
|
||||
/* 17*/ { BARCODE_DXFILMEDGE, -1, "15", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 981: DX extract \"15\" out of range (16 to 2047)" },
|
||||
/* 18*/ { BARCODE_DXFILMEDGE, -1, "12-12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 975: Invalid character at position 6 in DX info (digits and \"-\" character only)" },
|
||||
/* 19*/ { BARCODE_DXFILMEDGE, -1, "012X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 975: Invalid character at position 4 in DX info (digits and \"-\" character only)" },
|
||||
/* 20*/ { BARCODE_DXFILMEDGE, -1, "110-2/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 982: Frame number indicator \"/\" at position 6, but frame number is empty" },
|
||||
/* 21*/ { BARCODE_DXFILMEDGE, -1, "/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 970: Invalid first character \"/\", DX code should start with a number" },
|
||||
/* 22*/ { BARCODE_DXFILMEDGE, -1, "-12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 970: Invalid first character \"-\", DX code should start with a number" },
|
||||
/* 23*/ { BARCODE_DXFILMEDGE, -1, "X1234X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 970: Invalid first character \"X\", DX code should start with a number" },
|
||||
};
|
||||
|
||||
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
@@ -293,7 +276,6 @@ static void test_input(const testCtx *const p_ctx) {
|
||||
testFinish();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
@@ -308,3 +290,4 @@ int main(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
@@ -189,32 +189,30 @@ static void test_checks(const testCtx *const p_ctx) {
|
||||
/*125*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*126*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*127*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*128*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*129*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*130*/ { 148, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*131*/ { 148, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*132*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*133*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*134*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
/*135*/ { BARCODE_CODE128, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
/*136*/ { BARCODE_MAXICODE, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
/*137*/ { BARCODE_MAXICODE, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
/*138*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
|
||||
/*139*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
|
||||
/*140*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
|
||||
/*141*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
|
||||
/*142*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
|
||||
/*143*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 },
|
||||
/*144*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 },
|
||||
/*145*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /* Warning in encoder overrides library warnings */
|
||||
/*146*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /* But not errors */
|
||||
/*147*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
|
||||
/*148*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
|
||||
/*149*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
|
||||
/*150*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Error correction level '6' out of range (1 to 4), ignoring", -1 },
|
||||
/*151*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 },
|
||||
/*152*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /* ECI warning trumps all other warnings */
|
||||
/*153*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 }, /* But not errors */
|
||||
/*128*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*129*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*130*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*131*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*132*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
/*133*/ { BARCODE_CODE128, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
/*134*/ { BARCODE_MAXICODE, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
/*135*/ { BARCODE_MAXICODE, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
/*136*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
|
||||
/*137*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
|
||||
/*138*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
|
||||
/*139*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
|
||||
/*140*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
|
||||
/*141*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 },
|
||||
/*142*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 },
|
||||
/*143*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /* Warning in encoder overrides library warnings */
|
||||
/*144*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /* But not errors */
|
||||
/*145*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
|
||||
/*146*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
|
||||
/*147*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
|
||||
/*148*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Error correction level '6' out of range (1 to 4), ignoring", -1 },
|
||||
/*149*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 },
|
||||
/*150*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /* ECI warning trumps all other warnings */
|
||||
/*151*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 }, /* But not errors */
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@@ -964,10 +962,12 @@ static void test_cap_compliant_height(const testCtx *const p_ctx) {
|
||||
case BARCODE_DBAR_EXPSTK_CC:
|
||||
case BARCODE_CHANNEL:
|
||||
case BARCODE_BC412:
|
||||
case BARCODE_DXFILMEDGE: /* TODO: what's this? */
|
||||
case BARCODE_DXFILMEDGE:
|
||||
/* Make sure ZINT_CAP_COMPLIANT_HEIGHT set for those that have it */
|
||||
assert_equal(uret, ZINT_CAP_COMPLIANT_HEIGHT, "symbol_id %d (%s) uret 0x%X != ZINT_CAP_COMPLIANT_HEIGHT\n", symbol_id, testUtilBarcodeName(symbol_id), uret);
|
||||
break;
|
||||
default:
|
||||
/* And not set for those that don't */
|
||||
assert_zero(uret, "symbol_id %d (%s) uret 0x%X non-zero\n", symbol_id, testUtilBarcodeName(symbol_id), uret);
|
||||
break;
|
||||
}
|
||||
@@ -1530,7 +1530,7 @@ static int test_prev_ZBarcode_BarcodeName(int symbol_id, char name[32]) {
|
||||
{ "", -1, 124 },
|
||||
{ "", -1, 125 },
|
||||
{ "", -1, 126 },
|
||||
{ "", -1, 127 },
|
||||
{ "BARCODE_DXFILMEDGE", BARCODE_DXFILMEDGE, 127 },
|
||||
{ "BARCODE_AZRUNE", BARCODE_AZRUNE, 128 },
|
||||
{ "BARCODE_CODE32", BARCODE_CODE32, 129 },
|
||||
{ "BARCODE_EANX_CC", BARCODE_EANX_CC, 130 },
|
||||
@@ -1550,7 +1550,6 @@ static int test_prev_ZBarcode_BarcodeName(int symbol_id, char name[32]) {
|
||||
{ "BARCODE_ULTRA", BARCODE_ULTRA, 144 },
|
||||
{ "BARCODE_RMQR", BARCODE_RMQR, 145 },
|
||||
{ "BARCODE_BC412", BARCODE_BC412, 146 },
|
||||
{ "BARCODE_DXFILMEDGE", BARCODE_DXFILMEDGE, 147 },
|
||||
};
|
||||
|
||||
name[0] = '\0';
|
||||
|
||||
@@ -2357,7 +2357,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
|
||||
{ "", -1, 124, 0, 0, 0, 0, 0, },
|
||||
{ "", -1, 125, 0, 0, 0, 0, 0, },
|
||||
{ "", -1, 126, 0, 0, 0, 0, 0, },
|
||||
{ "", -1, 127, 0, 0, 0, 0, 0, },
|
||||
{ "", BARCODE_DXFILMEDGE, 127, 0, 0, 0, 0, 0, },
|
||||
{ "aztecrune", BARCODE_AZRUNE, 128, 0, 0, 0, 0, 0, },
|
||||
{ "code32", BARCODE_CODE32, 129, 0, 0, 0, 0, 0, },
|
||||
{ "ean13composite", BARCODE_EANX_CC, 130, 1, 1, 0, 72 /*linear_row_height*/, 1 /*gs1_cvt*/, },
|
||||
@@ -3513,6 +3513,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Append multiple segments together and then call `testUtilBwipp()` */
|
||||
int testUtilBwippSegs(int index, struct zint_symbol *symbol, int option_1, int option_2, int option_3,
|
||||
const struct zint_seg segs[], const int seg_count, const char *primary, char *buffer, int buffer_size) {
|
||||
const int symbology = symbol->symbology;
|
||||
@@ -3679,6 +3680,7 @@ int testUtilHaveZXingCPPDecoder(void) {
|
||||
return system("zxingcppdecoder " DEV_NULL_STDERR) == 0;
|
||||
}
|
||||
|
||||
/* Helper to test whether have non-ASCII */
|
||||
static int testUtilHasNonASCII(const char *source, const int length) {
|
||||
int i;
|
||||
for (i = 0; i < length; i++) {
|
||||
@@ -3825,7 +3827,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
|
||||
{ "", -1, 124, },
|
||||
{ "", -1, 125, },
|
||||
{ "", -1, 126, },
|
||||
{ "", -1, 127, },
|
||||
{ "DXFilmEdge", BARCODE_DXFILMEDGE, 127, },
|
||||
{ "", BARCODE_AZRUNE, 128, },
|
||||
{ "", BARCODE_CODE32, 129, }, /* Code39 based */
|
||||
{ "", BARCODE_EANX_CC, 130, },
|
||||
@@ -3844,6 +3846,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
|
||||
{ "QRCode", BARCODE_UPNQR, 143, },
|
||||
{ "", BARCODE_ULTRA, 144, },
|
||||
{ "RMQRCode", BARCODE_RMQR, 145, },
|
||||
{ "", BARCODE_BC412, 146, },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
|
||||
@@ -3906,6 +3909,7 @@ int testUtilCanZXingCPP(int index, const struct zint_symbol *symbol, const char
|
||||
return testUtilZXingCPPName(index, symbol, source, length, debug) != NULL;
|
||||
}
|
||||
|
||||
/* Run "zxingcppdecoder", returning result in `buffer` */
|
||||
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, char *bits,
|
||||
char *buffer, const int buffer_size, int *p_cmp_len) {
|
||||
static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits '%s'";
|
||||
@@ -4038,6 +4042,37 @@ INTERNAL int escape_char_process_test(struct zint_symbol *symbol, const unsigned
|
||||
|
||||
static const char TECHNETIUM[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; /* Same as SILVER (CODE39) */
|
||||
|
||||
/* Helper to strip leading zeroes (as long as have at least one non-zero digit) */
|
||||
static const char *testUtilZXingCPPLeadingZeroes(const char *expected) {
|
||||
const char *stripped = expected;
|
||||
while (*stripped == '0') stripped++;
|
||||
return z_isdigit(*stripped) ? stripped : expected;
|
||||
}
|
||||
|
||||
/* Helper to convert DX number from "NNNN"/"NNNNNN" format to "NNN-NN" format */
|
||||
static int textUtilZXingCPPDX(const char *expected, const int expected_len, const char *cmp_buf, char *out) {
|
||||
if (strchr(cmp_buf, '-')) {
|
||||
const char *stripped;
|
||||
if (strchr(expected, '-') == NULL) {
|
||||
if (expected_len == 6) {
|
||||
const int dx = to_int((const unsigned char *) expected + 1, expected_len - 2);
|
||||
sprintf(out, "%d-%d", dx / 16, dx % 16);
|
||||
} else {
|
||||
const int dx = to_int((const unsigned char *) expected, expected_len);
|
||||
sprintf(out, "%d-%d", dx / 16, dx % 16);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if ((stripped = testUtilZXingCPPLeadingZeroes(expected)) != expected) {
|
||||
memcpy(out, stripped, expected_len - (stripped - expected));
|
||||
out[expected_len - (stripped - expected)] = '\0';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Massage result from "zxingcppdecoder" so as can compare to Zint input */
|
||||
int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len,
|
||||
const char *expected, int expected_len, const char *primary, char *ret_buf, int *p_ret_len) {
|
||||
const int symbology = symbol->symbology;
|
||||
@@ -4068,6 +4103,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
||||
? (char *) z_alloca(expected_len + 3 + 19 + 1) : NULL;
|
||||
char *dpd = need_dpd_prefix ? (char *) z_alloca(28 + 1) : NULL;
|
||||
char *pzn = symbology == BARCODE_PZN ? (char *) z_alloca(expected_len + 1 + 1) : NULL;
|
||||
char *dxfe = symbology == BARCODE_DXFILMEDGE ? (char *) z_alloca(expected_len * 2 + 1) : NULL;
|
||||
|
||||
int ret;
|
||||
int ret_memcmp;
|
||||
@@ -4226,7 +4262,6 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
||||
expected_len++;
|
||||
}
|
||||
c25inter[expected_len] = '\0';
|
||||
printf("c25inter %s\n", c25inter);
|
||||
expected = c25inter;
|
||||
}
|
||||
} else if (symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT) {
|
||||
@@ -4397,6 +4432,48 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
||||
}
|
||||
expected = pzn;
|
||||
expected_len++;
|
||||
|
||||
} else if (symbology == BARCODE_DXFILMEDGE) {
|
||||
const int dx_info_len = posn(expected, '/');
|
||||
if (dx_info_len != -1) {
|
||||
char frame_info[20];
|
||||
assert(strlen(expected + dx_info_len + 1) < sizeof(frame_info));
|
||||
strcpy(frame_info, expected + dx_info_len + 1);
|
||||
to_upper((unsigned char *) frame_info, (int) strlen(frame_info));
|
||||
if (!textUtilZXingCPPDX(expected, dx_info_len, cmp_buf, dxfe)) {
|
||||
memcpy(dxfe, expected, dx_info_len);
|
||||
dxfe[dx_info_len] = '\0';
|
||||
}
|
||||
if (strcmp(frame_info, "S") == 0 || strcmp(frame_info, "X") == 0) {
|
||||
strcat(dxfe, "/62");
|
||||
} else if (strcmp(frame_info, "SA") == 0 || strcmp(frame_info, "XA") == 0) {
|
||||
strcat(dxfe, "/62A");
|
||||
} else if (strcmp(frame_info, "K") == 0 || strcmp(frame_info, "00") == 0) {
|
||||
strcat(dxfe, "/63");
|
||||
} else if (strcmp(frame_info, "KA") == 0 || strcmp(frame_info, "00A") == 0) {
|
||||
strcat(dxfe, "/63A");
|
||||
} else if (strcmp(frame_info, "F") == 0) {
|
||||
strcat(dxfe, "/0");
|
||||
} else if (strcmp(frame_info, "FA") == 0) {
|
||||
strcat(dxfe, "/0A");
|
||||
} else {
|
||||
const char *stripped;
|
||||
if ((stripped = testUtilZXingCPPLeadingZeroes(frame_info)) != frame_info) {
|
||||
strcat(dxfe, "/");
|
||||
strcat(dxfe, stripped);
|
||||
} else {
|
||||
strcat(dxfe, expected + dx_info_len);
|
||||
}
|
||||
}
|
||||
expected = dxfe;
|
||||
expected_len = (int) strlen(expected);
|
||||
to_upper((unsigned char *) expected, expected_len);
|
||||
} else {
|
||||
if (textUtilZXingCPPDX(expected, expected_len, cmp_buf, dxfe)) {
|
||||
expected = dxfe;
|
||||
expected_len = (int) strlen(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret_buf) {
|
||||
|
||||
+2
-2
@@ -248,6 +248,7 @@ extern "C" {
|
||||
#define BARCODE_MAILMARK 121 /* Legacy */
|
||||
|
||||
/* Zint specific */
|
||||
#define BARCODE_DXFILMEDGE 127 /* DX Film Edge Barcode on 35mm and APS films */
|
||||
#define BARCODE_AZRUNE 128 /* Aztec Runes */
|
||||
#define BARCODE_CODE32 129 /* Code 32 */
|
||||
#define BARCODE_EANX_CC 130 /* EAN Composite */
|
||||
@@ -274,8 +275,7 @@ extern "C" {
|
||||
#define BARCODE_ULTRA 144 /* Ultracode */
|
||||
#define BARCODE_RMQR 145 /* Rectangular Micro QR Code (rMQR) */
|
||||
#define BARCODE_BC412 146 /* IBM BC412 (SEMI T1-95) */
|
||||
#define BARCODE_DXFILMEDGE 147 /* DX Film Edge Barcode on 35mm and APS films*/
|
||||
#define BARCODE_LAST 147 /* Max barcode number marker, not barcode */
|
||||
#define BARCODE_LAST 146 /* Max barcode number marker, not barcode */
|
||||
|
||||
/* Output options (`symbol->output_options`) */
|
||||
#define BARCODE_BIND_TOP 0x00001 /* Boundary bar above the symbol only (not below), does not affect stacking */
|
||||
|
||||
Reference in New Issue
Block a user