mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
CODE128: make cppcheck out-of-bounds suppression clearer (#233), props Andre Maute
This commit is contained in:
parent
4d9aa96453
commit
e1f22e0e72
@ -237,10 +237,12 @@ static void c128_set_a(const unsigned char source, char dest[], int values[], in
|
|||||||
* control characters.
|
* control characters.
|
||||||
*/
|
*/
|
||||||
static int c128_set_b(const unsigned char source, char dest[], int values[], int *bar_chars) {
|
static int c128_set_b(const unsigned char source, char dest[], int values[], int *bar_chars) {
|
||||||
if (source > 127 + 32) { /* Suppress cppcheck out-of-bounds warning with + 32 check */
|
if (source >= 128 + 32) {
|
||||||
strcat(dest, C128Table[source - 32 - 128]);
|
strcat(dest, C128Table[source - 32 - 128]);
|
||||||
values[(*bar_chars)] = source - 32 - 128;
|
values[(*bar_chars)] = source - 32 - 128;
|
||||||
} else if (source <= 127) { /* Suppress cppcheck out-of-bounds warning with <= 127 check */
|
} else if (source >= 128) { /* Should never happen */
|
||||||
|
return 0; /* Not reached */
|
||||||
|
} else if (source >= 32) {
|
||||||
strcat(dest, C128Table[source - 32]);
|
strcat(dest, C128Table[source - 32]);
|
||||||
values[(*bar_chars)] = source - 32;
|
values[(*bar_chars)] = source - 32;
|
||||||
} else { /* Should never happen */
|
} else { /* Should never happen */
|
||||||
|
Loading…
Reference in New Issue
Block a user