From ed833132d538a63de2a6fbbb1869dbdd746ed937 Mon Sep 17 00:00:00 2001 From: Sushrut Shringarputale Date: Tue, 20 Aug 2019 09:50:39 -0700 Subject: [PATCH] Fix some compile-time issues for better production usability Fixed up some type coercion and uninitialized variable instances for better production code usability. --- lib/decode.c | 2 +- lib/identify.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/decode.c b/lib/decode.c index 13782b8..05d3112 100644 --- a/lib/decode.c +++ b/lib/decode.c @@ -874,7 +874,7 @@ static quirc_decode_error_t decode_payload(struct quirc_data *data, done: /* 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[data->payload_len] = 0; diff --git a/lib/identify.c b/lib/identify.c index 612a66a..2259614 100644 --- a/lib/identify.c +++ b/lib/identify.c @@ -98,8 +98,8 @@ static void perspective_map(const double *c, double x = (c[0]*u + c[1]*v + c[2]) / den; double y = (c[3]*u + c[4]*v + c[5]) / den; - ret->x = rint(x); - ret->y = rint(y); + ret->x = (int) rint(x); + ret->y = (int) rint(y); } static void perspective_unmap(const double *c, @@ -851,8 +851,8 @@ static void rotate_capstone(struct quirc_capstone *cap, { struct quirc_point copy[4]; int j; - int best; - int best_score; + int best = 0; + int best_score = INT32_MAX; for (j = 0; j < 4; j++) { struct quirc_point *p = &cap->corners[j];