mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Unlatch X12 encodation when there are 2 codewords left in the buffer
bug report by brunt, ticket #45
This commit is contained in:
parent
dc36261030
commit
6af035ba98
@ -1026,27 +1026,14 @@ static int dm200encode_remainder(unsigned char target[], int target_length, cons
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DM_X12:
|
case DM_X12:
|
||||||
if (symbols_left == process_p) // Unlatch not required!
|
if ((symbols_left == process_p) && (process_p == 1)) {
|
||||||
{
|
// Unlatch not required!
|
||||||
if (process_p == 1) // 1 data character left to encode.
|
target[target_length] = source[inputlen - 1] + 1;
|
||||||
{
|
target_length++;
|
||||||
target[target_length] = source[inputlen - 1] + 1;
|
} else {
|
||||||
target_length++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process_p == 2) {
|
|
||||||
// Encode last 2 bytes as ascii.
|
|
||||||
target[target_length] = source[inputlen - 2] + 1;
|
|
||||||
target_length++;
|
|
||||||
target[target_length] = source[inputlen - 1] + 1;
|
|
||||||
target_length++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (symbols_left > process_p) // Unlatch and encode remaining data in ascii.
|
|
||||||
{
|
|
||||||
target[target_length] = (254);
|
target[target_length] = (254);
|
||||||
target_length++; // Unlatch.
|
target_length++; // Unlatch.
|
||||||
|
|
||||||
if (process_p == 1) {
|
if (process_p == 1) {
|
||||||
target[target_length] = source[inputlen - 1] + 1;
|
target[target_length] = source[inputlen - 1] + 1;
|
||||||
target_length++;
|
target_length++;
|
||||||
|
Loading…
Reference in New Issue
Block a user