Minor bugfixes

This commit is contained in:
hooper114 2009-05-17 09:27:43 +00:00
parent 4c05da75c7
commit fe162c7170
5 changed files with 31 additions and 27 deletions

View File

@ -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

View File

@ -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)];
@ -1847,16 +1848,18 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
}
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++) {
@ -1872,7 +1875,6 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
symbol->rows += linear->rows;
ustrcpy(symbol->text, (unsigned char *)linear->text);
ZBarcode_Delete(linear);
return error_number;

View File

@ -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,13 +667,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(x12_p == 1) {
target[tp] = 254; tp++; /* unlatch */
target[tp] = source[inputlen - 1] + 1; tp++;
concat(binary, " ");
concat(binary, " ");
current_mode = DM_ASCII;
}

View File

@ -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++) {

View File

@ -511,12 +511,13 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[])
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 */
}