mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Fix of by one errors when searching from right to left.
This commit is contained in:
parent
4561a66067
commit
9553e96f8a
@ -220,7 +220,7 @@ static int aztec_text_process(const unsigned char source[], const unsigned int s
|
||||
}
|
||||
|
||||
/* look for adjacent blocks which can use the same table (right to left search) */
|
||||
for (i = blocks - 1; i > 0; i--) {
|
||||
for (i = blocks - 1 - 1; i >= 0; i--) {
|
||||
if (blockmap[0][i] & blockmap[0][i + 1]) {
|
||||
blockmap[0][i] = (blockmap[0][i] & blockmap[0][i + 1]);
|
||||
}
|
||||
@ -247,7 +247,7 @@ static int aztec_text_process(const unsigned char source[], const unsigned int s
|
||||
do {
|
||||
if (blockmap[0][i] == blockmap[0][i + 1]) {
|
||||
blockmap[1][i] += blockmap[1][i + 1];
|
||||
for (j = i + 1; j < blocks; j++) {
|
||||
for (j = i + 1; j < blocks - 1; j++) {
|
||||
blockmap[0][j] = blockmap[0][j + 1];
|
||||
blockmap[1][j] = blockmap[1][j + 1];
|
||||
}
|
||||
@ -255,7 +255,7 @@ static int aztec_text_process(const unsigned char source[], const unsigned int s
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
} while (i < blocks);
|
||||
} while (i < blocks - 1);
|
||||
}
|
||||
|
||||
/* Put the adjusted block data back into typemap */
|
||||
@ -1665,4 +1665,4 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
symbol->width = 11;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user