Unlatch EDIFACT encodation when buffer is empty

bug report and patch by brunt, ticket #46
This commit is contained in:
Robin Stuart 2016-11-26 11:28:43 +00:00
parent 6af035ba98
commit 1d503c54fe

View File

@ -1063,7 +1063,16 @@ static int dm200encode_remainder(unsigned char target[], int target_length, cons
target_length++;
}
} else {
// Append edifact unlatch value (31) and encode as triple.
// Append edifact unlatch value (31) and encode as triple
if (process_p == 0) {
target[target_length] = (unsigned char) (31 << 2);
target_length++;
target[target_length] = 0;
target_length++;
target[target_length] = 0;
target_length++;
}
if (process_p == 1) {
target[target_length] = (unsigned char) ((process_buffer[0] << 2) + ((31 & 0x30) >> 4));