mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-28 22:14:19 -04:00
Remove error correction bug for Australia Post symbols
Bug found by Milton Neal <miltonneal@bigpond.com>
This commit is contained in:
parent
749eb55321
commit
57075248ff
1 changed files with 2 additions and 6 deletions
|
@ -70,7 +70,7 @@ static inline char convert_pattern(char data, int shift) {
|
||||||
/* Adds Reed-Solomon error correction to auspost */
|
/* Adds Reed-Solomon error correction to auspost */
|
||||||
void rs_error(char data_pattern[]) {
|
void rs_error(char data_pattern[]) {
|
||||||
size_t reader, triple_writer = 0;
|
size_t reader, triple_writer = 0;
|
||||||
char triple[31], inv_triple[31];
|
char triple[31];
|
||||||
unsigned char result[5];
|
unsigned char result[5];
|
||||||
|
|
||||||
for (reader = 2; reader < strlen(data_pattern); reader += 3, triple_writer++) {
|
for (reader = 2; reader < strlen(data_pattern); reader += 3, triple_writer++) {
|
||||||
|
@ -79,13 +79,9 @@ void rs_error(char data_pattern[]) {
|
||||||
+ convert_pattern(data_pattern[reader + 2], 0);
|
+ convert_pattern(data_pattern[reader + 2], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (reader = 0; reader < triple_writer; reader++) {
|
|
||||||
inv_triple[reader] = triple[(triple_writer - 1) - reader];
|
|
||||||
}
|
|
||||||
|
|
||||||
rs_init_gf(0x43);
|
rs_init_gf(0x43);
|
||||||
rs_init_code(4, 1);
|
rs_init_code(4, 1);
|
||||||
rs_encode(triple_writer, (unsigned char*) inv_triple, result);
|
rs_encode(triple_writer, (unsigned char*) triple, result);
|
||||||
|
|
||||||
for (reader = 4; reader > 0; reader--) {
|
for (reader = 4; reader > 0; reader--) {
|
||||||
strcat(data_pattern, AusBarTable[(int) result[reader - 1]]);
|
strcat(data_pattern, AusBarTable[(int) result[reader - 1]]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue