mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Replace local concat() and roundup() with C library defaults
Patch by Oxy (Michael) <virtual_worlds@gmx.de> Ref: https://sourceforge.net/p/zint/mailman/message/34896811/
This commit is contained in:
parent
0a034fd5ea
commit
f17f10fa7c
@ -84,7 +84,7 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "41111");
|
||||
strcat(dest, "41111");
|
||||
|
||||
expand(symbol, dest);
|
||||
ustrcpy(symbol->text, source);
|
||||
@ -117,7 +117,7 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "31113");
|
||||
strcat(dest, "31113");
|
||||
|
||||
expand(symbol, dest);
|
||||
ustrcpy(symbol->text, source);
|
||||
@ -149,7 +149,7 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len
|
||||
}
|
||||
|
||||
/* stop */
|
||||
concat(dest, "311");
|
||||
strcat(dest, "311");
|
||||
|
||||
expand(symbol, dest);
|
||||
ustrcpy(symbol->text, source);
|
||||
@ -182,7 +182,7 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "311");
|
||||
strcat(dest, "311");
|
||||
|
||||
expand(symbol, dest);
|
||||
ustrcpy(symbol->text, source);
|
||||
@ -219,7 +219,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[],
|
||||
ustrcpy(temp, (unsigned char *) "0");
|
||||
length++;
|
||||
}
|
||||
uconcat(temp, source);
|
||||
strcat((char*)temp, (char*)source);
|
||||
|
||||
/* start character */
|
||||
strcpy(dest, "1111");
|
||||
@ -240,11 +240,11 @@ int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[],
|
||||
k++;
|
||||
}
|
||||
mixed[k] = '\0';
|
||||
concat(dest, mixed);
|
||||
strcat(dest, mixed);
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "311");
|
||||
strcat(dest, "311");
|
||||
|
||||
expand(symbol, dest);
|
||||
ustrcpy(symbol->text, temp);
|
||||
|
@ -88,7 +88,7 @@ void rs_error(char data_pattern[]) {
|
||||
rs_encode(triple_writer, (unsigned char*) inv_triple, result);
|
||||
|
||||
for (reader = 4; reader > 0; reader--) {
|
||||
concat(data_pattern, AusBarTable[(int) result[reader - 1]]);
|
||||
strcat(data_pattern, AusBarTable[(int) result[reader - 1]]);
|
||||
}
|
||||
rs_free();
|
||||
}
|
||||
@ -164,7 +164,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
localstr[8] = '\0';
|
||||
}
|
||||
|
||||
concat(localstr, (char*) source);
|
||||
strcat(localstr, (char*) source);
|
||||
h = strlen(localstr);
|
||||
error_number = is_sane(GDSET, (unsigned char *) localstr, h);
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
@ -215,7 +215,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
case 22:
|
||||
case 37:
|
||||
case 52:
|
||||
concat(data_pattern, "3");
|
||||
strcat(data_pattern, "3");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -225,7 +225,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
rs_error(data_pattern);
|
||||
|
||||
/* Stop character */
|
||||
concat(data_pattern, "13");
|
||||
strcat(data_pattern, "13");
|
||||
|
||||
/* Turn the symbol into a bar pattern ready for plotting */
|
||||
writer = 0;
|
||||
|
172
backend/aztec.c
172
backend/aztec.c
@ -311,21 +311,21 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case (64 + UPPER): /* To UPPER */
|
||||
switch (curtable) {
|
||||
case LOWER: /* US */
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("US ");
|
||||
break;
|
||||
case MIXED: /* UL */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("UL ");
|
||||
newtable = UPPER;
|
||||
break;
|
||||
case PUNC: /* UL */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
newtable = UPPER;
|
||||
break;
|
||||
case DIGIT: /* US */
|
||||
concat(binary_string, pentbit[15]);
|
||||
strcat(binary_string, pentbit[15]);
|
||||
if (debug) printf("US ");
|
||||
break;
|
||||
}
|
||||
@ -333,26 +333,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case (64 + LOWER): /* To LOWER */
|
||||
switch (curtable) {
|
||||
case UPPER: /* LL */
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("LL ");
|
||||
newtable = LOWER;
|
||||
break;
|
||||
case MIXED: /* LL */
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("LL ");
|
||||
newtable = LOWER;
|
||||
break;
|
||||
case PUNC: /* UL LL */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("LL ");
|
||||
newtable = LOWER;
|
||||
break;
|
||||
case DIGIT: /* UL LL */
|
||||
concat(binary_string, pentbit[14]);
|
||||
strcat(binary_string, pentbit[14]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("LL ");
|
||||
newtable = LOWER;
|
||||
break;
|
||||
@ -361,26 +361,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case (64 + MIXED): /* To MIXED */
|
||||
switch (curtable) {
|
||||
case UPPER: /* ML */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
newtable = MIXED;
|
||||
break;
|
||||
case LOWER: /* ML */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
newtable = MIXED;
|
||||
break;
|
||||
case PUNC: /* UL ML */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
newtable = MIXED;
|
||||
break;
|
||||
case DIGIT: /* UL ML */
|
||||
concat(binary_string, pentbit[14]);
|
||||
strcat(binary_string, pentbit[14]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
newtable = MIXED;
|
||||
break;
|
||||
@ -389,19 +389,19 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case (64 + PUNC): /* To PUNC */
|
||||
switch (curtable) {
|
||||
case UPPER: /* PS */
|
||||
concat(binary_string, hexbit[0]);
|
||||
strcat(binary_string, hexbit[0]);
|
||||
if (debug) printf("PS ");
|
||||
break;
|
||||
case LOWER: /* PS */
|
||||
concat(binary_string, hexbit[0]);
|
||||
strcat(binary_string, hexbit[0]);
|
||||
if (debug) printf("PS ");
|
||||
break;
|
||||
case MIXED: /* PS */
|
||||
concat(binary_string, hexbit[0]);
|
||||
strcat(binary_string, hexbit[0]);
|
||||
if (debug) printf("PS ");
|
||||
break;
|
||||
case DIGIT: /* PS */
|
||||
concat(binary_string, pentbit[0]);
|
||||
strcat(binary_string, pentbit[0]);
|
||||
if (debug) printf("PS ");
|
||||
break;
|
||||
}
|
||||
@ -409,26 +409,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case (64 + DIGIT): /* To DIGIT */
|
||||
switch (curtable) {
|
||||
case UPPER: /* DL */
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("DL ");
|
||||
newtable = DIGIT;
|
||||
break;
|
||||
case LOWER: /* DL */
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("DL ");
|
||||
newtable = DIGIT;
|
||||
break;
|
||||
case MIXED: /* UL DL */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("DL ");
|
||||
newtable = DIGIT;
|
||||
break;
|
||||
case PUNC: /* UL DL */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("DL ");
|
||||
newtable = DIGIT;
|
||||
break;
|
||||
@ -441,24 +441,24 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case UPPER: /* To UPPER */
|
||||
switch (curtable) {
|
||||
case LOWER: /* ML UL */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("UL ");
|
||||
newtable = UPPER;
|
||||
break;
|
||||
case MIXED: /* UL */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("UL ");
|
||||
newtable = UPPER;
|
||||
break;
|
||||
case PUNC: /* UL */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
newtable = UPPER;
|
||||
break;
|
||||
case DIGIT: /* UL */
|
||||
concat(binary_string, pentbit[14]);
|
||||
strcat(binary_string, pentbit[14]);
|
||||
if (debug) printf("UL ");
|
||||
newtable = UPPER;
|
||||
break;
|
||||
@ -467,26 +467,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case LOWER: /* To LOWER */
|
||||
switch (curtable) {
|
||||
case UPPER: /* LL */
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("LL ");
|
||||
newtable = LOWER;
|
||||
break;
|
||||
case MIXED: /* LL */
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("LL ");
|
||||
newtable = LOWER;
|
||||
break;
|
||||
case PUNC: /* UL LL */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("LL ");
|
||||
newtable = LOWER;
|
||||
break;
|
||||
case DIGIT: /* UL LL */
|
||||
concat(binary_string, pentbit[14]);
|
||||
strcat(binary_string, pentbit[14]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[28]);
|
||||
strcat(binary_string, hexbit[28]);
|
||||
if (debug) printf("LL ");
|
||||
newtable = LOWER;
|
||||
break;
|
||||
@ -495,26 +495,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case MIXED: /* To MIXED */
|
||||
switch (curtable) {
|
||||
case UPPER: /* ML */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
newtable = MIXED;
|
||||
break;
|
||||
case LOWER: /* ML */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
newtable = MIXED;
|
||||
break;
|
||||
case PUNC: /* UL ML */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
newtable = MIXED;
|
||||
break;
|
||||
case DIGIT: /* UL ML */
|
||||
concat(binary_string, pentbit[14]);
|
||||
strcat(binary_string, pentbit[14]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
newtable = MIXED;
|
||||
break;
|
||||
@ -523,30 +523,30 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case PUNC: /* To PUNC */
|
||||
switch (curtable) {
|
||||
case UPPER: /* ML PL */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("PL ");
|
||||
newtable = PUNC;
|
||||
break;
|
||||
case LOWER: /* ML PL */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("PL ");
|
||||
newtable = PUNC;
|
||||
break;
|
||||
case MIXED: /* PL */
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("PL ");
|
||||
newtable = PUNC;
|
||||
break;
|
||||
case DIGIT: /* UL ML PL */
|
||||
concat(binary_string, pentbit[14]);
|
||||
strcat(binary_string, pentbit[14]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("ML ");
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("PL ");
|
||||
newtable = PUNC;
|
||||
break;
|
||||
@ -555,26 +555,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case DIGIT: /* To DIGIT */
|
||||
switch (curtable) {
|
||||
case UPPER: /* DL */
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("DL ");
|
||||
newtable = DIGIT;
|
||||
break;
|
||||
case LOWER: /* DL */
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("DL ");
|
||||
newtable = DIGIT;
|
||||
break;
|
||||
case MIXED: /* UL DL */
|
||||
concat(binary_string, hexbit[29]);
|
||||
strcat(binary_string, hexbit[29]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("DL ");
|
||||
newtable = DIGIT;
|
||||
break;
|
||||
case PUNC: /* UL DL */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[30]);
|
||||
strcat(binary_string, hexbit[30]);
|
||||
if (debug) printf("DL ");
|
||||
newtable = DIGIT;
|
||||
break;
|
||||
@ -584,32 +584,32 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
lasttable = curtable;
|
||||
switch (curtable) {
|
||||
case UPPER: /* BS */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("BS ");
|
||||
newtable = BINARY;
|
||||
break;
|
||||
case LOWER: /* BS */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("BS ");
|
||||
newtable = BINARY;
|
||||
break;
|
||||
case MIXED: /* BS */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("BS ");
|
||||
newtable = BINARY;
|
||||
break;
|
||||
case PUNC: /* UL BS */
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("BS ");
|
||||
lasttable = UPPER;
|
||||
newtable = BINARY;
|
||||
break;
|
||||
case DIGIT: /* UL BS */
|
||||
concat(binary_string, pentbit[14]);
|
||||
strcat(binary_string, pentbit[14]);
|
||||
if (debug) printf("UL ");
|
||||
concat(binary_string, hexbit[31]);
|
||||
strcat(binary_string, hexbit[31]);
|
||||
if (debug) printf("BS ");
|
||||
lasttable = UPPER;
|
||||
newtable = BINARY;
|
||||
@ -628,22 +628,22 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
|
||||
if (bytes > 31) {
|
||||
/* Put 00000 followed by 11-bit number of bytes less 31 */
|
||||
concat(binary_string, "00000");
|
||||
strcat(binary_string, "00000");
|
||||
|
||||
for (p = 0; p < 11; p++) {
|
||||
if ((bytes - 31) & (0x400 >> p)) {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
} else {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Put 5-bit number of bytes */
|
||||
for (p = 0; p < 5; p++) {
|
||||
if (bytes & (0x10 >> p)) {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
} else {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -665,24 +665,24 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
case MIXED:
|
||||
case PUNC:
|
||||
if (charmap[i] >= 400) {
|
||||
concat(binary_string, tribit[charmap[i] - 400]);
|
||||
strcat(binary_string, tribit[charmap[i] - 400]);
|
||||
if (debug) printf("FLG(%d) ", charmap[i] - 400);
|
||||
} else {
|
||||
concat(binary_string, hexbit[charmap[i]]);
|
||||
strcat(binary_string, hexbit[charmap[i]]);
|
||||
if (!((chartype == PUNC) && (charmap[i] == 0)))
|
||||
if (debug) printf("%d ", charmap[i]);
|
||||
}
|
||||
break;
|
||||
case DIGIT:
|
||||
concat(binary_string, pentbit[charmap[i]]);
|
||||
strcat(binary_string, pentbit[charmap[i]]);
|
||||
if (debug) printf("%d ", charmap[i]);
|
||||
break;
|
||||
case BINARY:
|
||||
for (p = 0; p < 8; p++) {
|
||||
if (charmap[i] & (0x80 >> p)) {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
} else {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
}
|
||||
}
|
||||
if (debug) printf("%d ", charmap[i]);
|
||||
@ -1065,7 +1065,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
for (i = 0; i < padbits; i++) {
|
||||
concat(adjusted_string, "1");
|
||||
strcat(adjusted_string, "1");
|
||||
}
|
||||
adjusted_length = strlen(adjusted_string);
|
||||
|
||||
@ -1171,7 +1171,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
for (i = 0; i < padbits; i++) {
|
||||
concat(adjusted_string, "1");
|
||||
strcat(adjusted_string, "1");
|
||||
}
|
||||
adjusted_length = strlen(adjusted_string);
|
||||
|
||||
@ -1266,9 +1266,9 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
||||
for (p = 0; p < 6; p++) {
|
||||
if (ecc_part[i] & (0x20 >> p)) {
|
||||
concat(adjusted_string, "1");
|
||||
strcat(adjusted_string, "1");
|
||||
} else {
|
||||
concat(adjusted_string, "0");
|
||||
strcat(adjusted_string, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1288,9 +1288,9 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
||||
for (p = 0; p < 8; p++) {
|
||||
if (ecc_part[i] & (0x80 >> p)) {
|
||||
concat(adjusted_string, "1");
|
||||
strcat(adjusted_string, "1");
|
||||
} else {
|
||||
concat(adjusted_string, "0");
|
||||
strcat(adjusted_string, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1310,9 +1310,9 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
||||
for (p = 0; p < 10; p++) {
|
||||
if (ecc_part[i] & (0x200 >> p)) {
|
||||
concat(adjusted_string, "1");
|
||||
strcat(adjusted_string, "1");
|
||||
} else {
|
||||
concat(adjusted_string, "0");
|
||||
strcat(adjusted_string, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1332,9 +1332,9 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
||||
for (p = 0; p < 12; p++) {
|
||||
if (ecc_part[i] & (0x800 >> p)) {
|
||||
concat(adjusted_string, "1");
|
||||
strcat(adjusted_string, "1");
|
||||
} else {
|
||||
concat(adjusted_string, "0");
|
||||
strcat(adjusted_string, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1654,9 +1654,9 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
strcpy(binary_string, "");
|
||||
for (p = 0; p < 8; p++) {
|
||||
if (input_value & (0x80 >> p)) {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
} else {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,12 +177,12 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /*
|
||||
lookup(SODIUM, C11Table, checkstr[1], dest);
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "11221");
|
||||
strcat(dest, "11221");
|
||||
|
||||
expand(symbol, dest);
|
||||
|
||||
ustrcpy(symbol->text, source);
|
||||
uconcat(symbol->text, (unsigned char*) checkstr);
|
||||
strcat((char*) symbol->text, checkstr);
|
||||
return error_number;
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ int c39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "121121211");
|
||||
strcat(dest, "121121211");
|
||||
|
||||
if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->symbology == BARCODE_HIBC_39)) {
|
||||
/* LOGMARS uses wider 'wide' bars than normal Code 39 */
|
||||
@ -280,13 +280,13 @@ int c39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
expand(symbol, dest);
|
||||
|
||||
if (symbol->symbology == BARCODE_CODE39) {
|
||||
ustrcpy(symbol->text, (unsigned char*) "*");
|
||||
uconcat(symbol->text, source);
|
||||
uconcat(symbol->text, (unsigned char*) localstr);
|
||||
uconcat(symbol->text, (unsigned char*) "*");
|
||||
strcpy((char*) symbol->text, "*");
|
||||
strcat((char*) symbol->text, (char*) source);
|
||||
strcat((char*) symbol->text, localstr);
|
||||
strcat((char*) symbol->text, "*");
|
||||
} else {
|
||||
ustrcpy(symbol->text, source);
|
||||
uconcat(symbol->text, (unsigned char*) localstr);
|
||||
strcpy((char*) symbol->text, (char*) source);
|
||||
strcat((char*) symbol->text, localstr);
|
||||
}
|
||||
return error_number;
|
||||
}
|
||||
@ -333,7 +333,7 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
|
||||
}
|
||||
error_number = c39(symbol, (unsigned char *) localstr, strlen(localstr));
|
||||
ustrcpy(symbol->text, (unsigned char *) "PZN");
|
||||
uconcat(symbol->text, (unsigned char *) localstr);
|
||||
strcat((char*) symbol->text, localstr);
|
||||
return error_number;
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
concat((char*) buffer, EC39Ctrl[source[i]]);
|
||||
strcat((char*) buffer, EC39Ctrl[source[i]]);
|
||||
}
|
||||
|
||||
/* Then sends the buffer to the C39 function */
|
||||
@ -399,7 +399,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
concat(buffer, C93Ctrl[source[i]]);
|
||||
strcat(buffer, C93Ctrl[source[i]]);
|
||||
symbol->text[i] = source[i] ? source[i] : ' ';
|
||||
}
|
||||
|
||||
@ -450,7 +450,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "1111411");
|
||||
strcat(dest, "1111411");
|
||||
expand(symbol, dest);
|
||||
|
||||
symbol->text[length] = set_copy[c];
|
||||
@ -482,7 +482,7 @@ void CheckCharacter() {
|
||||
part[0] = itoc(S[i]);
|
||||
part[1] = itoc(B[i]);
|
||||
part[2] = '\0';
|
||||
concat(pattern, part);
|
||||
strcat(pattern, part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "large.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#ifdef __APPLE__
|
||||
#include <sys/malloc.h>
|
||||
#else
|
||||
@ -187,7 +188,7 @@ int c1_look_ahead_test(unsigned char source[], int sourcelen, int position, int
|
||||
if ((source[sp] >= '0') && (source[sp] <= '9')) {
|
||||
ascii_count += 0.5;
|
||||
} else {
|
||||
ascii_count = froundup(ascii_count);
|
||||
ascii_count = ceil(ascii_count);
|
||||
if (source[sp] > 127) {
|
||||
ascii_count += 2.0;
|
||||
} else {
|
||||
@ -280,11 +281,11 @@ int c1_look_ahead_test(unsigned char source[], int sourcelen, int position, int
|
||||
|
||||
}
|
||||
|
||||
ascii_count = froundup(ascii_count);
|
||||
c40_count = froundup(c40_count);
|
||||
text_count = froundup(text_count);
|
||||
edi_count = froundup(edi_count);
|
||||
byte_count = froundup(byte_count);
|
||||
ascii_count = ceil(ascii_count);
|
||||
c40_count = ceil(c40_count);
|
||||
text_count = ceil(text_count);
|
||||
edi_count = ceil(edi_count);
|
||||
byte_count = ceil(byte_count);
|
||||
best_scheme = C1_ASCII;
|
||||
|
||||
if (sp == sourcelen) {
|
||||
@ -869,7 +870,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
int sub_target;
|
||||
/* Finish Decimal mode and go back to ASCII */
|
||||
|
||||
concat(decimal_binary, "111111"); /* Unlatch */
|
||||
strcat(decimal_binary, "111111"); /* Unlatch */
|
||||
|
||||
target_count = 3;
|
||||
if (strlen(decimal_binary) <= 16) {
|
||||
@ -884,7 +885,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
}
|
||||
|
||||
if (bits_left_in_byte == 2) {
|
||||
concat(decimal_binary, "01");
|
||||
strcat(decimal_binary, "01");
|
||||
}
|
||||
|
||||
if ((bits_left_in_byte == 4) || (bits_left_in_byte == 6)) {
|
||||
@ -892,33 +893,33 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
int sub_value = ctoi(source[sp]) + 1;
|
||||
|
||||
if (sub_value & 0x08) {
|
||||
concat(decimal_binary, "1");
|
||||
strcat(decimal_binary, "1");
|
||||
} else {
|
||||
concat(decimal_binary, "0");
|
||||
strcat(decimal_binary, "0");
|
||||
}
|
||||
if (sub_value & 0x04) {
|
||||
concat(decimal_binary, "1");
|
||||
strcat(decimal_binary, "1");
|
||||
} else {
|
||||
concat(decimal_binary, "0");
|
||||
strcat(decimal_binary, "0");
|
||||
}
|
||||
if (sub_value & 0x02) {
|
||||
concat(decimal_binary, "1");
|
||||
strcat(decimal_binary, "1");
|
||||
} else {
|
||||
concat(decimal_binary, "0");
|
||||
strcat(decimal_binary, "0");
|
||||
}
|
||||
if (sub_value & 0x01) {
|
||||
concat(decimal_binary, "1");
|
||||
strcat(decimal_binary, "1");
|
||||
} else {
|
||||
concat(decimal_binary, "0");
|
||||
strcat(decimal_binary, "0");
|
||||
}
|
||||
sp++;
|
||||
} else {
|
||||
concat(decimal_binary, "1111");
|
||||
strcat(decimal_binary, "1111");
|
||||
}
|
||||
}
|
||||
|
||||
if (bits_left_in_byte == 6) {
|
||||
concat(decimal_binary, "01");
|
||||
strcat(decimal_binary, "01");
|
||||
}
|
||||
|
||||
/* Binary buffer is full - transfer to target */
|
||||
@ -1017,9 +1018,9 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
|
||||
for (p = 0; p < 10; p++) {
|
||||
if (value & (0x200 >> p)) {
|
||||
concat(decimal_binary, "1");
|
||||
strcat(decimal_binary, "1");
|
||||
} else {
|
||||
concat(decimal_binary, "0");
|
||||
strcat(decimal_binary, "0");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1158,7 +1159,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
int sub_target;
|
||||
/* Finish Decimal mode and go back to ASCII */
|
||||
|
||||
concat(decimal_binary, "111111"); /* Unlatch */
|
||||
strcat(decimal_binary, "111111"); /* Unlatch */
|
||||
|
||||
target_count = 3;
|
||||
if (strlen(decimal_binary) <= 16) {
|
||||
@ -1173,15 +1174,15 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
}
|
||||
|
||||
if (bits_left_in_byte == 2) {
|
||||
concat(decimal_binary, "01");
|
||||
strcat(decimal_binary, "01");
|
||||
}
|
||||
|
||||
if ((bits_left_in_byte == 4) || (bits_left_in_byte == 6)) {
|
||||
concat(decimal_binary, "1111");
|
||||
strcat(decimal_binary, "1111");
|
||||
}
|
||||
|
||||
if (bits_left_in_byte == 6) {
|
||||
concat(decimal_binary, "01");
|
||||
strcat(decimal_binary, "01");
|
||||
}
|
||||
|
||||
/* Binary buffer is full - transfer to target */
|
||||
|
@ -244,18 +244,18 @@ void c128_set_a(unsigned char source, char dest[], int values[], int *bar_chars)
|
||||
|
||||
if (source > 127) {
|
||||
if (source < 160) {
|
||||
concat(dest, C128Table[(source - 128) + 64]);
|
||||
strcat(dest, C128Table[(source - 128) + 64]);
|
||||
values[(*bar_chars)] = (source - 128) + 64;
|
||||
} else {
|
||||
concat(dest, C128Table[(source - 128) - 32]);
|
||||
strcat(dest, C128Table[(source - 128) - 32]);
|
||||
values[(*bar_chars)] = (source - 128) - 32;
|
||||
}
|
||||
} else {
|
||||
if (source < 32) {
|
||||
concat(dest, C128Table[source + 64]);
|
||||
strcat(dest, C128Table[source + 64]);
|
||||
values[(*bar_chars)] = source + 64;
|
||||
} else {
|
||||
concat(dest, C128Table[source - 32]);
|
||||
strcat(dest, C128Table[source - 32]);
|
||||
values[(*bar_chars)] = source - 32;
|
||||
}
|
||||
}
|
||||
@ -269,10 +269,10 @@ void c128_set_a(unsigned char source, char dest[], int values[], int *bar_chars)
|
||||
*/
|
||||
void c128_set_b(unsigned char source, char dest[], int values[], int *bar_chars) {
|
||||
if (source > 127) {
|
||||
concat(dest, C128Table[source - 32 - 128]);
|
||||
strcat(dest, C128Table[source - 32 - 128]);
|
||||
values[(*bar_chars)] = source - 32 - 128;
|
||||
} else {
|
||||
concat(dest, C128Table[source - 32]);
|
||||
strcat(dest, C128Table[source - 32]);
|
||||
values[(*bar_chars)] = source - 32;
|
||||
}
|
||||
(*bar_chars)++;
|
||||
@ -285,7 +285,7 @@ void c128_set_c(unsigned char source_a, unsigned char source_b, char dest[], int
|
||||
int weight;
|
||||
|
||||
weight = (10 * ctoi(source_a)) + ctoi(source_b);
|
||||
concat(dest, C128Table[weight]);
|
||||
strcat(dest, C128Table[weight]);
|
||||
values[(*bar_chars)] = weight;
|
||||
(*bar_chars)++;
|
||||
}
|
||||
@ -491,27 +491,27 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Reader Initialisation mode */
|
||||
switch (set[0]) {
|
||||
case 'A': /* Start A */
|
||||
concat(dest, C128Table[103]);
|
||||
strcat(dest, C128Table[103]);
|
||||
values[0] = 103;
|
||||
current_set = 'A';
|
||||
concat(dest, C128Table[96]); /* FNC3 */
|
||||
strcat(dest, C128Table[96]); /* FNC3 */
|
||||
values[1] = 96;
|
||||
bar_characters++;
|
||||
break;
|
||||
case 'B': /* Start B */
|
||||
concat(dest, C128Table[104]);
|
||||
strcat(dest, C128Table[104]);
|
||||
values[0] = 104;
|
||||
current_set = 'B';
|
||||
concat(dest, C128Table[96]); /* FNC3 */
|
||||
strcat(dest, C128Table[96]); /* FNC3 */
|
||||
values[1] = 96;
|
||||
bar_characters++;
|
||||
break;
|
||||
case 'C': /* Start C */
|
||||
concat(dest, C128Table[104]); /* Start B */
|
||||
strcat(dest, C128Table[104]); /* Start B */
|
||||
values[0] = 105;
|
||||
concat(dest, C128Table[96]); /* FNC3 */
|
||||
strcat(dest, C128Table[96]); /* FNC3 */
|
||||
values[1] = 96;
|
||||
concat(dest, C128Table[99]); /* Code C */
|
||||
strcat(dest, C128Table[99]); /* Code C */
|
||||
values[2] = 99;
|
||||
bar_characters += 2;
|
||||
current_set = 'C';
|
||||
@ -521,17 +521,17 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Normal mode */
|
||||
switch (set[0]) {
|
||||
case 'A': /* Start A */
|
||||
concat(dest, C128Table[103]);
|
||||
strcat(dest, C128Table[103]);
|
||||
values[0] = 103;
|
||||
current_set = 'A';
|
||||
break;
|
||||
case 'B': /* Start B */
|
||||
concat(dest, C128Table[104]);
|
||||
strcat(dest, C128Table[104]);
|
||||
values[0] = 104;
|
||||
current_set = 'B';
|
||||
break;
|
||||
case 'C': /* Start C */
|
||||
concat(dest, C128Table[105]);
|
||||
strcat(dest, C128Table[105]);
|
||||
values[0] = 105;
|
||||
current_set = 'C';
|
||||
break;
|
||||
@ -543,14 +543,14 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
if (fset[0] == 'F') {
|
||||
switch (current_set) {
|
||||
case 'A':
|
||||
concat(dest, C128Table[101]);
|
||||
concat(dest, C128Table[101]);
|
||||
strcat(dest, C128Table[101]);
|
||||
strcat(dest, C128Table[101]);
|
||||
values[bar_characters] = 101;
|
||||
values[bar_characters + 1] = 101;
|
||||
break;
|
||||
case 'B':
|
||||
concat(dest, C128Table[100]);
|
||||
concat(dest, C128Table[100]);
|
||||
strcat(dest, C128Table[100]);
|
||||
strcat(dest, C128Table[100]);
|
||||
values[bar_characters] = 100;
|
||||
values[bar_characters + 1] = 100;
|
||||
break;
|
||||
@ -566,17 +566,17 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
if ((read != 0) && (set[read] != current_set)) {
|
||||
/* Latch different code set */
|
||||
switch (set[read]) {
|
||||
case 'A': concat(dest, C128Table[101]);
|
||||
case 'A': strcat(dest, C128Table[101]);
|
||||
values[bar_characters] = 101;
|
||||
bar_characters++;
|
||||
current_set = 'A';
|
||||
break;
|
||||
case 'B': concat(dest, C128Table[100]);
|
||||
case 'B': strcat(dest, C128Table[100]);
|
||||
values[bar_characters] = 100;
|
||||
bar_characters++;
|
||||
current_set = 'B';
|
||||
break;
|
||||
case 'C': concat(dest, C128Table[99]);
|
||||
case 'C': strcat(dest, C128Table[99]);
|
||||
values[bar_characters] = 99;
|
||||
bar_characters++;
|
||||
current_set = 'C';
|
||||
@ -589,14 +589,14 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Latch beginning of extended mode */
|
||||
switch (current_set) {
|
||||
case 'A':
|
||||
concat(dest, C128Table[101]);
|
||||
concat(dest, C128Table[101]);
|
||||
strcat(dest, C128Table[101]);
|
||||
strcat(dest, C128Table[101]);
|
||||
values[bar_characters] = 101;
|
||||
values[bar_characters + 1] = 101;
|
||||
break;
|
||||
case 'B':
|
||||
concat(dest, C128Table[100]);
|
||||
concat(dest, C128Table[100]);
|
||||
strcat(dest, C128Table[100]);
|
||||
strcat(dest, C128Table[100]);
|
||||
values[bar_characters] = 100;
|
||||
values[bar_characters + 1] = 100;
|
||||
break;
|
||||
@ -608,14 +608,14 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Latch end of extended mode */
|
||||
switch (current_set) {
|
||||
case 'A':
|
||||
concat(dest, C128Table[101]);
|
||||
concat(dest, C128Table[101]);
|
||||
strcat(dest, C128Table[101]);
|
||||
strcat(dest, C128Table[101]);
|
||||
values[bar_characters] = 101;
|
||||
values[bar_characters + 1] = 101;
|
||||
break;
|
||||
case 'B':
|
||||
concat(dest, C128Table[100]);
|
||||
concat(dest, C128Table[100]);
|
||||
strcat(dest, C128Table[100]);
|
||||
strcat(dest, C128Table[100]);
|
||||
values[bar_characters] = 100;
|
||||
values[bar_characters + 1] = 100;
|
||||
break;
|
||||
@ -629,11 +629,11 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Shift to or from extended mode */
|
||||
switch (current_set) {
|
||||
case 'A':
|
||||
concat(dest, C128Table[101]); /* FNC 4 */
|
||||
strcat(dest, C128Table[101]); /* FNC 4 */
|
||||
values[bar_characters] = 101;
|
||||
break;
|
||||
case 'B':
|
||||
concat(dest, C128Table[100]); /* FNC 4 */
|
||||
strcat(dest, C128Table[100]); /* FNC 4 */
|
||||
values[bar_characters] = 100;
|
||||
break;
|
||||
}
|
||||
@ -642,7 +642,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
if ((set[read] == 'a') || (set[read] == 'b')) {
|
||||
/* Insert shift character */
|
||||
concat(dest, C128Table[98]);
|
||||
strcat(dest, C128Table[98]);
|
||||
values[bar_characters] = 98;
|
||||
bar_characters++;
|
||||
}
|
||||
@ -672,10 +672,10 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
total_sum += values[i];
|
||||
}
|
||||
concat(dest, C128Table[total_sum % 103]);
|
||||
strcat(dest, C128Table[total_sum % 103]);
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, C128Table[106]);
|
||||
strcat(dest, C128Table[106]);
|
||||
expand(symbol, dest);
|
||||
return error_number;
|
||||
}
|
||||
@ -850,21 +850,21 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* So now we know what start character to use - we can get on with it! */
|
||||
switch (set[0]) {
|
||||
case 'A': /* Start A */
|
||||
concat(dest, C128Table[103]);
|
||||
strcat(dest, C128Table[103]);
|
||||
values[0] = 103;
|
||||
break;
|
||||
case 'B': /* Start B */
|
||||
concat(dest, C128Table[104]);
|
||||
strcat(dest, C128Table[104]);
|
||||
values[0] = 104;
|
||||
break;
|
||||
case 'C': /* Start C */
|
||||
concat(dest, C128Table[105]);
|
||||
strcat(dest, C128Table[105]);
|
||||
values[0] = 105;
|
||||
break;
|
||||
}
|
||||
bar_characters++;
|
||||
|
||||
concat(dest, C128Table[102]);
|
||||
strcat(dest, C128Table[102]);
|
||||
values[1] = 102;
|
||||
bar_characters++;
|
||||
|
||||
@ -874,15 +874,15 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
if ((read != 0) && (set[read] != set[read - 1])) { /* Latch different code set */
|
||||
switch (set[read]) {
|
||||
case 'A': concat(dest, C128Table[101]);
|
||||
case 'A': strcat(dest, C128Table[101]);
|
||||
values[bar_characters] = 101;
|
||||
bar_characters++;
|
||||
break;
|
||||
case 'B': concat(dest, C128Table[100]);
|
||||
case 'B': strcat(dest, C128Table[100]);
|
||||
values[bar_characters] = 100;
|
||||
bar_characters++;
|
||||
break;
|
||||
case 'C': concat(dest, C128Table[99]);
|
||||
case 'C': strcat(dest, C128Table[99]);
|
||||
values[bar_characters] = 99;
|
||||
bar_characters++;
|
||||
break;
|
||||
@ -891,7 +891,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
if ((set[read] == 'a') || (set[read] == 'b')) {
|
||||
/* Insert shift character */
|
||||
concat(dest, C128Table[98]);
|
||||
strcat(dest, C128Table[98]);
|
||||
values[bar_characters] = 98;
|
||||
bar_characters++;
|
||||
}
|
||||
@ -914,7 +914,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
concat(dest, C128Table[102]);
|
||||
strcat(dest, C128Table[102]);
|
||||
values[bar_characters] = 102;
|
||||
bar_characters++;
|
||||
read++;
|
||||
@ -953,7 +953,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
if (linkage_flag != 0) {
|
||||
concat(dest, C128Table[linkage_flag]);
|
||||
strcat(dest, C128Table[linkage_flag]);
|
||||
values[bar_characters] = linkage_flag;
|
||||
bar_characters++;
|
||||
}
|
||||
@ -967,12 +967,12 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
total_sum += values[i];
|
||||
}
|
||||
concat(dest, C128Table[total_sum % 103]);
|
||||
strcat(dest, C128Table[total_sum % 103]);
|
||||
values[bar_characters] = total_sum % 103;
|
||||
bar_characters++;
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, C128Table[106]);
|
||||
strcat(dest, C128Table[106]);
|
||||
values[bar_characters] = 106;
|
||||
bar_characters++;
|
||||
expand(symbol, dest);
|
||||
|
@ -695,12 +695,12 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
for (current_row = 0; current_row < rows_needed; current_row++) {
|
||||
|
||||
strcpy(width_pattern, "");
|
||||
concat(width_pattern, C16KStartStop[C16KStartValues[current_row]]);
|
||||
concat(width_pattern, "1");
|
||||
strcat(width_pattern, C16KStartStop[C16KStartValues[current_row]]);
|
||||
strcat(width_pattern, "1");
|
||||
for (i = 0; i < 5; i++) {
|
||||
concat(width_pattern, C16KTable[values[(current_row * 5) + i]]);
|
||||
strcat(width_pattern, C16KTable[values[(current_row * 5) + i]]);
|
||||
}
|
||||
concat(width_pattern, C16KStartStop[C16KStopValues[current_row]]);
|
||||
strcat(width_pattern, C16KStartStop[C16KStopValues[current_row]]);
|
||||
|
||||
/* Write the information into the symbol */
|
||||
writer = 0;
|
||||
|
@ -40,8 +40,8 @@
|
||||
|
||||
/* "!" represents Shift 1 and "&" represents Shift 2, "*" represents FNC1 */
|
||||
|
||||
int code_49(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int i, j, rows, M, x_count, y_count, z_count, posn_val, local_value, h;
|
||||
int code_49(struct zint_symbol *symbol, unsigned char source[], const int length) {
|
||||
int i, j, rows, M, x_count, y_count, z_count, posn_val, local_value;
|
||||
char intermediate[170] = "";
|
||||
int codewords[170], codeword_count;
|
||||
int c_grid[8][8]; /* Refers to table 3 */
|
||||
@ -49,6 +49,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int pad_count = 0;
|
||||
char pattern[40];
|
||||
int gs1;
|
||||
size_t h;
|
||||
|
||||
if (length > 81) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
@ -67,9 +68,9 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
if (gs1 && (source[i] == '['))
|
||||
concat(intermediate, "*"); /* FNC1 */
|
||||
strcat(intermediate, "*"); /* FNC1 */
|
||||
else
|
||||
concat(intermediate, c49_table7[source[i]]);
|
||||
strcat(intermediate, c49_table7[source[i]]);
|
||||
}
|
||||
|
||||
codeword_count = 0;
|
||||
@ -310,17 +311,17 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
if (i != (rows - 1)) {
|
||||
if (c49_table4[i][j] == 'E') {
|
||||
/* Even Parity */
|
||||
concat(pattern, c49_appxe_even[w_grid[i][j]]);
|
||||
strcat(pattern, c49_appxe_even[w_grid[i][j]]);
|
||||
} else {
|
||||
/* Odd Parity */
|
||||
concat(pattern, c49_appxe_odd[w_grid[i][j]]);
|
||||
strcat(pattern, c49_appxe_odd[w_grid[i][j]]);
|
||||
}
|
||||
} else {
|
||||
/* Last row uses all even parity */
|
||||
concat(pattern, c49_appxe_even[w_grid[i][j]]);
|
||||
strcat(pattern, c49_appxe_even[w_grid[i][j]]);
|
||||
}
|
||||
}
|
||||
concat(pattern, "4"); /* Stop character */
|
||||
strcat(pattern, "4"); /* Stop character */
|
||||
|
||||
/* Expand into symbol */
|
||||
symbol->row_height[i] = 10;
|
||||
|
@ -36,42 +36,13 @@
|
||||
|
||||
/* Local replacement for strlen() with unsigned char strings */
|
||||
int ustrlen(const unsigned char data[]) {
|
||||
int i;
|
||||
for (i = 0; data[i]; i++);
|
||||
|
||||
return i;
|
||||
return strlen((const char*) data);
|
||||
}
|
||||
|
||||
/* Local replacement for strcpy() with unsigned char strings */
|
||||
|
||||
void ustrcpy(unsigned char target[], const unsigned char source[]) {
|
||||
int i, len;
|
||||
|
||||
len = ustrlen(source);
|
||||
for (i = 0; i < len; i++) {
|
||||
target[i] = source[i];
|
||||
}
|
||||
target[i] = '\0';
|
||||
}
|
||||
|
||||
/* Concatinates dest[] with the contents of source[], copying /0 as well */
|
||||
void concat(char dest[], const char source[]) {
|
||||
size_t i, j, n;
|
||||
|
||||
j = strlen(dest);
|
||||
n = strlen(source);
|
||||
for (i = 0; i <= n; i++) {
|
||||
dest[i + j] = source[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Concatinates dest[] with the contents of source[], copying /0 as well */
|
||||
void uconcat(unsigned char dest[], const unsigned char source[]) {
|
||||
unsigned int i, j;
|
||||
|
||||
j = ustrlen(dest);
|
||||
for (i = 0; i <= ustrlen(source); i++) {
|
||||
dest[i + j] = source[i];
|
||||
}
|
||||
strcpy((char *) target, (const char*) source);
|
||||
}
|
||||
|
||||
/* Converts a character 0-9 to its equivalent integer value */
|
||||
@ -140,7 +111,7 @@ void lookup(char set_string[], const char *table[], const char data, char dest[]
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if (data == set_string[i]) {
|
||||
concat(dest, table[i]);
|
||||
strcat(dest, table[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,7 +166,7 @@ void expand(struct zint_symbol *symbol, char data[]) {
|
||||
}
|
||||
|
||||
/* Indicates which symbologies can have row binding */
|
||||
int is_stackable(int symbology) {
|
||||
int is_stackable(const int symbology) {
|
||||
if (symbology < BARCODE_PDF417) {
|
||||
return 1;
|
||||
}
|
||||
@ -257,20 +228,6 @@ int is_extendable(const int symbology) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int roundup(const float input) {
|
||||
float remainder;
|
||||
int integer_part;
|
||||
|
||||
integer_part = (int) input;
|
||||
remainder = input - integer_part;
|
||||
|
||||
if (remainder > 0.1F) {
|
||||
integer_part++;
|
||||
}
|
||||
|
||||
return integer_part;
|
||||
}
|
||||
|
||||
int istwodigits(const unsigned char source[], const int position) {
|
||||
if ((source[position] >= '0') && (source[position] <= '9')) {
|
||||
if ((source[position + 1] >= '0') && (source[position + 1] <= '9')) {
|
||||
@ -281,19 +238,6 @@ int istwodigits(const unsigned char source[], const int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
double froundup(const double input) {
|
||||
double fraction, output = 0.0;
|
||||
|
||||
fraction = input - (int) input;
|
||||
if (fraction > 0.01) {
|
||||
output = (input - fraction) + 1.0;
|
||||
} else {
|
||||
output = input;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/* Convert Unicode to Latin-1 for those symbologies which only support Latin-1 */
|
||||
int latin1_process(struct zint_symbol *symbol, const unsigned char source[], unsigned char preprocessed[], int *length) {
|
||||
int j, i, next;
|
||||
|
@ -53,8 +53,6 @@ extern "C" {
|
||||
|
||||
extern int ustrlen(const unsigned char source[]);
|
||||
extern void ustrcpy(unsigned char target[], const unsigned char source[]);
|
||||
extern void concat(char dest[], const char source[]);
|
||||
extern void uconcat(unsigned char dest[], const unsigned char source[]);
|
||||
extern int ctoi(const char source);
|
||||
extern char itoc(const int source);
|
||||
extern void to_upper(unsigned char source[]);
|
||||
|
@ -274,33 +274,33 @@ int cc_a(struct zint_symbol *symbol, char source[], int cc_width) {
|
||||
dummy[j + 1] = codeWords[i * cc_width + j];
|
||||
}
|
||||
/* Copy the data into codebarre */
|
||||
concat(codebarre, RAPLR[LeftRAP]);
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[1]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, RAPLR[LeftRAP]);
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[1]]);
|
||||
strcat(codebarre, "1");
|
||||
if (cc_width == 3) {
|
||||
concat(codebarre, RAPC[CentreRAP]);
|
||||
strcat(codebarre, RAPC[CentreRAP]);
|
||||
}
|
||||
if (cc_width >= 2) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[2]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[2]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
if (cc_width == 4) {
|
||||
concat(codebarre, RAPC[CentreRAP]);
|
||||
strcat(codebarre, RAPC[CentreRAP]);
|
||||
}
|
||||
if (cc_width >= 3) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[3]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[3]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
if (cc_width == 4) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[4]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[4]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
concat(codebarre, RAPLR[RightRAP]);
|
||||
concat(codebarre, "1"); /* stop */
|
||||
strcat(codebarre, RAPLR[RightRAP]);
|
||||
strcat(codebarre, "1"); /* stop */
|
||||
|
||||
/* Now codebarre is a mixture of letters and numbers */
|
||||
|
||||
@ -558,33 +558,33 @@ int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
|
||||
dummy[j + 1] = chainemc[i * symbol->option_2 + j];
|
||||
}
|
||||
/* Copy the data into codebarre */
|
||||
concat(codebarre, RAPLR[LeftRAP]);
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[1]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, RAPLR[LeftRAP]);
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[1]]);
|
||||
strcat(codebarre, "1");
|
||||
if (cc_width == 3) {
|
||||
concat(codebarre, RAPC[CentreRAP]);
|
||||
strcat(codebarre, RAPC[CentreRAP]);
|
||||
}
|
||||
if (cc_width >= 2) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[2]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[2]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
if (cc_width == 4) {
|
||||
concat(codebarre, RAPC[CentreRAP]);
|
||||
strcat(codebarre, RAPC[CentreRAP]);
|
||||
}
|
||||
if (cc_width >= 3) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[3]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[3]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
if (cc_width == 4) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[4]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[4]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
concat(codebarre, RAPLR[RightRAP]);
|
||||
concat(codebarre, "1"); /* stop */
|
||||
strcat(codebarre, RAPLR[RightRAP]);
|
||||
strcat(codebarre, "1"); /* stop */
|
||||
|
||||
/* Now codebarre is a mixture of letters and numbers */
|
||||
|
||||
@ -772,10 +772,10 @@ int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level)
|
||||
default: offset = 0; /* cluster(0) */
|
||||
break;
|
||||
}
|
||||
concat(codebarre, codagemc[offset + dummy[j]]);
|
||||
concat(codebarre, "*");
|
||||
strcat(codebarre, codagemc[offset + dummy[j]]);
|
||||
strcat(codebarre, "*");
|
||||
}
|
||||
concat(codebarre, "-");
|
||||
strcat(codebarre, "-");
|
||||
|
||||
strcpy(pattern, "");
|
||||
for (loop = 0; loop < (int) strlen(codebarre); loop++) {
|
||||
@ -829,17 +829,17 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
}
|
||||
|
||||
if (encoding_method == 1) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
}
|
||||
|
||||
if (encoding_method == 2) {
|
||||
/* Encoding Method field "10" - date and lot number */
|
||||
|
||||
concat(binary_string, "10");
|
||||
strcat(binary_string, "10");
|
||||
|
||||
if (source[1] == '0') {
|
||||
/* No date data */
|
||||
concat(binary_string, "11");
|
||||
strcat(binary_string, "11");
|
||||
read_posn = 2;
|
||||
} else {
|
||||
/* Production Date (11) or Expiration Date (17) */
|
||||
@ -859,19 +859,19 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x8000;
|
||||
for (j = 0; j < 16; j++) {
|
||||
if ((group_val & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
|
||||
if (source[1] == '1') {
|
||||
/* Production Date AI 11 */
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
/* Expiration Date AI 17 */
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
read_posn = 8;
|
||||
}
|
||||
@ -967,7 +967,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
|
||||
if ((test1 != -1) && (test2 != 1) && (test3 == 0)) {
|
||||
/* Encodation method "11" can be used */
|
||||
concat(binary_string, "11");
|
||||
strcat(binary_string, "11");
|
||||
|
||||
numeric -= test1;
|
||||
alpha--;
|
||||
@ -977,16 +977,16 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
|
||||
if (alphanum > 0) {
|
||||
/* Alphanumeric mode */
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
ai90_mode = 1;
|
||||
} else {
|
||||
if (alpha > numeric) {
|
||||
/* Alphabetic mode */
|
||||
concat(binary_string, "11");
|
||||
strcat(binary_string, "11");
|
||||
ai90_mode = 2;
|
||||
} else {
|
||||
/* Numeric mode */
|
||||
concat(binary_string, "10");
|
||||
strcat(binary_string, "10");
|
||||
ai90_mode = 3;
|
||||
}
|
||||
}
|
||||
@ -1007,11 +1007,11 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
}
|
||||
|
||||
switch (ai_crop) {
|
||||
case 0: concat(binary_string, "0");
|
||||
case 0: strcat(binary_string, "0");
|
||||
break;
|
||||
case 1: concat(binary_string, "10");
|
||||
case 1: strcat(binary_string, "10");
|
||||
break;
|
||||
case 2: concat(binary_string, "11");
|
||||
case 2: strcat(binary_string, "11");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1070,9 +1070,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
if ((numeric_value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1081,22 +1081,22 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x08;
|
||||
for (j = 0; j < 4; j++) {
|
||||
if ((table3_letter & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
} else {
|
||||
/* Encoding is done according to 5.2.2 c) 3) */
|
||||
concat(binary_string, "11111");
|
||||
strcat(binary_string, "11111");
|
||||
/* ten bit representation of number */
|
||||
mask = 0x200;
|
||||
for (j = 0; j < 10; j++) {
|
||||
if ((numeric_value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1105,9 +1105,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
if (((ninety[test1] - 65) & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1116,7 +1116,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
read_posn = test1 + 3;
|
||||
} else {
|
||||
/* Use general field encodation instead */
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
read_posn = 0;
|
||||
}
|
||||
}
|
||||
@ -1129,9 +1129,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
if (((source[read_posn] + 4) & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1141,16 +1141,16 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x20;
|
||||
for (j = 0; j < 6; j++) {
|
||||
if (((source[read_posn] - 65) & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (source[read_posn] == '[') {
|
||||
concat(binary_string, "11111");
|
||||
strcat(binary_string, "11111");
|
||||
}
|
||||
|
||||
read_posn++;
|
||||
@ -1165,9 +1165,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
if (((source[read_posn] - 43) & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1177,26 +1177,26 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x20;
|
||||
for (j = 0; j < 6; j++) {
|
||||
if (((source[read_posn] - 33) & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (source[read_posn]) {
|
||||
case '[': concat(binary_string, "01111");
|
||||
case '[': strcat(binary_string, "01111");
|
||||
break;
|
||||
case '*': concat(binary_string, "111010");
|
||||
case '*': strcat(binary_string, "111010");
|
||||
break;
|
||||
case ',': concat(binary_string, "111011");
|
||||
case ',': strcat(binary_string, "111011");
|
||||
break;
|
||||
case '-': concat(binary_string, "111100");
|
||||
case '-': strcat(binary_string, "111100");
|
||||
break;
|
||||
case '.': concat(binary_string, "111101");
|
||||
case '.': strcat(binary_string, "111101");
|
||||
break;
|
||||
case '/': concat(binary_string, "111110");
|
||||
case '/': strcat(binary_string, "111110");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1322,7 +1322,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
|
||||
if (i != 0) {
|
||||
if ((general_field_type[i - 1] != NUMERIC) && (general_field[i - 1] != '[')) {
|
||||
concat(binary_string, "000"); /* Numeric latch */
|
||||
strcat(binary_string, "000"); /* Numeric latch */
|
||||
}
|
||||
}
|
||||
|
||||
@ -1343,9 +1343,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x40;
|
||||
for (j = 0; j < 7; j++) {
|
||||
if ((value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1357,10 +1357,10 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
|
||||
if (i != 0) {
|
||||
if ((general_field_type[i - 1] == NUMERIC) || (general_field[i - 1] == '[')) {
|
||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
}
|
||||
if (general_field_type[i - 1] == ISOIEC) {
|
||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
}
|
||||
}
|
||||
|
||||
@ -1371,9 +1371,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
if ((value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1386,20 +1386,20 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x20;
|
||||
for (j = 0; j < 6; j++) {
|
||||
if ((value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (general_field[i] == '[') concat(binary_string, "01111"); /* FNC1/Numeric latch */
|
||||
if (general_field[i] == '*') concat(binary_string, "111010"); /* asterisk */
|
||||
if (general_field[i] == ',') concat(binary_string, "111011"); /* comma */
|
||||
if (general_field[i] == '-') concat(binary_string, "111100"); /* minus or hyphen */
|
||||
if (general_field[i] == '.') concat(binary_string, "111101"); /* period or full stop */
|
||||
if (general_field[i] == '/') concat(binary_string, "111110"); /* slash or solidus */
|
||||
if (general_field[i] == '[') strcat(binary_string, "01111"); /* FNC1/Numeric latch */
|
||||
if (general_field[i] == '*') strcat(binary_string, "111010"); /* asterisk */
|
||||
if (general_field[i] == ',') strcat(binary_string, "111011"); /* comma */
|
||||
if (general_field[i] == '-') strcat(binary_string, "111100"); /* minus or hyphen */
|
||||
if (general_field[i] == '.') strcat(binary_string, "111101"); /* period or full stop */
|
||||
if (general_field[i] == '/') strcat(binary_string, "111110"); /* slash or solidus */
|
||||
|
||||
i++;
|
||||
break;
|
||||
@ -1408,11 +1408,11 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
|
||||
if (i != 0) {
|
||||
if ((general_field_type[i - 1] == NUMERIC) || (general_field[i - 1] == '[')) {
|
||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
}
|
||||
if (general_field_type[i - 1] == ALPHA) {
|
||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
}
|
||||
}
|
||||
|
||||
@ -1423,9 +1423,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
if ((value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1438,9 +1438,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x40;
|
||||
for (j = 0; j < 7; j++) {
|
||||
if ((value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1453,36 +1453,36 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x40;
|
||||
for (j = 0; j < 7; j++) {
|
||||
if ((value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (general_field[i] == '[') concat(binary_string, "01111"); /* FNC1/Numeric latch */
|
||||
if (general_field[i] == '!') concat(binary_string, "11101000"); /* exclamation mark */
|
||||
if (general_field[i] == 34) concat(binary_string, "11101001"); /* quotation mark */
|
||||
if (general_field[i] == 37) concat(binary_string, "11101010"); /* percent sign */
|
||||
if (general_field[i] == '&') concat(binary_string, "11101011"); /* ampersand */
|
||||
if (general_field[i] == 39) concat(binary_string, "11101100"); /* apostrophe */
|
||||
if (general_field[i] == '(') concat(binary_string, "11101101"); /* left parenthesis */
|
||||
if (general_field[i] == ')') concat(binary_string, "11101110"); /* right parenthesis */
|
||||
if (general_field[i] == '*') concat(binary_string, "11101111"); /* asterisk */
|
||||
if (general_field[i] == '+') concat(binary_string, "11110000"); /* plus sign */
|
||||
if (general_field[i] == ',') concat(binary_string, "11110001"); /* comma */
|
||||
if (general_field[i] == '-') concat(binary_string, "11110010"); /* minus or hyphen */
|
||||
if (general_field[i] == '.') concat(binary_string, "11110011"); /* period or full stop */
|
||||
if (general_field[i] == '/') concat(binary_string, "11110100"); /* slash or solidus */
|
||||
if (general_field[i] == ':') concat(binary_string, "11110101"); /* colon */
|
||||
if (general_field[i] == ';') concat(binary_string, "11110110"); /* semicolon */
|
||||
if (general_field[i] == '<') concat(binary_string, "11110111"); /* less-than sign */
|
||||
if (general_field[i] == '=') concat(binary_string, "11111000"); /* equals sign */
|
||||
if (general_field[i] == '>') concat(binary_string, "11111001"); /* greater-than sign */
|
||||
if (general_field[i] == '?') concat(binary_string, "11111010"); /* question mark */
|
||||
if (general_field[i] == '_') concat(binary_string, "11111011"); /* underline or low line */
|
||||
if (general_field[i] == ' ') concat(binary_string, "11111100"); /* space */
|
||||
if (general_field[i] == '[') strcat(binary_string, "01111"); /* FNC1/Numeric latch */
|
||||
if (general_field[i] == '!') strcat(binary_string, "11101000"); /* exclamation mark */
|
||||
if (general_field[i] == 34) strcat(binary_string, "11101001"); /* quotation mark */
|
||||
if (general_field[i] == 37) strcat(binary_string, "11101010"); /* percent sign */
|
||||
if (general_field[i] == '&') strcat(binary_string, "11101011"); /* ampersand */
|
||||
if (general_field[i] == 39) strcat(binary_string, "11101100"); /* apostrophe */
|
||||
if (general_field[i] == '(') strcat(binary_string, "11101101"); /* left parenthesis */
|
||||
if (general_field[i] == ')') strcat(binary_string, "11101110"); /* right parenthesis */
|
||||
if (general_field[i] == '*') strcat(binary_string, "11101111"); /* asterisk */
|
||||
if (general_field[i] == '+') strcat(binary_string, "11110000"); /* plus sign */
|
||||
if (general_field[i] == ',') strcat(binary_string, "11110001"); /* comma */
|
||||
if (general_field[i] == '-') strcat(binary_string, "11110010"); /* minus or hyphen */
|
||||
if (general_field[i] == '.') strcat(binary_string, "11110011"); /* period or full stop */
|
||||
if (general_field[i] == '/') strcat(binary_string, "11110100"); /* slash or solidus */
|
||||
if (general_field[i] == ':') strcat(binary_string, "11110101"); /* colon */
|
||||
if (general_field[i] == ';') strcat(binary_string, "11110110"); /* semicolon */
|
||||
if (general_field[i] == '<') strcat(binary_string, "11110111"); /* less-than sign */
|
||||
if (general_field[i] == '=') strcat(binary_string, "11111000"); /* equals sign */
|
||||
if (general_field[i] == '>') strcat(binary_string, "11111001"); /* greater-than sign */
|
||||
if (general_field[i] == '?') strcat(binary_string, "11111010"); /* question mark */
|
||||
if (general_field[i] == '_') strcat(binary_string, "11111011"); /* underline or low line */
|
||||
if (general_field[i] == ' ') strcat(binary_string, "11111100"); /* space */
|
||||
|
||||
i++;
|
||||
break;
|
||||
@ -1744,9 +1744,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x08;
|
||||
for (j = 0; j < 4; j++) {
|
||||
if ((value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -1759,9 +1759,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
mask = 0x40;
|
||||
for (j = 0; j < 7; j++) {
|
||||
if ((value & mask) == 0x00) {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
} else {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
@ -2022,17 +2022,17 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if (binary_length < target_bitsize) {
|
||||
/* Now add padding to binary string */
|
||||
if (alpha_pad == 1) {
|
||||
concat(binary_string, "11111");
|
||||
strcat(binary_string, "11111");
|
||||
alpha_pad = 0;
|
||||
/* Extra FNC1 character required after Alpha encodation (section 5.2.3) */
|
||||
}
|
||||
|
||||
if ((strlen(general_field) != 0) && (general_field_type[strlen(general_field) - 1] == NUMERIC)) {
|
||||
concat(binary_string, "0000");
|
||||
strcat(binary_string, "0000");
|
||||
}
|
||||
|
||||
while (strlen(binary_string) < (unsigned int) target_bitsize) {
|
||||
concat(binary_string, "00100");
|
||||
strcat(binary_string, "00100");
|
||||
}
|
||||
|
||||
if (strlen(binary_string) > (unsigned int) target_bitsize) {
|
||||
@ -2170,7 +2170,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
if (error_number != 0) {
|
||||
strcpy(symbol->errtxt, linear->errtxt);
|
||||
concat(symbol->errtxt, " in linear component");
|
||||
strcat(symbol->errtxt, " in linear component");
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
53
backend/dmatrix.c
Executable file → Normal file
53
backend/dmatrix.c
Executable file → Normal file
@ -258,10 +258,10 @@ static void insert_value(unsigned char binary_stream[], const int posn, const in
|
||||
for (i = streamlen; i > posn; i--) {
|
||||
binary_stream[i] = binary_stream[i - 1];
|
||||
}
|
||||
binary_stream[posn] = newbit;
|
||||
binary_stream[posn] = (unsigned char) newbit;
|
||||
}
|
||||
|
||||
int p_r_6_2_1(const unsigned char inputData[], int position, const int sourcelen) {
|
||||
static int p_r_6_2_1(const unsigned char inputData[], const int position, const int sourcelen) {
|
||||
/* Annex P section (r)(6)(ii)(I)
|
||||
"If one of the three X12 terminator/separator characters first
|
||||
occurs in the yet to be processed data before a non-X12 character..."
|
||||
@ -522,8 +522,7 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen,
|
||||
|
||||
/* Encodes data using ASCII, C40, Text, X12, EDIFACT or Base 256 modes as appropriate
|
||||
Supports encoding FNC1 in supporting systems */
|
||||
int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned char target[], int *last_mode, int *length_p, int process_buffer[], int *process_p) {
|
||||
|
||||
static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], unsigned char target[], int *last_mode, int *length_p, int process_buffer[], int *process_p) {
|
||||
|
||||
int sp, tp, i, gs1;
|
||||
int current_mode, next_mode;
|
||||
@ -554,7 +553,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
if (gs1) {
|
||||
target[tp] = 232;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("FN1 ");
|
||||
} /* FNC1 */
|
||||
|
||||
@ -565,7 +564,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
} else {
|
||||
target[tp] = 234;
|
||||
tp++; /* Reader Programming */
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("RP ");
|
||||
}
|
||||
}
|
||||
@ -588,7 +587,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
if (debug) printf("Macro06 ");
|
||||
}
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
/* Remove macro characters from input string */
|
||||
sp = 7;
|
||||
inputlen -= 2;
|
||||
@ -605,10 +604,10 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
next_mode = DM_ASCII;
|
||||
|
||||
if (istwodigits(source, sp) && ((sp + 1) != inputlen)) {
|
||||
target[tp] = (10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130;
|
||||
target[tp] = (unsigned char) ((10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130);
|
||||
if (debug) printf("N%d ", target[tp] - 130);
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
sp += 2;
|
||||
} else {
|
||||
next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1);
|
||||
@ -617,27 +616,27 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
switch (next_mode) {
|
||||
case DM_C40: target[tp] = 230;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("C40 ");
|
||||
break;
|
||||
case DM_TEXT: target[tp] = 239;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("TEX ");
|
||||
break;
|
||||
case DM_X12: target[tp] = 238;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("X12 ");
|
||||
break;
|
||||
case DM_EDIFACT: target[tp] = 240;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("EDI ");
|
||||
break;
|
||||
case DM_BASE256: target[tp] = 231;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("BAS ");
|
||||
break;
|
||||
}
|
||||
@ -649,7 +648,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
target[tp] = (source[sp] - 128) + 1;
|
||||
if (debug) printf("A%02X ", target[tp] - 1);
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
} else {
|
||||
if (gs1 && (source[sp] == '[')) {
|
||||
target[tp] = 232; /* FNC1 */
|
||||
@ -659,7 +658,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
if (debug) printf("A%02X ", target[tp] - 1);
|
||||
}
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
}
|
||||
sp++;
|
||||
}
|
||||
@ -679,7 +678,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
if (next_mode != DM_C40) {
|
||||
target[tp] = 254;
|
||||
tp++;
|
||||
concat(binary, " "); /* Unlatch */
|
||||
strcat(binary, " "); /* Unlatch */
|
||||
next_mode = DM_ASCII;
|
||||
if (debug) printf("ASC ");
|
||||
} else {
|
||||
@ -715,7 +714,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
tp++;
|
||||
target[tp] = iv % 256;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
||||
|
||||
process_buffer[0] = process_buffer[3];
|
||||
@ -742,7 +741,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
if (next_mode != DM_TEXT) {
|
||||
target[tp] = 254;
|
||||
tp++;
|
||||
concat(binary, " "); /* Unlatch */
|
||||
strcat(binary, " "); /* Unlatch */
|
||||
next_mode = DM_ASCII;
|
||||
if (debug) printf("ASC ");
|
||||
} else {
|
||||
@ -778,7 +777,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
tp++;
|
||||
target[tp] = iv % 256;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
||||
|
||||
process_buffer[0] = process_buffer[3];
|
||||
@ -805,7 +804,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
if (next_mode != DM_X12) {
|
||||
target[tp] = 254;
|
||||
tp++;
|
||||
concat(binary, " "); /* Unlatch */
|
||||
strcat(binary, " "); /* Unlatch */
|
||||
next_mode = DM_ASCII;
|
||||
if (debug) printf("ASC ");
|
||||
} else {
|
||||
@ -839,7 +838,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
tp++;
|
||||
target[tp] = iv % 256;
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
||||
|
||||
process_buffer[0] = process_buffer[3];
|
||||
@ -888,7 +887,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
tp++;
|
||||
target[tp] = ((process_buffer[2] & 0x03) << 6) + process_buffer[3];
|
||||
tp++;
|
||||
concat(binary, " ");
|
||||
strcat(binary, " ");
|
||||
if (debug) printf("[%d %d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2], process_buffer[3]);
|
||||
|
||||
process_buffer[0] = process_buffer[4];
|
||||
@ -912,7 +911,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
if (debug) printf("B%02X ", target[tp]);
|
||||
tp++;
|
||||
sp++;
|
||||
concat(binary, "b");
|
||||
strcat(binary, "b");
|
||||
} else {
|
||||
next_mode = DM_ASCII;
|
||||
if (debug) printf("ASC ");
|
||||
@ -970,7 +969,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
return tp;
|
||||
}
|
||||
|
||||
int dm200encode_remainder(unsigned char target[], int target_length, unsigned char source[], int inputlen, int last_mode, int process_buffer[], int process_p, int symbols_left) {
|
||||
static int dm200encode_remainder(unsigned char target[], int target_length, const unsigned char source[], const int inputlen, const int last_mode, const int process_buffer[], const int process_p, const int symbols_left) {
|
||||
int debug = 0;
|
||||
|
||||
switch (last_mode) {
|
||||
@ -1120,7 +1119,7 @@ int dm200encode_remainder(unsigned char target[], int target_length, unsigned ch
|
||||
}
|
||||
|
||||
/* add pad bits */
|
||||
void add_tail(unsigned char target[], int tp, int tail_length) {
|
||||
static void add_tail(unsigned char target[], int tp, const int tail_length) {
|
||||
int i, prn, temp;
|
||||
|
||||
for (i = tail_length; i > 0; i--) {
|
||||
@ -1141,7 +1140,7 @@ void add_tail(unsigned char target[], int tp, int tail_length) {
|
||||
}
|
||||
}
|
||||
|
||||
int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], const int length) {
|
||||
int inputlen, i, skew = 0;
|
||||
unsigned char binary[2200];
|
||||
int binlen;
|
||||
|
@ -44,7 +44,7 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
extern int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], const int length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -341,9 +341,9 @@ void add_shift_char(char binary[], int shifty) {
|
||||
|
||||
for (p = 0; p < 6; p++) {
|
||||
if (glyph & (0x20 >> p)) {
|
||||
concat(binary, "1");
|
||||
strcat(binary, "1");
|
||||
} else {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -368,7 +368,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
number_pad_posn = 0;
|
||||
|
||||
if (reader) {
|
||||
concat(binary, "1010"); /* FNC3 - Reader Initialisation */
|
||||
strcat(binary, "1010"); /* FNC3 - Reader Initialisation */
|
||||
}
|
||||
|
||||
do {
|
||||
@ -378,31 +378,31 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
switch (current_mode) {
|
||||
case 0:
|
||||
switch (next_mode) {
|
||||
case GM_CHINESE: concat(binary, "0001");
|
||||
case GM_CHINESE: strcat(binary, "0001");
|
||||
break;
|
||||
case GM_NUMBER: concat(binary, "0010");
|
||||
case GM_NUMBER: strcat(binary, "0010");
|
||||
break;
|
||||
case GM_LOWER: concat(binary, "0011");
|
||||
case GM_LOWER: strcat(binary, "0011");
|
||||
break;
|
||||
case GM_UPPER: concat(binary, "0100");
|
||||
case GM_UPPER: strcat(binary, "0100");
|
||||
break;
|
||||
case GM_MIXED: concat(binary, "0101");
|
||||
case GM_MIXED: strcat(binary, "0101");
|
||||
break;
|
||||
case GM_BYTE: concat(binary, "0111");
|
||||
case GM_BYTE: strcat(binary, "0111");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GM_CHINESE:
|
||||
switch (next_mode) {
|
||||
case GM_NUMBER: concat(binary, "1111111100001");
|
||||
case GM_NUMBER: strcat(binary, "1111111100001");
|
||||
break; // 8161
|
||||
case GM_LOWER: concat(binary, "1111111100010");
|
||||
case GM_LOWER: strcat(binary, "1111111100010");
|
||||
break; // 8162
|
||||
case GM_UPPER: concat(binary, "1111111100011");
|
||||
case GM_UPPER: strcat(binary, "1111111100011");
|
||||
break; // 8163
|
||||
case GM_MIXED: concat(binary, "1111111100100");
|
||||
case GM_MIXED: strcat(binary, "1111111100100");
|
||||
break; // 8164
|
||||
case GM_BYTE: concat(binary, "1111111100101");
|
||||
case GM_BYTE: strcat(binary, "1111111100101");
|
||||
break; // 8165
|
||||
}
|
||||
break;
|
||||
@ -420,45 +420,45 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
break; // 0 pad digits
|
||||
}
|
||||
switch (next_mode) {
|
||||
case GM_CHINESE: concat(binary, "1111111011");
|
||||
case GM_CHINESE: strcat(binary, "1111111011");
|
||||
break; // 1019
|
||||
case GM_LOWER: concat(binary, "1111111100");
|
||||
case GM_LOWER: strcat(binary, "1111111100");
|
||||
break; // 1020
|
||||
case GM_UPPER: concat(binary, "1111111101");
|
||||
case GM_UPPER: strcat(binary, "1111111101");
|
||||
break; // 1021
|
||||
case GM_MIXED: concat(binary, "1111111110");
|
||||
case GM_MIXED: strcat(binary, "1111111110");
|
||||
break; // 1022
|
||||
case GM_BYTE: concat(binary, "1111111111");
|
||||
case GM_BYTE: strcat(binary, "1111111111");
|
||||
break; // 1023
|
||||
}
|
||||
break;
|
||||
case GM_LOWER:
|
||||
case GM_UPPER:
|
||||
switch (next_mode) {
|
||||
case GM_CHINESE: concat(binary, "11100");
|
||||
case GM_CHINESE: strcat(binary, "11100");
|
||||
break; // 28
|
||||
case GM_NUMBER: concat(binary, "11101");
|
||||
case GM_NUMBER: strcat(binary, "11101");
|
||||
break; // 29
|
||||
case GM_LOWER:
|
||||
case GM_UPPER: concat(binary, "11110");
|
||||
case GM_UPPER: strcat(binary, "11110");
|
||||
break; // 30
|
||||
case GM_MIXED: concat(binary, "1111100");
|
||||
case GM_MIXED: strcat(binary, "1111100");
|
||||
break; // 124
|
||||
case GM_BYTE: concat(binary, "1111110");
|
||||
case GM_BYTE: strcat(binary, "1111110");
|
||||
break; // 126
|
||||
}
|
||||
break;
|
||||
case GM_MIXED:
|
||||
switch (next_mode) {
|
||||
case GM_CHINESE: concat(binary, "1111110001");
|
||||
case GM_CHINESE: strcat(binary, "1111110001");
|
||||
break; // 1009
|
||||
case GM_NUMBER: concat(binary, "1111110010");
|
||||
case GM_NUMBER: strcat(binary, "1111110010");
|
||||
break; // 1010
|
||||
case GM_LOWER: concat(binary, "1111110011");
|
||||
case GM_LOWER: strcat(binary, "1111110011");
|
||||
break; // 1011
|
||||
case GM_UPPER: concat(binary, "1111110100");
|
||||
case GM_UPPER: strcat(binary, "1111110100");
|
||||
break; // 1012
|
||||
case GM_BYTE: concat(binary, "1111110111");
|
||||
case GM_BYTE: strcat(binary, "1111110111");
|
||||
break; // 1015
|
||||
}
|
||||
break;
|
||||
@ -467,15 +467,15 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
add_byte_count(binary, byte_count_posn, byte_count);
|
||||
byte_count = 0;
|
||||
switch (next_mode) {
|
||||
case GM_CHINESE: concat(binary, "0001");
|
||||
case GM_CHINESE: strcat(binary, "0001");
|
||||
break; // 1
|
||||
case GM_NUMBER: concat(binary, "0010");
|
||||
case GM_NUMBER: strcat(binary, "0010");
|
||||
break; // 2
|
||||
case GM_LOWER: concat(binary, "0011");
|
||||
case GM_LOWER: strcat(binary, "0011");
|
||||
break; // 3
|
||||
case GM_UPPER: concat(binary, "0100");
|
||||
case GM_UPPER: strcat(binary, "0100");
|
||||
break; // 4
|
||||
case GM_MIXED: concat(binary, "0101");
|
||||
case GM_MIXED: strcat(binary, "0101");
|
||||
break; // 5
|
||||
}
|
||||
break;
|
||||
@ -547,9 +547,9 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
|
||||
for (q = 0; q < 13; q++) {
|
||||
if (glyph & (0x1000 >> q)) {
|
||||
concat(binary, "1");
|
||||
strcat(binary, "1");
|
||||
} else {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
}
|
||||
sp++;
|
||||
@ -559,7 +559,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
if (last_mode != current_mode) {
|
||||
/* Reserve a space for numeric digit padding value (2 bits) */
|
||||
number_pad_posn = strlen(binary);
|
||||
concat(binary, "XX");
|
||||
strcat(binary, "XX");
|
||||
}
|
||||
p = 0;
|
||||
ppos = -1;
|
||||
@ -621,9 +621,9 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
|
||||
for (q = 0; q < 10; q++) {
|
||||
if (glyph & (0x200 >> q)) {
|
||||
concat(binary, "1");
|
||||
strcat(binary, "1");
|
||||
} else {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -635,9 +635,9 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
|
||||
for (q = 0; q < 10; q++) {
|
||||
if (glyph & (0x200 >> q)) {
|
||||
concat(binary, "1");
|
||||
strcat(binary, "1");
|
||||
} else {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -646,14 +646,14 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
if (last_mode != current_mode) {
|
||||
/* Reserve space for byte block length indicator (9 bits) */
|
||||
byte_count_posn = strlen(binary);
|
||||
concat(binary, "LLLLLLLLL");
|
||||
strcat(binary, "LLLLLLLLL");
|
||||
}
|
||||
if (byte_count == 512) {
|
||||
/* Maximum byte block size is 512 bytes. If longer is needed then start a new block */
|
||||
add_byte_count(binary, byte_count_posn, byte_count);
|
||||
concat(binary, "0111");
|
||||
strcat(binary, "0111");
|
||||
byte_count_posn = strlen(binary);
|
||||
concat(binary, "LLLLLLLLL");
|
||||
strcat(binary, "LLLLLLLLL");
|
||||
byte_count = 0;
|
||||
}
|
||||
|
||||
@ -663,9 +663,9 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
}
|
||||
for (q = 0; q < 8; q++) {
|
||||
if (glyph & (0x80 >> q)) {
|
||||
concat(binary, "1");
|
||||
strcat(binary, "1");
|
||||
} else {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
}
|
||||
sp++;
|
||||
@ -696,14 +696,14 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
|
||||
for (q = 0; q < 6; q++) {
|
||||
if (glyph & (0x20 >> q)) {
|
||||
concat(binary, "1");
|
||||
strcat(binary, "1");
|
||||
} else {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Shift Mode character */
|
||||
concat(binary, "1111110110"); /* 1014 - shift indicator */
|
||||
strcat(binary, "1111110110"); /* 1014 - shift indicator */
|
||||
add_shift_char(binary, gbdata[sp]);
|
||||
}
|
||||
|
||||
@ -728,14 +728,14 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
|
||||
for (q = 0; q < 5; q++) {
|
||||
if (glyph & (0x10 >> q)) {
|
||||
concat(binary, "1");
|
||||
strcat(binary, "1");
|
||||
} else {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Shift Mode character */
|
||||
concat(binary, "1111101"); /* 127 - shift indicator */
|
||||
strcat(binary, "1111101"); /* 127 - shift indicator */
|
||||
add_shift_char(binary, gbdata[sp]);
|
||||
}
|
||||
|
||||
@ -760,14 +760,14 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
|
||||
for (q = 0; q < 5; q++) {
|
||||
if (glyph & (0x10 >> q)) {
|
||||
concat(binary, "1");
|
||||
strcat(binary, "1");
|
||||
} else {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Shift Mode character */
|
||||
concat(binary, "1111101"); /* 127 - shift indicator */
|
||||
strcat(binary, "1111101"); /* 127 - shift indicator */
|
||||
add_shift_char(binary, gbdata[sp]);
|
||||
}
|
||||
|
||||
@ -802,16 +802,16 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
|
||||
/* Add "end of data" character */
|
||||
switch (current_mode) {
|
||||
case GM_CHINESE: concat(binary, "1111111100000");
|
||||
case GM_CHINESE: strcat(binary, "1111111100000");
|
||||
break; // 8160
|
||||
case GM_NUMBER: concat(binary, "1111111010");
|
||||
case GM_NUMBER: strcat(binary, "1111111010");
|
||||
break; // 1018
|
||||
case GM_LOWER:
|
||||
case GM_UPPER: concat(binary, "11011");
|
||||
case GM_UPPER: strcat(binary, "11011");
|
||||
break; // 27
|
||||
case GM_MIXED: concat(binary, "1111110000");
|
||||
case GM_MIXED: strcat(binary, "1111110000");
|
||||
break; // 1008
|
||||
case GM_BYTE: concat(binary, "0000");
|
||||
case GM_BYTE: strcat(binary, "0000");
|
||||
break; // 0
|
||||
}
|
||||
|
||||
@ -821,7 +821,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
||||
p = 0;
|
||||
}
|
||||
for (i = 0; i < p; i++) {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
|
||||
if (strlen(binary) > 9191) {
|
||||
|
@ -56,17 +56,17 @@ void itostr(char ai_string[], int ai_value) {
|
||||
temp[1] = '\0';
|
||||
if (ai_value >= 1000) {
|
||||
temp[0] = itoc(thou);
|
||||
concat(ai_string, temp);
|
||||
strcat(ai_string, temp);
|
||||
}
|
||||
if (ai_value >= 100) {
|
||||
temp[0] = itoc(hund);
|
||||
concat(ai_string, temp);
|
||||
strcat(ai_string, temp);
|
||||
}
|
||||
temp[0] = itoc(ten);
|
||||
concat(ai_string, temp);
|
||||
strcat(ai_string, temp);
|
||||
temp[0] = itoc(unit);
|
||||
concat(ai_string, temp);
|
||||
concat(ai_string, ")");
|
||||
strcat(ai_string, temp);
|
||||
strcat(ai_string, ")");
|
||||
}
|
||||
|
||||
int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const unsigned int src_len, char reduced[]) {
|
||||
@ -287,13 +287,13 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const u
|
||||
|
||||
if (error_latch == 5) {
|
||||
strcpy(symbol->errtxt, "Invalid data length for AI ");
|
||||
concat(symbol->errtxt, ai_string);
|
||||
strcat(symbol->errtxt, ai_string);
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if (error_latch == 6) {
|
||||
strcpy(symbol->errtxt, "Invalid AI value ");
|
||||
concat(symbol->errtxt, ai_string);
|
||||
strcat(symbol->errtxt, ai_string);
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
|
@ -652,7 +652,7 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
if (bar_map[i + 65] == 0)
|
||||
j += 2;
|
||||
temp[0] = itoc(j);
|
||||
concat(data_pattern, temp);
|
||||
strcat(data_pattern, temp);
|
||||
}
|
||||
|
||||
/* Translate 4-state data pattern to symbol */
|
||||
|
14
backend/library.c
Executable file → Normal file
14
backend/library.c
Executable file → Normal file
@ -204,7 +204,7 @@ void error_tag(char error_string[], int error_number) {
|
||||
strcpy(error_string, "warning: ");
|
||||
}
|
||||
|
||||
concat(error_string, error_buffer);
|
||||
strcat(error_string, error_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,23 +315,23 @@ int hibc(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
temp[0] = check_digit;
|
||||
temp[1] = '\0';
|
||||
|
||||
concat(to_process, (char *) source);
|
||||
concat(to_process, temp);
|
||||
strcat(to_process, (char *) source);
|
||||
strcat(to_process, temp);
|
||||
length = strlen(to_process);
|
||||
|
||||
switch (symbol->symbology) {
|
||||
case BARCODE_HIBC_128:
|
||||
error_number = code_128(symbol, (unsigned char *) to_process, length);
|
||||
ustrcpy(symbol->text, (unsigned char*) "*");
|
||||
uconcat(symbol->text, (unsigned char*) to_process);
|
||||
uconcat(symbol->text, (unsigned char*) "*");
|
||||
strcat((char*) symbol->text, to_process);
|
||||
strcat((char*) symbol->text, "*");
|
||||
break;
|
||||
case BARCODE_HIBC_39:
|
||||
symbol->option_2 = 0;
|
||||
error_number = c39(symbol, (unsigned char *) to_process, length);
|
||||
ustrcpy(symbol->text, (unsigned char*) "*");
|
||||
uconcat(symbol->text, (unsigned char*) to_process);
|
||||
uconcat(symbol->text, (unsigned char*) "*");
|
||||
strcat((char*) symbol->text, to_process);
|
||||
strcat((char*) symbol->text, "*");
|
||||
break;
|
||||
case BARCODE_HIBC_DM:
|
||||
error_number = dmatrix(symbol, (unsigned char *) to_process, length);
|
||||
|
@ -85,10 +85,10 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
do {
|
||||
if (!(tester & 1)) {
|
||||
concat(inter, "W");
|
||||
strcat(inter, "W");
|
||||
tester = (tester - 2) / 2;
|
||||
} else {
|
||||
concat(inter, "N");
|
||||
strcat(inter, "N");
|
||||
tester = (tester - 1) / 2;
|
||||
}
|
||||
} while (tester != 0);
|
||||
@ -97,9 +97,9 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
*dest = '\0';
|
||||
for (counter = h; counter >= 0; counter--) {
|
||||
if (inter[counter] == 'W') {
|
||||
concat(dest, "32");
|
||||
strcat(dest, "32");
|
||||
} else {
|
||||
concat(dest, "12");
|
||||
strcat(dest, "12");
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,15 +130,15 @@ int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char des
|
||||
do {
|
||||
switch (tester % 3) {
|
||||
case 0:
|
||||
concat(inter, "3");
|
||||
strcat(inter, "3");
|
||||
tester = (tester - 3) / 3;
|
||||
break;
|
||||
case 1:
|
||||
concat(inter, "1");
|
||||
strcat(inter, "1");
|
||||
tester = (tester - 1) / 3;
|
||||
break;
|
||||
case 2:
|
||||
concat(inter, "2");
|
||||
strcat(inter, "2");
|
||||
tester = (tester - 2) / 3;
|
||||
break;
|
||||
}
|
||||
@ -302,8 +302,8 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Override the normal text output with the Pharmacode number */
|
||||
ustrcpy(symbol->text, (unsigned char*) "A");
|
||||
uconcat(symbol->text, (unsigned char*) localstr);
|
||||
strcpy((char*) symbol->text, "A");
|
||||
strcat((char*) symbol->text, (char*) localstr);
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int len
|
||||
if (longueur > 44) {
|
||||
longueur = 44;
|
||||
}
|
||||
concat(chainemod, "1");
|
||||
strcat(chainemod, "1");
|
||||
for (loop = 1; loop <= longueur; loop++) {
|
||||
chainemod[loop] = chaine[start + loop + j - 1];
|
||||
}
|
||||
@ -529,7 +529,7 @@ void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int len
|
||||
}
|
||||
if (nombre < diviseur) {
|
||||
if (strlen(chainemult) != 0) {
|
||||
concat(chainemult, "0");
|
||||
strcat(chainemult, "0");
|
||||
}
|
||||
} else {
|
||||
temp = (nombre / diviseur) + '0';
|
||||
@ -777,8 +777,8 @@ int pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) {
|
||||
default: offset = 0;
|
||||
break;
|
||||
}
|
||||
concat(codebarre, codagemc[offset + dummy[j]]);
|
||||
concat(codebarre, "*");
|
||||
strcat(codebarre, codagemc[offset + dummy[j]]);
|
||||
strcat(codebarre, "*");
|
||||
}
|
||||
} else {
|
||||
/* normal PDF417 symbol */
|
||||
@ -791,10 +791,10 @@ int pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) {
|
||||
default: offset = 0;
|
||||
/* cluster(0) */ break;
|
||||
}
|
||||
concat(codebarre, codagemc[offset + dummy[j]]);
|
||||
concat(codebarre, "*");
|
||||
strcat(codebarre, codagemc[offset + dummy[j]]);
|
||||
strcat(codebarre, "*");
|
||||
}
|
||||
concat(codebarre, "-");
|
||||
strcat(codebarre, "-");
|
||||
}
|
||||
|
||||
strcpy(pattern, "");
|
||||
@ -1194,33 +1194,33 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length)
|
||||
}
|
||||
|
||||
/* Copy the data into codebarre */
|
||||
concat(codebarre, RAPLR[LeftRAP]);
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[1]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, RAPLR[LeftRAP]);
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[1]]);
|
||||
strcat(codebarre, "1");
|
||||
if (symbol->option_2 == 3) {
|
||||
concat(codebarre, RAPC[CentreRAP]);
|
||||
strcat(codebarre, RAPC[CentreRAP]);
|
||||
}
|
||||
if (symbol->option_2 >= 2) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[2]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[2]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
if (symbol->option_2 == 4) {
|
||||
concat(codebarre, RAPC[CentreRAP]);
|
||||
strcat(codebarre, RAPC[CentreRAP]);
|
||||
}
|
||||
if (symbol->option_2 >= 3) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[3]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[3]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
if (symbol->option_2 == 4) {
|
||||
concat(codebarre, "1");
|
||||
concat(codebarre, codagemc[offset + dummy[4]]);
|
||||
concat(codebarre, "1");
|
||||
strcat(codebarre, "1");
|
||||
strcat(codebarre, codagemc[offset + dummy[4]]);
|
||||
strcat(codebarre, "1");
|
||||
}
|
||||
concat(codebarre, RAPLR[RightRAP]);
|
||||
concat(codebarre, "1"); /* stop */
|
||||
strcat(codebarre, RAPLR[RightRAP]);
|
||||
strcat(codebarre, "1"); /* stop */
|
||||
if (debug) printf("%s\n", codebarre);
|
||||
|
||||
/* Now codebarre is a mixture of letters and numbers */
|
||||
|
@ -95,15 +95,15 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
switch (checkptr[length * 4 + i]) {
|
||||
case 0: concat(dest, "13");
|
||||
case 0: strcat(dest, "13");
|
||||
break;
|
||||
case 1: concat(dest, "31");
|
||||
case 1: strcat(dest, "31");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "331311313");
|
||||
strcat(dest, "331311313");
|
||||
|
||||
expand(symbol, dest);
|
||||
ustrcpy(symbol->text, source);
|
||||
@ -130,7 +130,7 @@ int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "121");
|
||||
strcat(dest, "121");
|
||||
|
||||
expand(symbol, dest);
|
||||
ustrcpy(symbol->text, source);
|
||||
@ -195,7 +195,7 @@ int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int le
|
||||
lookup(NEON, MSITable, itoc(pump), dest);
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "121");
|
||||
strcat(dest, "121");
|
||||
expand(symbol, dest);
|
||||
|
||||
ustrcpy(symbol->text, source);
|
||||
@ -296,7 +296,7 @@ int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], cons
|
||||
lookup(NEON, MSITable, itoc(chwech), dest);
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, "121");
|
||||
strcat(dest, "121");
|
||||
|
||||
expand(symbol, dest);
|
||||
|
||||
@ -351,13 +351,13 @@ int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const
|
||||
}
|
||||
|
||||
/* stop character */
|
||||
concat(dest, "121");
|
||||
strcat(dest, "121");
|
||||
|
||||
expand(symbol, dest);
|
||||
|
||||
ustrcpy(symbol->text, source);
|
||||
if (check == 10) {
|
||||
concat((char*) symbol->text, "10");
|
||||
strcat((char*) symbol->text, "10");
|
||||
} else {
|
||||
symbol->text[src_len] = itoc(check);
|
||||
symbol->text[src_len + 1] = '\0';
|
||||
@ -410,7 +410,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
|
||||
if (check == 10) {
|
||||
lookup(NEON, MSITable, '1', dest);
|
||||
lookup(NEON, MSITable, '0', dest);
|
||||
uconcat(temp, (unsigned char *) "10");
|
||||
strcat((char*) temp, "10");
|
||||
temp_len += 2;
|
||||
} else {
|
||||
lookup(NEON, MSITable, itoc(check), dest);
|
||||
@ -451,7 +451,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
|
||||
lookup(NEON, MSITable, itoc(pump), dest);
|
||||
|
||||
/* stop character */
|
||||
concat(dest, "121");
|
||||
strcat(dest, "121");
|
||||
expand(symbol, dest);
|
||||
|
||||
temp[temp_len++] = itoc(pump);
|
||||
|
@ -111,10 +111,10 @@ int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
||||
}
|
||||
|
||||
check_digit = (10 - (sum % 10)) % 10;
|
||||
concat(dest, PNTable[check_digit]);
|
||||
strcat(dest, PNTable[check_digit]);
|
||||
|
||||
/* stop character */
|
||||
concat(dest, "L");
|
||||
strcat(dest, "L");
|
||||
|
||||
return error_number;
|
||||
}
|
||||
@ -177,10 +177,10 @@ int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
||||
}
|
||||
|
||||
check_digit = (10 - (sum % 10)) % 10;
|
||||
concat(dest, PLTable[check_digit]);
|
||||
strcat(dest, PLTable[check_digit]);
|
||||
|
||||
/* stop character */
|
||||
concat(dest, "L");
|
||||
strcat(dest, "L");
|
||||
|
||||
return error_number;
|
||||
}
|
||||
@ -322,10 +322,10 @@ char rm4scc(char source[], unsigned char dest[], int length) {
|
||||
column = 5;
|
||||
}
|
||||
check_digit = (6 * row) + column;
|
||||
concat((char*) dest, RoyalTable[check_digit]);
|
||||
strcat((char*) dest, RoyalTable[check_digit]);
|
||||
|
||||
/* stop character */
|
||||
concat((char*) dest, "0");
|
||||
strcat((char*) dest, "0");
|
||||
|
||||
return set_copy[check_digit];
|
||||
}
|
||||
@ -448,16 +448,16 @@ int daft_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
if (source[i] == 'D') {
|
||||
concat(height_pattern, "2");
|
||||
strcat(height_pattern, "2");
|
||||
}
|
||||
if (source[i] == 'A') {
|
||||
concat(height_pattern, "1");
|
||||
strcat(height_pattern, "1");
|
||||
}
|
||||
if (source[i] == 'F') {
|
||||
concat(height_pattern, "0");
|
||||
strcat(height_pattern, "0");
|
||||
}
|
||||
if (source[i] == 'T') {
|
||||
concat(height_pattern, "3");
|
||||
strcat(height_pattern, "3");
|
||||
}
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
sum = 0;
|
||||
for (i = 0; i < 20; i++) {
|
||||
concat(pattern, JapanTable[posn(KASUTSET, inter[i])]);
|
||||
strcat(pattern, JapanTable[posn(KASUTSET, inter[i])]);
|
||||
sum += posn(CHKASUTSET, inter[i]);
|
||||
}
|
||||
|
||||
@ -588,9 +588,9 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
if (check >= 11) {
|
||||
check_char = (check - 11) + 'a';
|
||||
}
|
||||
concat(pattern, JapanTable[posn(KASUTSET, check_char)]);
|
||||
strcat(pattern, JapanTable[posn(KASUTSET, check_char)]);
|
||||
|
||||
concat(pattern, "31"); /* Stop */
|
||||
strcat(pattern, "31"); /* Stop */
|
||||
|
||||
/* Resolve pattern to 4-state symbols */
|
||||
writer = 0;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "common.h"
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
@ -198,9 +199,9 @@ int ps_plot(struct zint_symbol *symbol) {
|
||||
}
|
||||
fprintf(feps, "%%%%Pages: 0\n");
|
||||
if (symbol->symbology != BARCODE_MAXICODE) {
|
||||
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", roundup((symbol->width + xoffset + xoffset) * scaler), roundup((symbol->height + textoffset + yoffset + yoffset) * scaler));
|
||||
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler));
|
||||
} else {
|
||||
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", roundup((74.0 + xoffset + xoffset) * scaler), roundup((72.0 + yoffset + yoffset) * scaler));
|
||||
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler));
|
||||
}
|
||||
fprintf(feps, "%%%%EndComments\n");
|
||||
|
||||
|
102
backend/qr.c
102
backend/qr.c
@ -188,7 +188,7 @@ int estimate_binary_length(char mode[], int length, int gs1) {
|
||||
|
||||
static void qr_bscan(char *binary, int data, int h) {
|
||||
for (; h; h >>= 1) {
|
||||
concat(binary, data & h ? "1" : "0");
|
||||
strcat(binary, data & h ? "1" : "0");
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
||||
strcpy(binary, "");
|
||||
|
||||
if (gs1) {
|
||||
concat(binary, "0101"); /* FNC1 */
|
||||
strcat(binary, "0101"); /* FNC1 */
|
||||
}
|
||||
|
||||
if (version <= 9) {
|
||||
@ -240,7 +240,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
||||
case 'K':
|
||||
/* Kanji mode */
|
||||
/* Mode indicator */
|
||||
concat(binary, "1000");
|
||||
strcat(binary, "1000");
|
||||
|
||||
/* Character count indicator */
|
||||
qr_bscan(binary, short_data_block_length, 0x20 << (scheme * 2)); /* scheme = 1..3 */
|
||||
@ -276,7 +276,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
||||
case 'B':
|
||||
/* Byte mode */
|
||||
/* Mode indicator */
|
||||
concat(binary, "0100");
|
||||
strcat(binary, "0100");
|
||||
|
||||
/* Character count indicator */
|
||||
qr_bscan(binary, short_data_block_length, scheme > 1 ? 0x8000 : 0x80); /* scheme = 1..3 */
|
||||
@ -308,7 +308,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
||||
case 'A':
|
||||
/* Alphanumeric mode */
|
||||
/* Mode indicator */
|
||||
concat(binary, "0010");
|
||||
strcat(binary, "0010");
|
||||
|
||||
/* Character count indicator */
|
||||
qr_bscan(binary, short_data_block_length, 0x40 << (2 * scheme)); /* scheme = 1..3 */
|
||||
@ -399,7 +399,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
||||
case 'N':
|
||||
/* Numeric mode */
|
||||
/* Mode indicator */
|
||||
concat(binary, "0001");
|
||||
strcat(binary, "0001");
|
||||
|
||||
/* Character count indicator */
|
||||
qr_bscan(binary, short_data_block_length, 0x80 << (2 * scheme)); /* scheme = 1..3 */
|
||||
@ -450,7 +450,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
||||
} while (position < length);
|
||||
|
||||
/* Terminator */
|
||||
concat(binary, "0000");
|
||||
strcat(binary, "0000");
|
||||
|
||||
current_binlen = strlen(binary);
|
||||
padbits = 8 - (current_binlen % 8);
|
||||
@ -461,7 +461,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
||||
|
||||
/* Padding bits */
|
||||
for (i = 0; i < padbits; i++) {
|
||||
concat(binary, "0");
|
||||
strcat(binary, "0");
|
||||
}
|
||||
|
||||
/* Put data into 8-bit codewords */
|
||||
@ -1138,8 +1138,7 @@ int apply_bitmask(unsigned char *grid, int size, int ecc_level) {
|
||||
for (y = 0; y < size; y++) {
|
||||
if (grid[(y * size) + x] & 0x01) {
|
||||
p = 0xff;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
p = 0x00;
|
||||
}
|
||||
|
||||
@ -1316,8 +1315,7 @@ void applyOptimisation(int version, char inputMode[], int inputLength) {
|
||||
if (!blockLength) return;
|
||||
blockMode = (char*) malloc(sizeof (char)*blockCount);
|
||||
assert(blockMode);
|
||||
if (!blockMode)
|
||||
{
|
||||
if (!blockMode) {
|
||||
free(blockLength);
|
||||
return;
|
||||
}
|
||||
@ -1773,13 +1771,13 @@ int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length,
|
||||
case 'K':
|
||||
/* Kanji mode */
|
||||
/* Mode indicator */
|
||||
concat(binary, "K");
|
||||
strcat(binary, "K");
|
||||
*kanji_used = 1;
|
||||
|
||||
/* Character count indicator */
|
||||
buffer[0] = short_data_block_length;
|
||||
buffer[1] = '\0';
|
||||
concat(binary, buffer);
|
||||
strcat(binary, buffer);
|
||||
|
||||
if (debug) {
|
||||
printf("Kanji block (length %d)\n\t", short_data_block_length);
|
||||
@ -1816,13 +1814,13 @@ int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length,
|
||||
case 'B':
|
||||
/* Byte mode */
|
||||
/* Mode indicator */
|
||||
concat(binary, "B");
|
||||
strcat(binary, "B");
|
||||
*byte_used = 1;
|
||||
|
||||
/* Character count indicator */
|
||||
buffer[0] = short_data_block_length;
|
||||
buffer[1] = '\0';
|
||||
concat(binary, buffer);
|
||||
strcat(binary, buffer);
|
||||
|
||||
if (debug) {
|
||||
printf("Byte block (length %d)\n\t", short_data_block_length);
|
||||
@ -1851,13 +1849,13 @@ int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length,
|
||||
case 'A':
|
||||
/* Alphanumeric mode */
|
||||
/* Mode indicator */
|
||||
concat(binary, "A");
|
||||
strcat(binary, "A");
|
||||
*alphanum_used = 1;
|
||||
|
||||
/* Character count indicator */
|
||||
buffer[0] = short_data_block_length;
|
||||
buffer[1] = '\0';
|
||||
concat(binary, buffer);
|
||||
strcat(binary, buffer);
|
||||
|
||||
if (debug) {
|
||||
printf("Alpha block (length %d)\n\t", short_data_block_length);
|
||||
@ -1900,12 +1898,12 @@ int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length,
|
||||
case 'N':
|
||||
/* Numeric mode */
|
||||
/* Mode indicator */
|
||||
concat(binary, "N");
|
||||
strcat(binary, "N");
|
||||
|
||||
/* Character count indicator */
|
||||
buffer[0] = short_data_block_length;
|
||||
buffer[1] = '\0';
|
||||
concat(binary, buffer);
|
||||
strcat(binary, buffer);
|
||||
|
||||
if (debug) {
|
||||
printf("Number block (length %d)\n\t", short_data_block_length);
|
||||
@ -2014,21 +2012,21 @@ void microqr_expand_binary(char binary_stream[], char full_stream[], int version
|
||||
i = 0;
|
||||
do {
|
||||
switch (binary_stream[i]) {
|
||||
case '1': concat(full_stream, "1");
|
||||
case '1': strcat(full_stream, "1");
|
||||
i++;
|
||||
break;
|
||||
case '0': concat(full_stream, "0");
|
||||
case '0': strcat(full_stream, "0");
|
||||
i++;
|
||||
break;
|
||||
case 'N':
|
||||
/* Numeric Mode */
|
||||
/* Mode indicator */
|
||||
switch (version) {
|
||||
case 1: concat(full_stream, "0");
|
||||
case 1: strcat(full_stream, "0");
|
||||
break;
|
||||
case 2: concat(full_stream, "00");
|
||||
case 2: strcat(full_stream, "00");
|
||||
break;
|
||||
case 3: concat(full_stream, "000");
|
||||
case 3: strcat(full_stream, "000");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2041,11 +2039,11 @@ void microqr_expand_binary(char binary_stream[], char full_stream[], int version
|
||||
/* Alphanumeric Mode */
|
||||
/* Mode indicator */
|
||||
switch (version) {
|
||||
case 1: concat(full_stream, "1");
|
||||
case 1: strcat(full_stream, "1");
|
||||
break;
|
||||
case 2: concat(full_stream, "01");
|
||||
case 2: strcat(full_stream, "01");
|
||||
break;
|
||||
case 3: concat(full_stream, "001");
|
||||
case 3: strcat(full_stream, "001");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2058,9 +2056,9 @@ void microqr_expand_binary(char binary_stream[], char full_stream[], int version
|
||||
/* Byte Mode */
|
||||
/* Mode indicator */
|
||||
switch (version) {
|
||||
case 2: concat(full_stream, "10");
|
||||
case 2: strcat(full_stream, "10");
|
||||
break;
|
||||
case 3: concat(full_stream, "010");
|
||||
case 3: strcat(full_stream, "010");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2073,9 +2071,9 @@ void microqr_expand_binary(char binary_stream[], char full_stream[], int version
|
||||
/* Kanji Mode */
|
||||
/* Mode indicator */
|
||||
switch (version) {
|
||||
case 2: concat(full_stream, "11");
|
||||
case 2: strcat(full_stream, "11");
|
||||
break;
|
||||
case 3: concat(full_stream, "011");
|
||||
case 3: strcat(full_stream, "011");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2102,11 +2100,11 @@ void micro_qr_m1(char binary_data[]) {
|
||||
bits_left = bits_total - strlen(binary_data);
|
||||
if (bits_left <= 3) {
|
||||
for (i = 0; i < bits_left; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
latch = 1;
|
||||
} else {
|
||||
concat(binary_data, "000");
|
||||
strcat(binary_data, "000");
|
||||
}
|
||||
|
||||
if (latch == 0) {
|
||||
@ -2114,7 +2112,7 @@ void micro_qr_m1(char binary_data[]) {
|
||||
bits_left = bits_total - strlen(binary_data);
|
||||
if (bits_left <= 4) {
|
||||
for (i = 0; i < bits_left; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
latch = 1;
|
||||
}
|
||||
@ -2127,7 +2125,7 @@ void micro_qr_m1(char binary_data[]) {
|
||||
remainder = 0;
|
||||
}
|
||||
for (i = 0; i < remainder; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
|
||||
/* Add padding */
|
||||
@ -2135,10 +2133,10 @@ void micro_qr_m1(char binary_data[]) {
|
||||
if (bits_left > 4) {
|
||||
remainder = (bits_left - 4) / 8;
|
||||
for (i = 0; i < remainder; i++) {
|
||||
concat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||
strcat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||
}
|
||||
}
|
||||
concat(binary_data, "0000");
|
||||
strcat(binary_data, "0000");
|
||||
}
|
||||
|
||||
data_codewords = 3;
|
||||
@ -2217,11 +2215,11 @@ void micro_qr_m2(char binary_data[], int ecc_mode) {
|
||||
bits_left = bits_total - strlen(binary_data);
|
||||
if (bits_left <= 5) {
|
||||
for (i = 0; i < bits_left; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
latch = 1;
|
||||
} else {
|
||||
concat(binary_data, "00000");
|
||||
strcat(binary_data, "00000");
|
||||
}
|
||||
|
||||
if (latch == 0) {
|
||||
@ -2231,14 +2229,14 @@ void micro_qr_m2(char binary_data[], int ecc_mode) {
|
||||
remainder = 0;
|
||||
}
|
||||
for (i = 0; i < remainder; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
|
||||
/* Add padding */
|
||||
bits_left = bits_total - strlen(binary_data);
|
||||
remainder = bits_left / 8;
|
||||
for (i = 0; i < remainder; i++) {
|
||||
concat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||
strcat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2313,11 +2311,11 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
||||
bits_left = bits_total - strlen(binary_data);
|
||||
if (bits_left <= 7) {
|
||||
for (i = 0; i < bits_left; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
latch = 1;
|
||||
} else {
|
||||
concat(binary_data, "0000000");
|
||||
strcat(binary_data, "0000000");
|
||||
}
|
||||
|
||||
if (latch == 0) {
|
||||
@ -2325,7 +2323,7 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
||||
bits_left = bits_total - strlen(binary_data);
|
||||
if (bits_left <= 4) {
|
||||
for (i = 0; i < bits_left; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
latch = 1;
|
||||
}
|
||||
@ -2338,7 +2336,7 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
||||
remainder = 0;
|
||||
}
|
||||
for (i = 0; i < remainder; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
|
||||
/* Add padding */
|
||||
@ -2346,10 +2344,10 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
||||
if (bits_left > 4) {
|
||||
remainder = (bits_left - 4) / 8;
|
||||
for (i = 0; i < remainder; i++) {
|
||||
concat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||
strcat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||
}
|
||||
}
|
||||
concat(binary_data, "0000");
|
||||
strcat(binary_data, "0000");
|
||||
}
|
||||
|
||||
if (ecc_mode == LEVEL_L) {
|
||||
@ -2458,11 +2456,11 @@ void micro_qr_m4(char binary_data[], int ecc_mode) {
|
||||
bits_left = bits_total - strlen(binary_data);
|
||||
if (bits_left <= 9) {
|
||||
for (i = 0; i < bits_left; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
latch = 1;
|
||||
} else {
|
||||
concat(binary_data, "000000000");
|
||||
strcat(binary_data, "000000000");
|
||||
}
|
||||
|
||||
if (latch == 0) {
|
||||
@ -2472,14 +2470,14 @@ void micro_qr_m4(char binary_data[], int ecc_mode) {
|
||||
remainder = 0;
|
||||
}
|
||||
for (i = 0; i < remainder; i++) {
|
||||
concat(binary_data, "0");
|
||||
strcat(binary_data, "0");
|
||||
}
|
||||
|
||||
/* Add padding */
|
||||
bits_left = bits_total - strlen(binary_data);
|
||||
remainder = bits_left / 8;
|
||||
for (i = 0; i < remainder; i++) {
|
||||
concat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||
strcat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,6 @@
|
||||
#include <stdio.h> // only needed for debug (main)
|
||||
#include <stdlib.h> // only needed for malloc/free
|
||||
#include "reedsol.h"
|
||||
static int gfpoly;
|
||||
static int symsize; // in bits
|
||||
static int logmod; // 2**symsize - 1
|
||||
static int rlen;
|
||||
|
||||
@ -76,8 +74,6 @@ void rs_init_gf(const int poly) {
|
||||
m++;
|
||||
b >>= 1;
|
||||
m--;
|
||||
gfpoly = poly;
|
||||
symsize = m;
|
||||
|
||||
// Calculate the log/alog tables
|
||||
logmod = (1 << m) - 1;
|
||||
@ -128,12 +124,12 @@ void rs_encode(const int len,const unsigned char *data, unsigned char *res) {
|
||||
m = res[rlen - 1] ^ data[i];
|
||||
for (k = rlen - 1; k > 0; k--) {
|
||||
if (m && rspoly[k])
|
||||
res[k] = res[k - 1] ^ alog[(logt[m] + logt[rspoly[k]]) % logmod];
|
||||
res[k] = (unsigned char) (res[k - 1] ^ alog[(logt[m] + logt[rspoly[k]]) % logmod]);
|
||||
else
|
||||
res[k] = res[k - 1];
|
||||
}
|
||||
if (m && rspoly[0])
|
||||
res[0] = alog[(logt[m] + logt[rspoly[0]]) % logmod];
|
||||
res[0] = (unsigned char) (alog[(logt[m] + logt[rspoly[0]]) % logmod]);
|
||||
else
|
||||
res[0] = 0;
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
||||
|
||||
// Allocate memory for the rendered version
|
||||
render = symbol->rendered = (struct zint_render *) malloc(sizeof (struct zint_render));
|
||||
if (!symbol->rendered) return ZINT_ERROR_MEMORY;
|
||||
render->lines = NULL;
|
||||
render->strings = NULL;
|
||||
render->rings = NULL;
|
||||
@ -172,7 +173,6 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else if (((symbol->symbology == BARCODE_UPCA) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCA_CC)) {
|
||||
upceanflag = 12;
|
||||
if (symbol->whitespace_width < 10) {
|
||||
@ -190,7 +190,6 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else if (((symbol->symbology == BARCODE_UPCE) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCE_CC)) {
|
||||
upceanflag = 6;
|
||||
if (symbol->whitespace_width == 0) {
|
||||
@ -276,7 +275,6 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
||||
render->height = ((x_dimension * ((2 * symbol->border_width) + text_offset + text_height)) + 5.0) * GL_CONST;
|
||||
}
|
||||
}
|
||||
|
||||
else if (symbol->symbology == BARCODE_CODE49) {
|
||||
/* The minimum X-dimension of Code 49 is 0.191mm */
|
||||
if (x_dimension < 0.191) {
|
||||
@ -315,20 +313,17 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
||||
render->width = 0.508 * GL_CONST * total_area_width_x;
|
||||
render->height = 4.064 * GL_CONST;
|
||||
}
|
||||
|
||||
else if ((symbol->symbology == BARCODE_POSTNET) || (symbol->symbology == BARCODE_PLANET)) {
|
||||
/* The size of PostNet and PLANET are fized */
|
||||
render->width = 0.508 * GL_CONST * total_area_width_x;
|
||||
render->height = 2.921 * GL_CONST;
|
||||
}
|
||||
|
||||
else if (((symbol->symbology == BARCODE_AUSPOST) || (symbol->symbology == BARCODE_AUSREPLY)) ||
|
||||
((symbol->symbology == BARCODE_AUSROUTE) || (symbol->symbology == BARCODE_AUSREDIRECT))) {
|
||||
/* Australia Post use the same sizes as USPS */
|
||||
render->width = 0.508 * GL_CONST * total_area_width_x;
|
||||
render->height = 4.064 * GL_CONST;
|
||||
}
|
||||
|
||||
else if ((symbol->symbology == BARCODE_RM4SCC) || (symbol->symbology == BARCODE_KIX)) {
|
||||
/* Royal Mail and KIX Code uses 22 bars per inch */
|
||||
render->width = 0.577 * GL_CONST * total_area_width_x;
|
||||
|
176
backend/rss.c
176
backend/rss.c
@ -513,7 +513,7 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
}
|
||||
hrt[13] = itoc(check_digit);
|
||||
|
||||
uconcat(symbol->text, (unsigned char*) hrt);
|
||||
strcat((char*) symbol->text, hrt);
|
||||
}
|
||||
|
||||
if ((symbol->symbology == BARCODE_RSS14STACK) || (symbol->symbology == BARCODE_RSS14STACK_CC)) {
|
||||
@ -1041,7 +1041,7 @@ int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
hrt[13] = itoc(check_digit);
|
||||
hrt[14] = '\0';
|
||||
|
||||
uconcat(symbol->text, (unsigned char*) hrt);
|
||||
strcat((char*) symbol->text, hrt);
|
||||
|
||||
return error_number;
|
||||
}
|
||||
@ -1270,12 +1270,12 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
/* (01) and (3202)/(3203) */
|
||||
|
||||
if (source[19] == '3') {
|
||||
weight = atof(weight_str) / 1000.0;
|
||||
weight = (float) (atof(weight_str) / 1000.0F);
|
||||
if (weight <= 22.767) {
|
||||
encoding_method = 4;
|
||||
}
|
||||
} else {
|
||||
weight = atof(weight_str) / 100.0;
|
||||
weight = (float) (atof(weight_str) / 100.0F);
|
||||
if (weight <= 99.99) {
|
||||
encoding_method = 4;
|
||||
}
|
||||
@ -1325,46 +1325,46 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
}
|
||||
|
||||
switch (encoding_method) { /* Encoding method - Table 10 */
|
||||
case 1: concat(binary_string, "1XX");
|
||||
case 1: strcat(binary_string, "1XX");
|
||||
read_posn = 16;
|
||||
break;
|
||||
case 2: concat(binary_string, "00XX");
|
||||
case 2: strcat(binary_string, "00XX");
|
||||
read_posn = 0;
|
||||
break;
|
||||
case 3: concat(binary_string, "0100");
|
||||
case 3: strcat(binary_string, "0100");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 4: concat(binary_string, "0101");
|
||||
case 4: strcat(binary_string, "0101");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 5: concat(binary_string, "01100XX");
|
||||
case 5: strcat(binary_string, "01100XX");
|
||||
read_posn = 20;
|
||||
break;
|
||||
case 6: concat(binary_string, "01101XX");
|
||||
case 6: strcat(binary_string, "01101XX");
|
||||
read_posn = 23;
|
||||
break;
|
||||
case 7: concat(binary_string, "0111000");
|
||||
case 7: strcat(binary_string, "0111000");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 8: concat(binary_string, "0111001");
|
||||
case 8: strcat(binary_string, "0111001");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 9: concat(binary_string, "0111010");
|
||||
case 9: strcat(binary_string, "0111010");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 10: concat(binary_string, "0111011");
|
||||
case 10: strcat(binary_string, "0111011");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 11: concat(binary_string, "0111100");
|
||||
case 11: strcat(binary_string, "0111100");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 12: concat(binary_string, "0111101");
|
||||
case 12: strcat(binary_string, "0111101");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 13: concat(binary_string, "0111110");
|
||||
case 13: strcat(binary_string, "0111110");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
case 14: concat(binary_string, "0111111");
|
||||
case 14: strcat(binary_string, "0111111");
|
||||
read_posn = strlen(source);
|
||||
break;
|
||||
}
|
||||
@ -1399,7 +1399,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x08;
|
||||
for (j = 0; j < 4; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
|
||||
@ -1412,7 +1412,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x200;
|
||||
for (j = 0; j < 10; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1435,7 +1435,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x200;
|
||||
for (j = 0; j < 10; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1448,7 +1448,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x4000;
|
||||
for (j = 0; j < 15; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1469,7 +1469,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x200;
|
||||
for (j = 0; j < 10; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1486,7 +1486,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x4000;
|
||||
for (j = 0; j < 15; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1509,7 +1509,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x200;
|
||||
for (j = 0; j < 10; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1524,7 +1524,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x80000;
|
||||
for (j = 0; j < 20; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
|
||||
@ -1548,7 +1548,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x8000;
|
||||
for (j = 0; j < 16; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1567,19 +1567,19 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x200;
|
||||
for (j = 0; j < 10; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (source[19]) {
|
||||
case '0': concat(binary_string, "00");
|
||||
case '0': strcat(binary_string, "00");
|
||||
break;
|
||||
case '1': concat(binary_string, "01");
|
||||
case '1': strcat(binary_string, "01");
|
||||
break;
|
||||
case '2': concat(binary_string, "10");
|
||||
case '2': strcat(binary_string, "10");
|
||||
break;
|
||||
case '3': concat(binary_string, "11");
|
||||
case '3': strcat(binary_string, "11");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1601,19 +1601,19 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x200;
|
||||
for (j = 0; j < 10; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (source[19]) {
|
||||
case '0': concat(binary_string, "00");
|
||||
case '0': strcat(binary_string, "00");
|
||||
break;
|
||||
case '1': concat(binary_string, "01");
|
||||
case '1': strcat(binary_string, "01");
|
||||
break;
|
||||
case '2': concat(binary_string, "10");
|
||||
case '2': strcat(binary_string, "10");
|
||||
break;
|
||||
case '3': concat(binary_string, "11");
|
||||
case '3': strcat(binary_string, "11");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1625,7 +1625,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x200;
|
||||
for (j = 0; j < 10; j++) {
|
||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1734,12 +1734,12 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
/* Set initial mode if not NUMERIC */
|
||||
if (general_field_type[0] == ALPHA) {
|
||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
last_mode = ALPHA;
|
||||
}
|
||||
if (general_field_type[0] == ISOIEC) {
|
||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
last_mode = ISOIEC;
|
||||
}
|
||||
|
||||
@ -1751,7 +1751,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
if (debug) printf("as NUMERIC:");
|
||||
|
||||
if (last_mode != NUMERIC) {
|
||||
concat(binary_string, "000"); /* Numeric latch */
|
||||
strcat(binary_string, "000"); /* Numeric latch */
|
||||
if (debug) printf("<NUMERIC LATCH>\n");
|
||||
}
|
||||
|
||||
@ -1772,7 +1772,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x40;
|
||||
for (j = 0; j < 7; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
if (debug) {
|
||||
printf("%d", !!(value & mask));
|
||||
}
|
||||
@ -1788,10 +1788,10 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
if (debug) printf("as ALPHA\n");
|
||||
if (i != 0) {
|
||||
if (last_mode == NUMERIC) {
|
||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
}
|
||||
if (last_mode == ISOIEC) {
|
||||
concat(binary_string, "00100"); /* Alphanumeric latch */
|
||||
strcat(binary_string, "00100"); /* Alphanumeric latch */
|
||||
}
|
||||
}
|
||||
|
||||
@ -1801,7 +1801,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1812,21 +1812,21 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x20;
|
||||
for (j = 0; j < 6; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
last_mode = ALPHA;
|
||||
if (general_field[i] == '[') {
|
||||
concat(binary_string, "01111");
|
||||
strcat(binary_string, "01111");
|
||||
last_mode = NUMERIC;
|
||||
} /* FNC1/Numeric latch */
|
||||
if (general_field[i] == '*') concat(binary_string, "111010"); /* asterisk */
|
||||
if (general_field[i] == ',') concat(binary_string, "111011"); /* comma */
|
||||
if (general_field[i] == '-') concat(binary_string, "111100"); /* minus or hyphen */
|
||||
if (general_field[i] == '.') concat(binary_string, "111101"); /* period or full stop */
|
||||
if (general_field[i] == '/') concat(binary_string, "111110"); /* slash or solidus */
|
||||
if (general_field[i] == '*') strcat(binary_string, "111010"); /* asterisk */
|
||||
if (general_field[i] == ',') strcat(binary_string, "111011"); /* comma */
|
||||
if (general_field[i] == '-') strcat(binary_string, "111100"); /* minus or hyphen */
|
||||
if (general_field[i] == '.') strcat(binary_string, "111101"); /* period or full stop */
|
||||
if (general_field[i] == '/') strcat(binary_string, "111110"); /* slash or solidus */
|
||||
|
||||
i++;
|
||||
break;
|
||||
@ -1835,11 +1835,11 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
if (debug) printf("as ISOIEC\n");
|
||||
if (i != 0) {
|
||||
if (last_mode == NUMERIC) {
|
||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
}
|
||||
if (last_mode == ALPHA) {
|
||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||
}
|
||||
}
|
||||
|
||||
@ -1849,7 +1849,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1860,7 +1860,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x40;
|
||||
for (j = 0; j < 7; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1871,37 +1871,37 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x40;
|
||||
for (j = 0; j < 7; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
last_mode = ISOIEC;
|
||||
if (general_field[i] == '[') {
|
||||
concat(binary_string, "01111");
|
||||
strcat(binary_string, "01111");
|
||||
last_mode = NUMERIC;
|
||||
} /* FNC1/Numeric latch */
|
||||
if (general_field[i] == '!') concat(binary_string, "11101000"); /* exclamation mark */
|
||||
if (general_field[i] == 34) concat(binary_string, "11101001"); /* quotation mark */
|
||||
if (general_field[i] == 37) concat(binary_string, "11101010"); /* percent sign */
|
||||
if (general_field[i] == '&') concat(binary_string, "11101011"); /* ampersand */
|
||||
if (general_field[i] == 39) concat(binary_string, "11101100"); /* apostrophe */
|
||||
if (general_field[i] == '(') concat(binary_string, "11101101"); /* left parenthesis */
|
||||
if (general_field[i] == ')') concat(binary_string, "11101110"); /* right parenthesis */
|
||||
if (general_field[i] == '*') concat(binary_string, "11101111"); /* asterisk */
|
||||
if (general_field[i] == '+') concat(binary_string, "11110000"); /* plus sign */
|
||||
if (general_field[i] == ',') concat(binary_string, "11110001"); /* comma */
|
||||
if (general_field[i] == '-') concat(binary_string, "11110010"); /* minus or hyphen */
|
||||
if (general_field[i] == '.') concat(binary_string, "11110011"); /* period or full stop */
|
||||
if (general_field[i] == '/') concat(binary_string, "11110100"); /* slash or solidus */
|
||||
if (general_field[i] == ':') concat(binary_string, "11110101"); /* colon */
|
||||
if (general_field[i] == ';') concat(binary_string, "11110110"); /* semicolon */
|
||||
if (general_field[i] == '<') concat(binary_string, "11110111"); /* less-than sign */
|
||||
if (general_field[i] == '=') concat(binary_string, "11111000"); /* equals sign */
|
||||
if (general_field[i] == '>') concat(binary_string, "11111001"); /* greater-than sign */
|
||||
if (general_field[i] == '?') concat(binary_string, "11111010"); /* question mark */
|
||||
if (general_field[i] == '_') concat(binary_string, "11111011"); /* underline or low line */
|
||||
if (general_field[i] == ' ') concat(binary_string, "11111100"); /* space */
|
||||
if (general_field[i] == '!') strcat(binary_string, "11101000"); /* exclamation mark */
|
||||
if (general_field[i] == 34) strcat(binary_string, "11101001"); /* quotation mark */
|
||||
if (general_field[i] == 37) strcat(binary_string, "11101010"); /* percent sign */
|
||||
if (general_field[i] == '&') strcat(binary_string, "11101011"); /* ampersand */
|
||||
if (general_field[i] == 39) strcat(binary_string, "11101100"); /* apostrophe */
|
||||
if (general_field[i] == '(') strcat(binary_string, "11101101"); /* left parenthesis */
|
||||
if (general_field[i] == ')') strcat(binary_string, "11101110"); /* right parenthesis */
|
||||
if (general_field[i] == '*') strcat(binary_string, "11101111"); /* asterisk */
|
||||
if (general_field[i] == '+') strcat(binary_string, "11110000"); /* plus sign */
|
||||
if (general_field[i] == ',') strcat(binary_string, "11110001"); /* comma */
|
||||
if (general_field[i] == '-') strcat(binary_string, "11110010"); /* minus or hyphen */
|
||||
if (general_field[i] == '.') strcat(binary_string, "11110011"); /* period or full stop */
|
||||
if (general_field[i] == '/') strcat(binary_string, "11110100"); /* slash or solidus */
|
||||
if (general_field[i] == ':') strcat(binary_string, "11110101"); /* colon */
|
||||
if (general_field[i] == ';') strcat(binary_string, "11110110"); /* semicolon */
|
||||
if (general_field[i] == '<') strcat(binary_string, "11110111"); /* less-than sign */
|
||||
if (general_field[i] == '=') strcat(binary_string, "11111000"); /* equals sign */
|
||||
if (general_field[i] == '>') strcat(binary_string, "11111001"); /* greater-than sign */
|
||||
if (general_field[i] == '?') strcat(binary_string, "11111010"); /* question mark */
|
||||
if (general_field[i] == '_') strcat(binary_string, "11111011"); /* underline or low line */
|
||||
if (general_field[i] == ' ') strcat(binary_string, "11111100"); /* space */
|
||||
|
||||
i++;
|
||||
break;
|
||||
@ -1929,7 +1929,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x08;
|
||||
for (j = 0; j < 4; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
} else {
|
||||
@ -1940,7 +1940,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x40;
|
||||
for (j = 0; j < 7; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1949,7 +1949,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
|
||||
mask = 0x10;
|
||||
for (j = 0; j < 5; j++) {
|
||||
concat(binary_string, (value & mask) ? "1" : "0");
|
||||
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
@ -1979,11 +1979,11 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
strcpy(padstring, "");
|
||||
}
|
||||
for (; i > 0; i -= 5) {
|
||||
concat(padstring, "00100");
|
||||
strcat(padstring, "00100");
|
||||
}
|
||||
|
||||
padstring[remainder] = '\0';
|
||||
concat(binary_string, padstring);
|
||||
strcat(binary_string, padstring);
|
||||
|
||||
/* Patch variable length symbol bit field */
|
||||
d1 = ((strlen(binary_string) / 12) + 1) & 1;
|
||||
@ -2047,9 +2047,9 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
strcpy(binary_string, "");
|
||||
|
||||
if (symbol->option_1 == 2) {
|
||||
concat(binary_string, "1");
|
||||
strcat(binary_string, "1");
|
||||
} else {
|
||||
concat(binary_string, "0");
|
||||
strcat(binary_string, "0");
|
||||
}
|
||||
|
||||
i = rss_binary_string(symbol, reduced, binary_string);
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "common.h"
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
@ -178,9 +179,9 @@ int svg_plot(struct zint_symbol *symbol) {
|
||||
fprintf(fsvg, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n");
|
||||
fprintf(fsvg, " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
|
||||
if (symbol->symbology != BARCODE_MAXICODE) {
|
||||
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", roundup((symbol->width + xoffset + xoffset) * scaler), roundup((symbol->height + textoffset + yoffset + yoffset) * scaler));
|
||||
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler));
|
||||
} else {
|
||||
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", roundup((74.0 + xoffset + xoffset) * scaler), roundup((72.0 + yoffset + yoffset) * scaler));
|
||||
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler));
|
||||
}
|
||||
fprintf(fsvg, " xmlns=\"http://www.w3.org/2000/svg\">\n");
|
||||
if (ustrlen(symbol->text) != 0) {
|
||||
@ -192,9 +193,9 @@ int svg_plot(struct zint_symbol *symbol) {
|
||||
fprintf(fsvg, "\n <g id=\"barcode\" fill=\"#%s\">\n", symbol->fgcolour);
|
||||
|
||||
if (symbol->symbology != BARCODE_MAXICODE) {
|
||||
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", roundup((symbol->width + xoffset + xoffset) * scaler), roundup((symbol->height + textoffset + yoffset + yoffset) * scaler), symbol->bgcolour);
|
||||
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler), symbol->bgcolour);
|
||||
} else {
|
||||
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", roundup((74.0 + xoffset + xoffset) * scaler), roundup((72.0 + yoffset + yoffset) * scaler), symbol->bgcolour);
|
||||
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler), symbol->bgcolour);
|
||||
}
|
||||
|
||||
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
|
||||
|
@ -78,7 +78,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
concat(dest, TeleTable[source[i]]);
|
||||
strcat(dest, TeleTable[source[i]]);
|
||||
count += source[i];
|
||||
}
|
||||
|
||||
@ -86,10 +86,10 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
if (check_digit == 127) {
|
||||
check_digit = 0;
|
||||
}
|
||||
concat(dest, TeleTable[check_digit]);
|
||||
strcat(dest, TeleTable[check_digit]);
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, TeleTable['z']);
|
||||
strcat(dest, TeleTable['z']);
|
||||
|
||||
expand(symbol, dest);
|
||||
for (i = 0; i < src_len; i++) {
|
||||
@ -149,17 +149,17 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
glyph += 27;
|
||||
count += glyph;
|
||||
}
|
||||
concat(dest, TeleTable[glyph]);
|
||||
strcat(dest, TeleTable[glyph]);
|
||||
}
|
||||
|
||||
check_digit = 127 - (count % 127);
|
||||
if (check_digit == 127) {
|
||||
check_digit = 0;
|
||||
}
|
||||
concat(dest, TeleTable[check_digit]);
|
||||
strcat(dest, TeleTable[check_digit]);
|
||||
|
||||
/* Stop character */
|
||||
concat(dest, TeleTable['z']);
|
||||
strcat(dest, TeleTable['z']);
|
||||
|
||||
expand(symbol, dest);
|
||||
ustrcpy(symbol->text, temp);
|
||||
|
@ -107,20 +107,20 @@ void upca_draw(char source[], char dest[]) {
|
||||
half_way = strlen(source) / 2;
|
||||
|
||||
/* start character */
|
||||
concat(dest, "111");
|
||||
strcat(dest, "111");
|
||||
|
||||
for (i = 0; i <= strlen(source); i++) {
|
||||
if (i == half_way) {
|
||||
/* middle character - separates manufacturer no. from product no. */
|
||||
/* also inverts right hand characters */
|
||||
concat(dest, "11111");
|
||||
strcat(dest, "11111");
|
||||
}
|
||||
|
||||
lookup(NEON, EANsetA, source[i], dest);
|
||||
}
|
||||
|
||||
/* stop character */
|
||||
concat(dest, "111");
|
||||
strcat(dest, "111");
|
||||
}
|
||||
|
||||
/* Make a UPC A barcode when we haven't been given the check digit */
|
||||
@ -162,7 +162,7 @@ void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
num_system = 0;
|
||||
hrt[0] = '0';
|
||||
hrt[1] = '\0';
|
||||
concat(hrt, (char*) source);
|
||||
strcat(hrt, (char*) source);
|
||||
}
|
||||
|
||||
/* Expand the zero-compressed UPCE code to make a UPCA equivalent (EN Table 5) */
|
||||
@ -234,7 +234,7 @@ void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
/* Take all this information and make the barcode pattern */
|
||||
|
||||
/* start character */
|
||||
concat(dest, "111");
|
||||
strcat(dest, "111");
|
||||
|
||||
for (i = 0; i <= ustrlen(source); i++) {
|
||||
switch (parity[i]) {
|
||||
@ -246,7 +246,7 @@ void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
}
|
||||
|
||||
/* stop character */
|
||||
concat(dest, "111111");
|
||||
strcat(dest, "111111");
|
||||
|
||||
hrt[7] = check_digit;
|
||||
hrt[8] = '\0';
|
||||
@ -260,11 +260,11 @@ void add_on(unsigned char source[], char dest[], int mode) {
|
||||
|
||||
/* If an add-on then append with space */
|
||||
if (mode != 0) {
|
||||
concat(dest, "9");
|
||||
strcat(dest, "9");
|
||||
}
|
||||
|
||||
/* Start character */
|
||||
concat(dest, "112");
|
||||
strcat(dest, "112");
|
||||
|
||||
/* Determine EAN2 or EAN5 add-on */
|
||||
if (ustrlen(source) == 2) {
|
||||
@ -306,12 +306,13 @@ void add_on(unsigned char source[], char dest[], int mode) {
|
||||
|
||||
/* Glyph separator */
|
||||
if (i != (ustrlen(source) - 1)) {
|
||||
concat(dest, "11");
|
||||
strcat(dest, "11");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************ EAN-13 ****************** */
|
||||
|
||||
/* Calculate the correct check digit for a EAN-13 barcode */
|
||||
char ean_check(char source[]) {
|
||||
int i;
|
||||
@ -354,13 +355,13 @@ void ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
half_way = 7;
|
||||
|
||||
/* start character */
|
||||
concat(dest, "111");
|
||||
strcat(dest, "111");
|
||||
length = strlen(gtin);
|
||||
for (i = 1; i <= length; i++) {
|
||||
if (i == half_way) {
|
||||
/* middle character - separates manufacturer no. from product no. */
|
||||
/* also inverses right hand characters */
|
||||
concat(dest, "11111");
|
||||
strcat(dest, "11111");
|
||||
}
|
||||
|
||||
if (((i > 1) && (i < 7)) && (parity[i - 2] == 'B')) {
|
||||
@ -371,7 +372,7 @@ void ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
}
|
||||
|
||||
/* stop character */
|
||||
concat(dest, "111");
|
||||
strcat(dest, "111");
|
||||
|
||||
ustrcpy(symbol->text, (unsigned char*) gtin);
|
||||
}
|
||||
@ -599,19 +600,19 @@ void ean_leading_zeroes(struct zint_symbol *symbol, unsigned char source[], unsi
|
||||
|
||||
/* Add leading zeroes */
|
||||
for (i = 0; i < (zfirst_len - first_len); i++) {
|
||||
uconcat(zfirst_part, (unsigned char *) "0");
|
||||
strcat((char*) zfirst_part, "0");
|
||||
}
|
||||
uconcat(zfirst_part, first_part);
|
||||
strcat((char*) zfirst_part, (char*) first_part);
|
||||
for (i = 0; i < (zsecond_len - second_len); i++) {
|
||||
uconcat(zsecond_part, (unsigned char *) "0");
|
||||
strcat((char*) zsecond_part, "0");
|
||||
}
|
||||
uconcat(zsecond_part, second_part);
|
||||
strcat((char*) zsecond_part, (char*) second_part);
|
||||
|
||||
/* Copy adjusted data back to local_source */
|
||||
uconcat(local_source, zfirst_part);
|
||||
strcat((char*) local_source, (char*) zfirst_part);
|
||||
if (zsecond_len != 0) {
|
||||
uconcat(local_source, (unsigned char *) "+");
|
||||
uconcat(local_source, zsecond_part);
|
||||
strcat((char*) local_source, "+");
|
||||
strcat((char*) local_source, (char*) zsecond_part);
|
||||
}
|
||||
}
|
||||
|
||||
@ -794,13 +795,13 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
case 0: break;
|
||||
case 2:
|
||||
add_on(second_part, (char*) dest, 1);
|
||||
uconcat(symbol->text, (unsigned char*) "+");
|
||||
uconcat(symbol->text, second_part);
|
||||
strcat((char*) symbol->text, "+");
|
||||
strcat((char*) symbol->text, (char*) second_part);
|
||||
break;
|
||||
case 5:
|
||||
add_on(second_part, (char*) dest, 1);
|
||||
uconcat(symbol->text, (unsigned char*) "+");
|
||||
uconcat(symbol->text, second_part);
|
||||
strcat((char*) symbol->text, "+");
|
||||
strcat((char*) symbol->text, (char*) second_part);
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "Invalid length input");
|
||||
|
Loading…
Reference in New Issue
Block a user