Patched quirc to finally rid ourselves of those compiler warnings

This commit is contained in:
Helloman892
2018-05-16 19:20:27 +01:00
parent 89c8a4fae2
commit aa3a00cedc
3 changed files with 5 additions and 3 deletions

View File

@@ -117,7 +117,7 @@ static const uint8_t gf256_log[256] = {
0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf
}; };
const static struct galois_field gf256 = { static const struct galois_field gf256 = {
.p = 255, .p = 255,
.log = gf256_log, .log = gf256_log,
.exp = gf256_exp .exp = gf256_exp
@@ -873,7 +873,7 @@ static quirc_decode_error_t decode_payload(struct quirc_data *data,
done: done:
/* Add nul terminator to all payloads */ /* Add nul terminator to all payloads */
if (data->payload_len >= sizeof(data->payload)) if ((unsigned int)data->payload_len >= sizeof(data->payload))
data->payload_len--; data->payload_len--;
data->payload[data->payload_len] = 0; data->payload[data->payload_len] = 0;

View File

@@ -348,6 +348,7 @@ static void threshold(struct quirc *q)
static void area_count(void *user_data, int y, int left, int right) static void area_count(void *user_data, int y, int left, int right)
{ {
(void)y;
((struct quirc_region *)user_data)->count += right - left + 1; ((struct quirc_region *)user_data)->count += right - left + 1;
} }

View File

@@ -84,7 +84,8 @@ static const char *const error_table[] = {
const char *quirc_strerror(quirc_decode_error_t err) const char *quirc_strerror(quirc_decode_error_t err)
{ {
if (err >= 0 && err < sizeof(error_table) / sizeof(error_table[0])) // note from Anemone3DS dev - L88 used to compare err >= 0, but err is always positive
if (err < sizeof(error_table) / sizeof(error_table[0]))
return error_table[err]; return error_table[err];
return "Unknown error"; return "Unknown error";