mirror of
https://git.code.sf.net/p/zint/code
synced 2025-06-08 02:14:53 -04:00
Pad only with character 109 when finishing in binary mode
Bug report by Milton Neil
This commit is contained in:
parent
a77e448df5
commit
025a485ddf
1 changed files with 9 additions and 4 deletions
|
@ -363,7 +363,7 @@ int binary(const unsigned char source[], int position, int length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Analyse input data stream and encode using algorithm from Annex F */
|
/* Analyse input data stream and encode using algorithm from Annex F */
|
||||||
int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char *codeword_array) {
|
int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char *codeword_array, int *binary_finish) {
|
||||||
int input_position, array_length, i;
|
int input_position, array_length, i;
|
||||||
char encoding_mode;
|
char encoding_mode;
|
||||||
int inside_macro, done;
|
int inside_macro, done;
|
||||||
|
@ -880,6 +880,10 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (input_position < length);
|
} while (input_position < length);
|
||||||
|
|
||||||
|
if (encoding_mode == 'X') {
|
||||||
|
*(binary_finish) = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
|
@ -1045,6 +1049,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
|
||||||
int weight;
|
int weight;
|
||||||
size_t dot_stream_length;
|
size_t dot_stream_length;
|
||||||
int high_score, best_mask;
|
int high_score, best_mask;
|
||||||
|
int binary_finish = 0;
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
@ -1057,7 +1062,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
|
||||||
unsigned char* masked_codeword_array = (unsigned char *) _alloca(length * 3 * sizeof (unsigned char));
|
unsigned char* masked_codeword_array = (unsigned char *) _alloca(length * 3 * sizeof (unsigned char));
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
data_length = dotcode_encode_message(symbol, source, length, codeword_array);
|
data_length = dotcode_encode_message(symbol, source, length, codeword_array, &binary_finish);
|
||||||
|
|
||||||
ecc_length = 3 + (data_length / 2);
|
ecc_length = 3 + (data_length / 2);
|
||||||
|
|
||||||
|
@ -1138,8 +1143,8 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
|
||||||
|
|
||||||
/* Add pad characters */
|
/* Add pad characters */
|
||||||
for (pad_chars = 0; 9 * ((data_length + pad_chars + 3 + ((data_length + pad_chars) / 2)) + 2) < n_dots; pad_chars++);
|
for (pad_chars = 0; 9 * ((data_length + pad_chars + 3 + ((data_length + pad_chars) / 2)) + 2) < n_dots; pad_chars++);
|
||||||
|
|
||||||
if (pad_chars > 0) {
|
if ((pad_chars > 0) && (binary_finish == 1)) {
|
||||||
codeword_array[data_length] = 109; // Latch to Code Set A
|
codeword_array[data_length] = 109; // Latch to Code Set A
|
||||||
data_length++;
|
data_length++;
|
||||||
pad_chars--;
|
pad_chars--;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue