Fix some compile-time issues for better production usability

Fixed up some type coercion and uninitialized variable instances for
better production code usability.
This commit is contained in:
Sushrut Shringarputale 2019-08-20 09:50:39 -07:00
parent 5d71b1853e
commit ed833132d5
2 changed files with 5 additions and 5 deletions

View file

@ -874,7 +874,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 (data->payload_len >= (int) sizeof(data->payload))
data->payload_len--; data->payload_len--;
data->payload[data->payload_len] = 0; data->payload[data->payload_len] = 0;

View file

@ -98,8 +98,8 @@ static void perspective_map(const double *c,
double x = (c[0]*u + c[1]*v + c[2]) / den; double x = (c[0]*u + c[1]*v + c[2]) / den;
double y = (c[3]*u + c[4]*v + c[5]) / den; double y = (c[3]*u + c[4]*v + c[5]) / den;
ret->x = rint(x); ret->x = (int) rint(x);
ret->y = rint(y); ret->y = (int) rint(y);
} }
static void perspective_unmap(const double *c, static void perspective_unmap(const double *c,
@ -851,8 +851,8 @@ static void rotate_capstone(struct quirc_capstone *cap,
{ {
struct quirc_point copy[4]; struct quirc_point copy[4];
int j; int j;
int best; int best = 0;
int best_score; int best_score = INT32_MAX;
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
struct quirc_point *p = &cap->corners[j]; struct quirc_point *p = &cap->corners[j];