HANXIN fix wrong func call gb2312_utf8tosb() -> gb18030_utf8tosb()

This commit is contained in:
gitlost 2020-03-30 11:59:16 +01:00
parent 9b771dba3a
commit 22354a81f1
11 changed files with 80 additions and 64 deletions

View File

@ -141,7 +141,7 @@ INTERNAL int posn(const char set_string[], const char data) {
/* Returns the number of times a character occurs in a string */
INTERNAL int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigned char c) {
int count = 0;
int i;
unsigned int i;
for (i = 0; i < length; i++) {
if (string[i] == c) {
count++;
@ -408,12 +408,12 @@ INTERNAL void pn_define_mode(char* mode, const unsigned int data[], const size_t
memcpy(prev_costs, (*head_costs)(state), num_modes * sizeof(unsigned int));
/* Calculate costs using dynamic programming */
for (i = 0, cm_i = 0; i < length; i++, cm_i += num_modes) {
for (i = 0, cm_i = 0; i < (int) length; i++, cm_i += num_modes) {
memset(cur_costs, 0, num_modes * sizeof(unsigned int));
(*cur_cost)(state, data, length, i, char_modes, prev_costs, cur_costs);
if (eod_cost && i == length - 1) { /* Add end of data costs if last character */
if (eod_cost && i == (int) length - 1) { /* Add end of data costs if last character */
for (j = 0; j < num_modes; j++) {
if (char_modes[cm_i + j]) {
cur_costs[j] += (*eod_cost)(state, j);

View File

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -2868,8 +2868,8 @@ INTERNAL int gb18030_wctomb_zint(unsigned int* r1, unsigned int* r2, unsigned in
/* Convert UTF-8 string to GB 18030 and place in array of ints */
INTERNAL int gb18030_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
int i, j, error_number, ret;
unsigned int length;
int error_number, ret;
unsigned int i, j, length;
#ifndef _MSC_VER
unsigned int utfdata[*p_length + 1];
#else
@ -2923,9 +2923,10 @@ INTERNAL int gb18030_utf8tosb(int eci, const unsigned char source[], size_t* p_l
/* Copy byte input stream to array of ints, putting double-bytes that match HANXIN Chinese mode in single entry, and quad-bytes in 2 entries */
INTERNAL void gb18030_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
int i, j, done;
unsigned int length;
unsigned int i, j, length;
int done;
unsigned char c1, c2, c3, c4;
for (i = 0, j = 0, length = *p_length; i < length; i++, j++) {
done = 0;
c1 = source[i];

View File

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1501,7 +1501,7 @@ static const Summary16 gb2312_uni2indx_pageff[15] = {
INTERNAL int gb2312_wctomb_zint(unsigned int* r, unsigned int wc) {
const Summary16 *summary = NULL;
if (wc >= 0x0000 && wc < 0x0460) {
if (wc < 0x0460) {
if (wc == 0x00b7) { /* ZINT: Patched to duplicate map to 0xA1A4 */
*r = 0xA1A4;
return 2;
@ -1542,8 +1542,8 @@ INTERNAL int gb2312_wctomb_zint(unsigned int* r, unsigned int wc) {
/* Convert UTF-8 string to GB 2312 (EUC-CN) and place in array of ints */
INTERNAL int gb2312_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
int i, error_number;
unsigned int length;
int error_number;
unsigned int i, length;
#ifndef _MSC_VER
unsigned int utfdata[*p_length + 1];
#else
@ -1591,9 +1591,9 @@ INTERNAL int gb2312_utf8tosb(int eci, const unsigned char source[], size_t* p_le
/* Copy byte input stream to array of ints, putting double-bytes that match GRIDMATRIX Chinese mode in single entry */
INTERNAL void gb2312_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
int i, j;
unsigned int length;
unsigned int i, j, length;
unsigned char c1, c2;
for (i = 0, j = 0, length = *p_length; i < length; i++, j++) {
if (length - i >= 2) {
c1 = source[i];

View File

@ -1,7 +1,7 @@
/* gridmtx.c - Grid Matrix
libzint - the open source barcode library
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -52,8 +52,8 @@
static const char numeral_nondigits[] = " +-.,"; /* Non-digit numeral set, excluding EOL (carriage return/linefeed) */
/* Whether in numeral or not. If in numeral, *p_numeral_end is set to position after numeral, and *p_numeral_cost is set to per-numeral cost */
static int in_numeral(const unsigned int gbdata[], const size_t length, const int posn, unsigned int* p_numeral_end, unsigned int* p_numeral_cost) {
int i, digit_cnt, nondigit, nondigit_posn;
static int in_numeral(const unsigned int gbdata[], const size_t length, const unsigned int posn, unsigned int* p_numeral_end, unsigned int* p_numeral_cost) {
unsigned int i, digit_cnt, nondigit, nondigit_posn;
if (posn < *p_numeral_end) {
return 1;
@ -128,6 +128,7 @@ static unsigned int head_costs[GM_NUM_MODES] = {
};
static unsigned int* gm_head_costs(unsigned int state[]) {
(void)state; /* Unused */
return head_costs;
}
@ -143,6 +144,7 @@ static unsigned int gm_switch_cost(unsigned int state[], const int k, const int
/*B*/ { 4 * GM_MULT, (4 + 2) * GM_MULT, 4 * GM_MULT, 4 * GM_MULT, 4 * GM_MULT, 0 },
};
(void)state; /* Unused */
return switch_costs[k][j];
}
@ -153,6 +155,7 @@ static unsigned int gm_eod_cost(unsigned int state[], const int k) {
13 * GM_MULT, 10 * GM_MULT, 5 * GM_MULT, 5 * GM_MULT, 10 * GM_MULT, 4 * GM_MULT
};
(void)state; /* Unused */
return eod_costs[k];
}
@ -170,8 +173,8 @@ static void gm_cur_cost(unsigned int state[], const unsigned int gbdata[], const
lower = gbdata[i] >= 'a' && gbdata[i] <= 'z';
upper = gbdata[i] >= 'A' && gbdata[i] <= 'Z';
control = !space && !numeric && !lower && !upper && gbdata[i] < 0x7F; /* Exclude DEL */
double_digit = i < length - 1 && numeric && gbdata[i + 1] >= '0' && gbdata[i + 1] <= '9';
eol = i < length - 1 && gbdata[i] == 13 && gbdata[i + 1] == 10;
double_digit = i < (int) length - 1 && numeric && gbdata[i + 1] >= '0' && gbdata[i + 1] <= '9';
eol = i < (int) length - 1 && gbdata[i] == 13 && gbdata[i + 1] == 10;
/* Hanzi mode can encode anything */
cur_costs[GM_H] = prev_costs[GM_H] + (double_digit || eol ? 39 : 78); /* (6.5 : 13) * GM_MULT */
@ -254,7 +257,8 @@ static int gm_encode(unsigned int gbdata[], const size_t length, char binary[],
/* Create a binary stream representation of the input data.
7 sets are defined - Chinese characters, Numerals, Lower case letters, Upper case letters,
Mixed numerals and latters, Control characters and 8-bit binary data */
int sp, current_mode, last_mode;
unsigned int sp;
int current_mode, last_mode;
unsigned int glyph = 0;
int c1, c2, done;
int p = 0, ppos;
@ -730,7 +734,7 @@ static void gm_add_ecc(const char binary[], const size_t data_posn, const int la
}
/* Convert from binary stream to 7-bit codewords */
for (i = 0; i < data_posn; i++) {
for (i = 0; i < (int) data_posn; i++) {
for (p = 0; p < 7; p++) {
if (binary[i * 7 + p] == '1') {
data[i] += (0x40 >> p);

View File

@ -1,7 +1,7 @@
/* hanxin.c - Han Xin Code
libzint - the open source barcode library
Copyright (C) 2009-2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -298,8 +298,8 @@ static int lookup_text2(unsigned int input) {
#define HX_MULT 6
/* Whether in numeric or not. If in numeric, *p_end is set to position after numeric, and *p_cost is set to per-numeric cost */
static int in_numeric(const unsigned int gbdata[], const size_t length, const int posn, unsigned int* p_end, unsigned int* p_cost) {
int i, digit_cnt;
static int in_numeric(const unsigned int gbdata[], const size_t length, const unsigned int posn, unsigned int* p_end, unsigned int* p_cost) {
unsigned int i, digit_cnt;
if (posn < *p_end) {
return 1;
@ -320,7 +320,7 @@ static int in_numeric(const unsigned int gbdata[], const size_t length, const in
}
/* Whether in four-byte or not. If in four-byte, *p_fourbyte is set to position after four-byte, and *p_fourbyte_cost is set to per-position cost */
static int in_fourbyte(const unsigned int gbdata[], const size_t length, const int posn, unsigned int* p_end, unsigned int* p_cost) {
static int in_fourbyte(const unsigned int gbdata[], const size_t length, const unsigned int posn, unsigned int* p_end, unsigned int* p_cost) {
if (posn < *p_end) {
return 1;
}
@ -353,6 +353,7 @@ static unsigned int* hx_head_costs(unsigned int state[]) {
4 * HX_MULT, 4 * HX_MULT, (4 + 13) * HX_MULT, 4 * HX_MULT, 4 * HX_MULT, 4 * HX_MULT, 0
};
(void)state; /* Unused */
return head_costs;
}
@ -369,6 +370,7 @@ static unsigned int hx_switch_cost(unsigned int state[], const int k, const int
/*F*/ { 4 * HX_MULT, 4 * HX_MULT, (4 + 13) * HX_MULT, 4 * HX_MULT, 4 * HX_MULT, 4 * HX_MULT, 0 },
};
(void)state; /* Unused */
return switch_costs[k][j];
}
@ -379,6 +381,7 @@ static unsigned int hx_eod_cost(unsigned int state[], const int k) {
10 * HX_MULT, 6 * HX_MULT, 0, 12 * HX_MULT, 12 * HX_MULT, 15 * HX_MULT, 0
};
(void)state; /* Unused */
return eod_costs[k];
}
@ -444,7 +447,7 @@ static void hx_define_mode(char* mode, const unsigned int gbdata[], const size_t
/* Convert input data to binary stream */
static void calculate_binary(char binary[], char mode[], unsigned int source[], const size_t length, const int eci, int debug) {
int position = 0;
unsigned int position = 0;
int i, count, encoding_value;
int first_byte, second_byte;
int third_byte, fourth_byte;
@ -1401,7 +1404,7 @@ INTERNAL int han_xin(struct zint_symbol *symbol, const unsigned char source[], s
int done = 0;
if (symbol->eci != 29) { /* Unless ECI 29 (GB) */
/* Try single byte (Latin) conversion first */
int error_number = gb2312_utf8tosb(symbol->eci && symbol->eci <= 899 ? symbol->eci : 3, source, &length, gbdata);
int error_number = gb18030_utf8tosb(symbol->eci && symbol->eci <= 899 ? symbol->eci : 3, source, &length, gbdata);
if (error_number == 0) {
done = 1;
} else if (symbol->eci && symbol->eci <= 899) {

View File

@ -1,7 +1,7 @@
/* qr.c Handles QR Code, Micro QR Code, UPNQR and rMQR
libzint - the open source barcode library
Copyright (C) 2009 - 2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009 - 2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -76,8 +76,8 @@ static int is_alpha(const unsigned int glyph, const int gs1) {
#define QR_MULT 6
/* Whether in numeric or not. If in numeric, *p_end is set to position after numeric, and *p_cost is set to per-numeric cost */
static int in_numeric(const unsigned int jisdata[], const size_t length, const int posn, unsigned int* p_end, unsigned int* p_cost) {
int i, digit_cnt;
static int in_numeric(const unsigned int jisdata[], const size_t length, const unsigned int posn, unsigned int* p_end, unsigned int* p_cost) {
unsigned int i, digit_cnt;
if (posn < *p_end) {
return 1;
@ -98,7 +98,7 @@ static int in_numeric(const unsigned int jisdata[], const size_t length, const i
}
/* Whether in alpha or not. If in alpha, *p_end is set to position after alpha, and *p_cost is set to per-alpha cost. For GS1, *p_pcent set if 2nd char percent */
static int in_alpha(const unsigned int jisdata[], const size_t length, const int posn, unsigned int* p_end, unsigned int* p_cost, unsigned int* p_pcent, unsigned int gs1) {
static int in_alpha(const unsigned int jisdata[], const size_t length, const unsigned int posn, unsigned int* p_end, unsigned int* p_cost, unsigned int* p_pcent, unsigned int gs1) {
int two_alphas;
if (posn < *p_end) {
@ -200,6 +200,7 @@ static unsigned int* qr_head_costs(unsigned int state[]) {
/* Costs of switching modes from k to j */
static unsigned int qr_switch_cost(unsigned int state[], const int k, const int j) {
(void)k; /* Unused */
return state[j]; /* Same as head cost */
}
@ -326,7 +327,7 @@ static int terminator_bits(const int version) {
/* Convert input data to a binary stream and add padding */
static void qr_binary(unsigned char datastream[], const int version, const int target_codewords, const char mode[], const unsigned int jisdata[], const size_t length,
const int gs1, const int eci, const int est_binlen, const int debug) {
int position = 0;
unsigned int position = 0;
int i;
int termbits, padbits;
int current_binlen, current_bytes;
@ -360,7 +361,7 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
}
if (debug & ZINT_DEBUG_PRINT) {
for (i = 0; i < length; i++) {
for (i = 0; i < (int) length; i++) {
printf("%c", mode[i]);
}
printf("\n");
@ -1428,9 +1429,8 @@ static size_t blockLength(const size_t start,const char inputMode[],const size_t
static int getBinaryLength(const int version, char inputMode[], const unsigned int inputData[], const size_t inputLength, const int gs1, const int eci, const int debug) {
/* Calculate the actual bitlength of the proposed binary string */
size_t i;
size_t i, j;
char currentMode;
int j;
int count = 0;
int alphalength;
int blocklength;
@ -1830,6 +1830,8 @@ static void micro_qr_m1(struct zint_symbol *symbol, char binary_data[]) {
}
#ifdef ZINT_TEST
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords);
#else
(void)symbol; /* Unused */
#endif
/* Calculate Reed-Solomon error codewords */
@ -1911,6 +1913,8 @@ static void micro_qr_m2(struct zint_symbol *symbol, char binary_data[], const in
}
#ifdef ZINT_TEST
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords);
#else
(void)symbol; /* Unused */
#endif
/* Calculate Reed-Solomon error codewords */
@ -2026,6 +2030,8 @@ static void micro_qr_m3(struct zint_symbol *symbol, char binary_data[], const in
}
#ifdef ZINT_TEST
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords);
#else
(void)symbol; /* Unused */
#endif
/* Calculate Reed-Solomon error codewords */
@ -2116,6 +2122,8 @@ static void micro_qr_m4(struct zint_symbol *symbol, char binary_data[], const in
}
#ifdef ZINT_TEST
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords);
#else
(void)symbol; /* Unused */
#endif
/* Calculate Reed-Solomon error codewords */
@ -2168,8 +2176,8 @@ static void micro_setup_grid(unsigned char* grid,const int size) {
static void micro_populate_grid(unsigned char* grid,const int size,const char full_stream[]) {
int direction = 1; /* up */
int row = 0; /* right hand side */
size_t n;
int i, y;
size_t n, i;
int y;
n = strlen(full_stream);
y = size - 1;
@ -2334,8 +2342,7 @@ static int micro_apply_bitmask(unsigned char *grid,const int size) {
}
INTERNAL int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
size_t i;
int j, size;
size_t i, size, j;
char full_stream[200];
unsigned int jisdata[40];
@ -2656,7 +2663,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, const unsigned char source[], siz
switch (symbol->input_mode & 0x07) {
case DATA_MODE:
/* Input is already in ISO-8859-2 format */
for (i = 0; i < length; i++) {
for (i = 0; i < (int) length; i++) {
jisdata[i] = source[i];
mode[i] = 'B';
}
@ -2671,7 +2678,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, const unsigned char source[], siz
strcpy(symbol->errtxt, "572: Invalid characters in input data");
return error_number;
}
for (i = 0; i < length; i++) {
for (i = 0; i < (int) length; i++) {
jisdata[i] = preprocessed[i];
mode[i] = 'B';
}
@ -2742,7 +2749,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, const unsigned char source[], siz
return 0;
}
static void setup_rmqr_grid(unsigned char* grid,const int h_size,const int v_size,const int version) {
static void setup_rmqr_grid(unsigned char* grid, const int h_size, const int v_size) {
int i, j;
char alignment[] = {0x1F, 0x11, 0x15, 0x11, 0x1F};
int h_version, finder_position;
@ -3033,7 +3040,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, const unsigned char source[], size
}
}
setup_rmqr_grid(grid, h_size, v_size, version);
setup_rmqr_grid(grid, h_size, v_size);
populate_grid(grid, h_size, v_size, fullstream, rmqr_total_codewords[version]);
/* apply bitmask */

View File

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1443,7 +1443,7 @@ static const Summary16 jisx0208_uni2indx_pageff[15] = {
static int jisx0208_wctomb(unsigned int* r, unsigned int wc) {
const Summary16 *summary = NULL;
if (wc >= 0x0000 && wc < 0x0100) {
if (wc < 0x0100) {
summary = &jisx0208_uni2indx_page00[(wc>>4)];
} else if (wc >= 0x0300 && wc < 0x0460) {
summary = &jisx0208_uni2indx_page03[(wc>>4)-0x030];
@ -1513,8 +1513,8 @@ INTERNAL int sjis_wctomb_zint(unsigned int* r, unsigned int wc) {
/* Convert UTF-8 string to Shift JIS and place in array of ints */
INTERNAL int sjis_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* jisdata) {
int i, error_number;
unsigned int length;
int error_number;
unsigned int i, length;
#ifndef _MSC_VER
unsigned int utfdata[*p_length + 1];
#else
@ -1558,9 +1558,9 @@ INTERNAL int sjis_utf8tosb(int eci, const unsigned char source[], size_t* p_leng
/* Copy byte input stream to array of ints, putting double-bytes that match QR Kanji mode in single entry */
INTERNAL void sjis_cpy(const unsigned char source[], size_t* p_length, unsigned int* jisdata) {
int i, j;
unsigned int jis, length;
unsigned int i, j, jis, length;
unsigned char c;
for (i = 0, j = 0, length = *p_length; i < length; i++, j++) {
c = source[i];
if (((c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xEB)) && length - i >= 2) {

View File

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -273,7 +273,7 @@ static void test_gb18030_cpy(void)
int length;
int ret;
size_t ret_length;
unsigned int expected_jisdata[20];
unsigned int expected_gbdata[20];
char* comment;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
@ -287,17 +287,17 @@ static void test_gb18030_cpy(void)
int data_size = sizeof(data) / sizeof(struct item);
unsigned int jisdata[40];
unsigned int gbdata[20];
for (int i = 0; i < data_size; i++) {
int length = data[i].length == -1 ? strlen(data[i].data) : data[i].length;
size_t ret_length = length;
gb18030_cpy(data[i].data, &ret_length, jisdata);
gb18030_cpy(data[i].data, &ret_length, gbdata);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < ret_length; j++) {
assert_equal(jisdata[j], data[i].expected_jisdata[j], "i:%d jisdata[%d] %04X != %04X\n", i, j, jisdata[j], data[i].expected_jisdata[j]);
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
}
}

View File

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -216,7 +216,7 @@ static void test_gb2312_cpy(void)
int length;
int ret;
size_t ret_length;
unsigned int expected_jisdata[20];
unsigned int expected_gbdata[20];
char* comment;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
@ -230,17 +230,17 @@ static void test_gb2312_cpy(void)
int data_size = sizeof(data) / sizeof(struct item);
unsigned int jisdata[20];
unsigned int gbdata[20];
for (int i = 0; i < data_size; i++) {
int length = data[i].length == -1 ? strlen(data[i].data) : data[i].length;
size_t ret_length = length;
gb2312_cpy(data[i].data, &ret_length, jisdata);
gb2312_cpy(data[i].data, &ret_length, gbdata);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < ret_length; j++) {
assert_equal(jisdata[j], data[i].expected_jisdata[j], "i:%d jisdata[%d] %04X != %04X\n", i, j, jisdata[j], data[i].expected_jisdata[j]);
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
}
}

View File

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -144,6 +144,7 @@ static void test_input(void)
/* 21*/ { UNICODE_MODE, 0, "Summer Palace Ticket for 6 June 2015 13:00;2015年6月6日夜01時00分PM頤和園のチケット;2015년6월6일13시오후여름궁전티켓.2015年6月6号下午13:00的颐和园门票;", -1, 0, 0, "(189) 27 38 C3 0A 35 F9 CF 99 92 F9 26 A3 E7 3E 76 C9 AE A3 7F CC 08 04 0C CD EE 44 06 C4", "T20 B64 N4 H(f)1 T1 H(f)1 T1 H(f)1 T2 H(f)9 B35 (GB 18030)" },
/* 22*/ { UNICODE_MODE, 0, "\000\014\033 #/059:<@AMZ", 15, 0, 0, "2F 80 31 B7 1F AF E0 05 27 EB 2E CB E2 96 8F F0 00", "T15 (ASCII)" },
/* 23*/ { UNICODE_MODE, 0, "Z[\\`alz{~\177", -1, 0, 0, "28 FE CF 4E 3E 92 FF 7E E7 CF 7F 00 00", "T10 (ASCII)" },
/* 24*/ { UNICODE_MODE, 26, "\2021\2033", -1, 0, 26, "81 A7 01 B1 D8 00 00 00 00", "ECI-26 H(f)1 (GB 18030)" },
};
int data_size = sizeof(data) / sizeof(struct item);

View File

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -236,9 +236,9 @@ static void test_sjis_cpy(void)
struct item data[] = {
/* 0*/ { "\351", -1, 0, 1, { 0xE9 }, "In QR Kanji mode first-byte range but only one byte" },
/* 1*/ { "\351\141", -1, 0, 1, { 0xE961 }, "In QR Kanji mode range" },
/* 0*/ { "\201", -1, 0, 1, { 0x81 }, "In QR Kanji mode first-byte range but only one byte" },
/* 0*/ { "\201\141", -1, 0, 1, { 0x8161 }, "In QR Kanji mode range" },
/* 0*/ { "\201\077\201\100\237\374\237\375\340\077\340\100\353\277\353\300", -1, 0, 12, { 0x81, 0x3F, 0x8140, 0x9FFC, 0x9F, 0xFD, 0xE0, 0x3F, 0xE040, 0xEBBF, 0xEB, 0xC0 }, "" },
/* 2*/ { "\201", -1, 0, 1, { 0x81 }, "In QR Kanji mode first-byte range but only one byte" },
/* 3*/ { "\201\141", -1, 0, 1, { 0x8161 }, "In QR Kanji mode range" },
/* 4*/ { "\201\077\201\100\237\374\237\375\340\077\340\100\353\277\353\300", -1, 0, 12, { 0x81, 0x3F, 0x8140, 0x9FFC, 0x9F, 0xFD, 0xE0, 0x3F, 0xE040, 0xEBBF, 0xEB, 0xC0 }, "" },
};
int data_size = sizeof(data) / sizeof(struct item);