CODEONE/ULTRA overrun fixes; TELEPEN fixes; CODEONE/LOGMARS/VIN/CODABAR options; GUI updates; tests

This commit is contained in:
gitlost
2020-06-04 18:45:25 +01:00
parent 8131471573
commit 6242e02638
80 changed files with 6393 additions and 2179 deletions

View File

@ -31,15 +31,15 @@
*/
/* vim: set ts=4 sw=4 et : */
#define SODIUM "0123456789X"
/* Telepen Barcode Symbology information and History (BSiH) https://telepen.co.uk/wp-content/uploads/2018/10/Barcode-Symbology-information-and-History.pdf */
#define SODIUM "0123456789X"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
static char *TeleTable[] = {
"1111111111111111", "1131313111", "33313111", "1111313131", "3111313111", "11333131", "13133131", "111111313111",
"31313131", "1131313111", "33313111", "1111313131", "3111313111", "11333131", "13133131", "111111313111",
"31333111", "1131113131", "33113131", "1111333111", "3111113131", "1113133111", "1311133111", "111111113131",
"3131113111", "11313331", "333331", "111131113111", "31113331", "1133113111", "1313113111", "1111113331",
"31131331", "113111113111", "3311113111", "1111131331", "311111113111", "1113111331", "1311111331", "11111111113111",
@ -49,18 +49,18 @@ static char *TeleTable[] = {
"3113111311", "113111111131", "3311111131", "111113111311", "311111111131", "111311111311", "131111111311", "11111111111131",
"3131311111", "11313133", "333133", "111131311111", "31113133", "1133311111", "1313311111", "1111113133",
"313333", "113111311111", "3311311111", "11113333", "311111311111", "11131333", "13111333", "11111111311111",
"31311133", "1131331111", "33331111", " 1111311133", "3111331111", "11331133", "13131133", "111111331111",
"31311133", "1131331111", "33331111", "1111311133", "3111331111", "11331133", "13131133", "111111331111",
"3113131111", "1131111133", "33111133", "111113131111", "3111111133", "111311131111", "131111131111", "111111111133",
"31311313", "113131111111", "3331111111", "1111311313", "311131111111", "11331313", "13131313", "11111131111111",
"3133111111", "1131111313", "33111313", "111133111111", "3111111313", "111313111111", "131113111111", "111111111313",
"313111111111", "1131131113", "33131113", "11113111111111", "3111131113", "113311111111", "131311111111", "111111131113",
"3113111113", "11311111111111", "331111111111", "111113111113", "31111111111111", "111311111113", "131111111113"
"3113111113", "11311111111111", "331111111111", "111113111113", "31111111111111", "111311111113", "131111111113", "1111111111111111",
};
INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], const size_t src_len) {
unsigned int i, count, check_digit;
int error_number;
char dest[521]; /* 12 (start) + 30 * 16 (max for nuls) + 16 (check digit) + 12 (stop) + 1 = 521 */
char dest[521]; /* 12 (start) + 30 * 16 (max for DELs) + 16 (check digit) + 12 (stop) + 1 = 521 */
error_number = 0;
@ -74,7 +74,7 @@ INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], const s
strcpy(dest, TeleTable['_']);
for (i = 0; i < src_len; i++) {
if (source[i] > 126) {
if (source[i] > 127) {
/* Cannot encode extended ASCII */
strcpy(symbol->errtxt, "391: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
@ -107,8 +107,8 @@ INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], const s
INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t src_len) {
unsigned int count, check_digit, glyph;
int error_number;
size_t i,temp_length = src_len;
char dest[521]; /* 12 (start) + 30 * 16 (max for nuls) + 16 (check digit) + 12 (stop) + 1 = 521 */
size_t i, temp_length = src_len;
char dest[521]; /* 12 (start) + 30 * 16 (max for DELs) + 16 (check digit) + 12 (stop) + 1 = 521 */
unsigned char temp[64];
count = 0;