mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Minor bugfixes
This commit is contained in:
parent
4c05da75c7
commit
fe162c7170
@ -46,6 +46,10 @@ code.c:
|
||||
Extended Code 39 (Code 39+)
|
||||
Code 93
|
||||
LOGMARS
|
||||
Channel Code
|
||||
|
||||
code49.c:
|
||||
Code 49
|
||||
|
||||
composite.c:
|
||||
CC-A Composite Symbology
|
||||
|
@ -696,7 +696,8 @@ int cc_c(struct zint_symbol *symbol, unsigned char source[], int cc_width, int e
|
||||
int cc_binary_string(struct zint_symbol *symbol, char source[], char binary_string[], int cc_mode, int *cc_width, int *ecc, int lin_width)
|
||||
{ /* Handles all data encodation from section 5 of ISO/IEC 24723 */
|
||||
int encoding_method, read_posn, d1, d2, value, alpha_pad;
|
||||
int group_val, i, j, mask, ai_crop, ai_crop_posn, fnc1_latch;
|
||||
int i, j, mask, ai_crop, ai_crop_posn, fnc1_latch;
|
||||
long int group_val;
|
||||
int ai90_mode, latch, remainder, binary_length;
|
||||
char date_str[4];
|
||||
char general_field[strlen(source)], general_field_type[strlen(source)];
|
||||
@ -722,7 +723,7 @@ int cc_binary_string(struct zint_symbol *symbol, char source[], char binary_stri
|
||||
/* Source starts (90) */
|
||||
encoding_method = 3;
|
||||
}
|
||||
|
||||
|
||||
if(encoding_method == 1) {
|
||||
concat(binary_string, "0");
|
||||
}
|
||||
@ -1678,7 +1679,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
|
||||
char binary_string[10 * ustrlen(source)];
|
||||
struct zint_symbol *linear;
|
||||
int top_shift, bottom_shift;
|
||||
|
||||
|
||||
error_number = 0;
|
||||
separator_row = 0;
|
||||
|
||||
@ -1790,13 +1791,13 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
|
||||
return ERROR_TOO_LONG;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch(cc_mode) { /* Note that ecc_level is only relevant to CC-C */
|
||||
case 1: error_number = cc_a(symbol, (unsigned char*)binary_string, cc_width); break;
|
||||
case 2: error_number = cc_b(symbol, (unsigned char*)binary_string, cc_width); break;
|
||||
case 3: error_number = cc_c(symbol, (unsigned char*)binary_string, cc_width, ecc_level); break;
|
||||
}
|
||||
|
||||
|
||||
if(error_number != 0) {
|
||||
return ERROR_ENCODING_PROBLEM;
|
||||
}
|
||||
@ -1845,18 +1846,20 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
|
||||
top_shift = k;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(top_shift != 0) {
|
||||
/* Move the 2d component of the symbol horizontally */
|
||||
for(i = 0; i <= symbol->rows; i++) {
|
||||
for(j = (symbol->width + top_shift); j >= top_shift; j--) {
|
||||
symbol->encoded_data[i][j] = symbol->encoded_data[i][j - top_shift];
|
||||
}
|
||||
for(j = 0; j < top_shift; j++) {
|
||||
symbol->encoded_data[i][j] = 0;
|
||||
symbol->encoded_data[i][j] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Merge linear and 2D components into one structure */
|
||||
for(i = 0; i <= linear->rows; i++) {
|
||||
symbol->row_height[symbol->rows + i] = linear->row_height[i];
|
||||
for(j = 0; j <= linear->width; j++) {
|
||||
@ -1871,7 +1874,6 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
|
||||
}
|
||||
symbol->rows += linear->rows;
|
||||
ustrcpy(symbol->text, (unsigned char *)linear->text);
|
||||
|
||||
|
||||
ZBarcode_Delete(linear);
|
||||
|
||||
|
@ -386,7 +386,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
|
||||
if(symbol->input_mode == GS1_MODE) { gs1 = 1; } else { gs1 = 0; }
|
||||
|
||||
if(gs1) { target[tp] = 232; tp++; } /* FNC1 */
|
||||
if(gs1) { target[tp] = 232; tp++; concat(binary, " "); } /* FNC1 */
|
||||
|
||||
while (sp < inputlen) {
|
||||
|
||||
@ -442,7 +442,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
}
|
||||
|
||||
if(next_mode != DM_C40) {
|
||||
target[tp] = 254; tp++; /* Unlatch */
|
||||
target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */
|
||||
} else {
|
||||
if(source[sp] > 127) {
|
||||
c40_buffer[c40_p] = 1; c40_p++;
|
||||
@ -494,7 +494,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
}
|
||||
|
||||
if(next_mode != DM_TEXT) {
|
||||
target[tp] = 254; tp++; /* Unlatch */
|
||||
target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */
|
||||
} else {
|
||||
if(source[sp] > 127) {
|
||||
text_buffer[text_p] = 1; text_p++;
|
||||
@ -546,7 +546,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
}
|
||||
|
||||
if(next_mode != DM_X12) {
|
||||
target[tp] = 254; tp++; /* Unlatch */
|
||||
target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */
|
||||
} else {
|
||||
if(source[sp] == 13) { value = 0; }
|
||||
if(source[sp] == '*') { value = 1; }
|
||||
@ -639,13 +639,13 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
target[tp] = 254; tp++; /* unlatch */
|
||||
target[tp] = source[inputlen - 2] + 1; tp++;
|
||||
target[tp] = source[inputlen - 1] + 1; tp++;
|
||||
concat(binary, " ");
|
||||
concat(binary, " ");
|
||||
current_mode = DM_ASCII;
|
||||
}
|
||||
if(c40_p == 1) {
|
||||
target[tp] = 254; tp++; /* unlatch */
|
||||
target[tp] = source[inputlen - 1] + 1; tp++;
|
||||
concat(binary, " ");
|
||||
concat(binary, " ");
|
||||
current_mode = DM_ASCII;
|
||||
}
|
||||
|
||||
@ -653,13 +653,13 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
target[tp] = 254; tp++; /* unlatch */
|
||||
target[tp] = source[inputlen - 2] + 1; tp++;
|
||||
target[tp] = source[inputlen - 1] + 1; tp++;
|
||||
concat(binary, " ");
|
||||
concat(binary, " ");
|
||||
current_mode = DM_ASCII;
|
||||
}
|
||||
if(text_p == 1) {
|
||||
target[tp] = 254; tp++; /* unlatch */
|
||||
target[tp] = source[inputlen - 1] + 1; tp++;
|
||||
concat(binary, " ");
|
||||
concat(binary, " ");
|
||||
current_mode = DM_ASCII;
|
||||
}
|
||||
|
||||
@ -667,16 +667,16 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
target[tp] = 254; tp++; /* unlatch */
|
||||
target[tp] = source[inputlen - 2] + 1; tp++;
|
||||
target[tp] = source[inputlen - 1] + 1; tp++;
|
||||
concat(binary, " ");
|
||||
concat(binary, " ");
|
||||
current_mode = DM_ASCII;
|
||||
}
|
||||
if(x12_p == 1) {
|
||||
target[tp] = 254; tp++; /* unlatch */
|
||||
target[tp] = source[inputlen - 1] + 1; tp++;
|
||||
concat(binary, " ");
|
||||
concat(binary, " ");
|
||||
current_mode = DM_ASCII;
|
||||
}
|
||||
|
||||
|
||||
/* Add length and randomising algorithm to b256 */
|
||||
i = 0;
|
||||
while (i < tp) {
|
||||
|
@ -822,14 +822,11 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle)
|
||||
|
||||
/* Put boundary bars or box around symbol */
|
||||
if(((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
|
||||
printf("1st\n");
|
||||
if((symbol->symbology != BARCODE_CODABLOCKF) && (symbol->symbology != BARCODE_HIBC_BLOCKF)) {
|
||||
printf("2nd\n");
|
||||
/* boundary bars */
|
||||
draw_bar(pixelbuf, 0, (symbol->width + xoffset + xoffset) * scaler, textoffset * scaler, symbol->border_width * scaler, image_width, image_height);
|
||||
draw_bar(pixelbuf, 0, (symbol->width + xoffset + xoffset) * scaler, (textoffset + symbol->height + symbol->border_width) * scaler, symbol->border_width * scaler, image_width, image_height);
|
||||
if((symbol->output_options & BARCODE_BIND) != 0) {
|
||||
printf("3rd\n");
|
||||
if((symbol->rows > 1) && (is_stackable(symbol->symbology) == 1)) {
|
||||
/* row binding */
|
||||
for(r = 1; r < symbol->rows; r++) {
|
||||
|
@ -507,16 +507,17 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[])
|
||||
char local_source[input_length];
|
||||
inter_posn = 0;
|
||||
error_number = 0;
|
||||
|
||||
|
||||
strcpy(local_source, (char*)source);
|
||||
to_upper((unsigned char*)local_source);
|
||||
error_number = is_sane(SHKASUTSET, (unsigned char*)local_source);
|
||||
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
|
||||
for(i = 0; i < (inter_length * 2); i++) {
|
||||
for(i = 0; i < inter_length; i++) {
|
||||
inter[i] = 'd'; /* Pad character CC4 */
|
||||
}
|
||||
|
||||
@ -542,7 +543,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strcpy(pattern, "13"); /* Start */
|
||||
|
||||
sum = 0;
|
||||
@ -551,7 +552,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[])
|
||||
sum += posn(CHKASUTSET, inter[i]);
|
||||
/* printf("%c (%d)\n", inter[i], posn(CHKASUTSET, inter[i])); */
|
||||
}
|
||||
|
||||
|
||||
/* Calculate check digit */
|
||||
check = 19 - (sum % 19);
|
||||
if(check == 19) { check = 0; }
|
||||
|
Loading…
Reference in New Issue
Block a user