Fix compiler warnings

This commit is contained in:
fvanroie 2021-04-25 05:43:14 +02:00
parent 1b423de6e5
commit 2c3b383d4f
2 changed files with 28 additions and 32 deletions

View File

@ -143,31 +143,27 @@ lv_res_t lv_qrcode_update2(lv_obj_t * qrcode, const void * data, uint32_t data_l
if(!ok) return LV_RES_INV;
// lv_coord_t obj_w = lv_obj_get_width(qrcode);
int qr_size = qrcodegen_getSize(qr_pixels);
int scale = 1;
int scaled = 0;
// int scale = 1;
// int scaled = 0;
// int qr_size = qrcodegen_getSize(qr_pixels);
int margin = 0;
LV_LOG_ERROR("5 OK");
lv_img_ext_t* ext = (lv_img_ext_t*)lv_obj_get_ext_attr(qrcode);
if(!ext || !ext->src) return LV_RES_INV;
LV_LOG_ERROR("6 OK");
lv_img_header_t header;
lv_img_decoder_get_info(ext->src, &header);
LV_LOG_ERROR("7 OK");
lv_img_decoder_dsc_t dec_dsc;
lv_res_t res = lv_img_decoder_open(&dec_dsc, ext->src, LV_COLOR_CYAN);
LV_LOG_ERROR("8 OK");
(void)res;
for(int y = 0; y < dec_dsc.header.h; y++) {
for(int x = 0; x < dec_dsc.header.w; x++) {
c = qrcodegen_getModule(qr_pixels, x, y) ? LV_COLOR_WHITE : LV_COLOR_BLACK;
lv_img_buf_set_px_color(dec_dsc.src, x + margin, y + margin, c);
lv_img_buf_set_px_color((lv_img_dsc_t*)dec_dsc.src, x + margin, y + margin, c);
}
}
LV_LOG_ERROR("9 OK");
return LV_RES_OK;
}

View File

@ -963,8 +963,8 @@ testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int
assert(segs != NULL || len == 0);
long result = 0;
for(size_t i = 0; i < len; i++) {
int numChars = segs[i].numChars;
int bitLength = segs[i].bitLength;
int16_t numChars = segs[i].numChars;
int16_t bitLength = segs[i].bitLength;
assert(0 <= numChars && numChars <= INT16_MAX);
assert(0 <= bitLength && bitLength <= INT16_MAX);
int ccbits = numCharCountBits(segs[i].mode, version);