mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
ECI: Update ECIs to AIM ITS/04-023:2022, adding UTF-16BE (was USC-2BE),
UTF-16LE, GBK, separate GB18030, UTF-32BE, UTF-32LE add examples to tests for DATAMATRIX, HANXIN, QRCODE HANXIN: Remove alternating filler in function information; GB 18030 now ECI 32 (previously used ECI 29); fix gate-posts on codeword limits use new ZXing-C++ HanXin detector (diagnostics2 branch) for tests check against ISO/IEC 20830:2021 (no substantive changes) backend_tcl: update ECIs; NOTE: changed names "unicode" -> "utf-16be", "euc-cn" -> "gb2312" GRIDMATRIX/HANXIN/QRCODE/RMQR: warn if auto-conversion (i.e. no ECI given) occurs to resp. specialized char sets (GB 2312/GB 18030/Shift JIS)
This commit is contained in:
19
backend/qr.c
19
backend/qr.c
@ -1,7 +1,7 @@
|
||||
/* qr.c Handles QR Code, Micro QR Code, UPNQR and rMQR
|
||||
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2009 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@ -28,7 +28,6 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <math.h>
|
||||
#ifdef _MSC_VER
|
||||
@ -1541,6 +1540,7 @@ static int getBinaryLength(const int version, char inputMode[], const unsigned i
|
||||
}
|
||||
|
||||
INTERNAL int qrcode(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int warn_number = 0;
|
||||
int i, j, est_binlen, prev_est_binlen;
|
||||
int ecc_level, autosize, version, max_cw, target_codewords, blocks, size;
|
||||
int bitmask, gs1;
|
||||
@ -1593,6 +1593,10 @@ INTERNAL int qrcode(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
if (error_number != 0) {
|
||||
return error_number;
|
||||
}
|
||||
if (symbol->eci != 20) {
|
||||
strcpy(symbol->errtxt, "543: Converted to Shift JIS but no ECI specified");
|
||||
warn_number = ZINT_WARN_NONCOMPLIANT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1832,7 +1836,7 @@ INTERNAL int qrcode(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
}
|
||||
symbol->height = size;
|
||||
|
||||
return 0;
|
||||
return warn_number;
|
||||
}
|
||||
|
||||
static int micro_qr_m1(struct zint_symbol *symbol, char binary_data[], int bp) {
|
||||
@ -2967,6 +2971,7 @@ static void setup_rmqr_grid(unsigned char *grid, const int h_size, const int v_s
|
||||
|
||||
/* rMQR according to 2018 draft standard */
|
||||
INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int warn_number = 0;
|
||||
int i, j, est_binlen;
|
||||
int ecc_level, autosize, version, max_cw, target_codewords, blocks, h_size, v_size;
|
||||
int gs1;
|
||||
@ -3011,6 +3016,10 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length
|
||||
if (error_number != 0) {
|
||||
return error_number;
|
||||
}
|
||||
if (symbol->eci != 20) {
|
||||
strcpy(symbol->errtxt, "544: Converted to Shift JIS but no ECI specified");
|
||||
warn_number = ZINT_WARN_NONCOMPLIANT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3214,5 +3223,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length
|
||||
}
|
||||
symbol->height = v_size;
|
||||
|
||||
return 0;
|
||||
return warn_number;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
Reference in New Issue
Block a user