fix uninitialized and shadoed warnings

This commit is contained in:
Gabor Kiss-Vamosi
2019-11-04 16:56:57 +01:00
parent 5844319017
commit 541a010ee9
12 changed files with 24 additions and 33 deletions

2
lvgl.h
View File

@@ -71,6 +71,8 @@ extern "C" {
#include "src/lv_draw/lv_img_cache.h" #include "src/lv_draw/lv_img_cache.h"
#include "src/lv_api_map.h"
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/

View File

@@ -29,7 +29,7 @@ extern "C" {
/*--------------------- /*---------------------
* V6.0 COMPATIBILITY * V6.0 COMPATIBILITY
*--------------------*/ *--------------------*/
#define lv_chart_get_point_count lv_chart_get_point_cnt #define lv_chart_get_point_cnt lv_chart_get_point_count
/********************** /**********************

View File

@@ -18,13 +18,13 @@
#include "../lv_misc/lv_task.h" #include "../lv_misc/lv_task.h"
#include "../lv_misc/lv_async.h" #include "../lv_misc/lv_async.h"
#include "../lv_misc/lv_fs.h" #include "../lv_misc/lv_fs.h"
#include "../lv_hal/lv_hal.h"
#include "../lv_misc/lv_gc.h" #include "../lv_misc/lv_gc.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_gc.h"
#include "../lv_misc/lv_math.h"
#include "../lv_hal/lv_hal.h"
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "../lv_misc/lv_gc.h"
#include "../lv_misc/lv_math.h"
#if defined(LV_GC_INCLUDE) #if defined(LV_GC_INCLUDE)
#include LV_GC_INCLUDE #include LV_GC_INCLUDE
@@ -212,11 +212,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
new_obj->opa_scale = LV_OPA_COVER; new_obj->opa_scale = LV_OPA_COVER;
new_obj->parent_event = 0; new_obj->parent_event = 0;
#if LV_USE_BIDI #if LV_USE_BIDI
#if LV_BIDI_BASE_DIR_DEF == LV_BIDI_DIR_LTR || LV_BIDI_BASE_DIR_DEF == LV_BIDI_DIR_RTL || LV_BIDI_BASE_DIR_DEF == LV_BIDI_DIR_AUTO
new_obj->base_dir = LV_BIDI_BASE_DIR_DEF; new_obj->base_dir = LV_BIDI_BASE_DIR_DEF;
#else
#error "`LV_BIDI_BASE_DIR_DEF` should be `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` (See lv_conf.h)"
#endif
#else #else
new_obj->base_dir = LV_BIDI_DIR_LTR; new_obj->base_dir = LV_BIDI_DIR_LTR;
#endif #endif
@@ -2411,11 +2407,9 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
/*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/ /*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/
if(lv_area_is_in(clip_area, &obj->coords) == false) return LV_DESIGN_RES_NOT_COVER; if(lv_area_is_in(clip_area, &obj->coords) == false) return LV_DESIGN_RES_NOT_COVER;
const lv_style_t * style = lv_obj_get_style(obj); const lv_style_t * style = lv_obj_get_style(obj);
if(style->body.corner_mask) return LV_DESIGN_RES_MASKED; if(style->body.corner_mask) return LV_DESIGN_RES_MASKED;
/*Can cover the area only if fully solid (no opacity)*/ /*Can cover the area only if fully solid (no opacity)*/
if(style->body.opa < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER; if(style->body.opa < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER;

View File

@@ -419,7 +419,6 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
/*If this object is fully cover the draw area check the children too */ /*If this object is fully cover the draw area check the children too */
if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) { if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) {
lv_design_res_t design_res = obj->design_cb(obj, area_p, LV_DESIGN_COVER_CHK); lv_design_res_t design_res = obj->design_cb(obj, area_p, LV_DESIGN_COVER_CHK);
if(design_res == LV_DESIGN_RES_MASKED) return NULL; if(design_res == LV_DESIGN_RES_MASKED) return NULL;

View File

@@ -237,7 +237,6 @@ static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, con
lv_color_t * disp_buf_tmp_ori = disp_buf_tmp; lv_color_t * disp_buf_tmp_ori = disp_buf_tmp;
#if LV_USE_GPU #if LV_USE_GPU
lv_disp_t * disp = lv_refr_get_disp_refreshing();
if(disp->driver.gpu_fill_cb && draw_area_w > GPU_WIDTH_LIMIT) { if(disp->driver.gpu_fill_cb && draw_area_w > GPU_WIDTH_LIMIT) {
disp->driver.gpu_fill_cb(&disp->driver, disp_buf, disp_w, draw_area, color); disp->driver.gpu_fill_cb(&disp->driver, disp_buf, disp_w, draw_area, color);
return; return;

View File

@@ -369,7 +369,7 @@ bool lv_img_buf_get_px_rotated(lv_img_rotate_dsc_t * dsc, lv_coord_t x, lv_coord
* In the 0x70..0x90 range use the unchanged source pixel */ * In the 0x70..0x90 range use the unchanged source pixel */
lv_color_t c_dest_int; lv_color_t c_dest_int;
lv_opa_t opa_dest_int; lv_opa_t opa_dest_int = 0;
uint8_t px_size; uint8_t px_size;
uint32_t px; uint32_t px;
@@ -386,6 +386,8 @@ bool lv_img_buf_get_px_rotated(lv_img_rotate_dsc_t * dsc, lv_coord_t x, lv_coord
opa_dest_int = src_u8[px + px_size - 1]; opa_dest_int = src_u8[px + px_size - 1];
} }
} else { } else {
px = 0; /*unused*/
px_size = 0; /*unused*/
c_dest_int = lv_img_buf_get_px_color(&dsc->img_dsc, x, y, dsc->color); c_dest_int = lv_img_buf_get_px_color(&dsc->img_dsc, x, y, dsc->color);
opa_dest_int = lv_img_buf_get_px_alpha(&dsc->img_dsc, x, y); opa_dest_int = lv_img_buf_get_px_alpha(&dsc->img_dsc, x, y);
} }
@@ -399,13 +401,13 @@ bool lv_img_buf_get_px_rotated(lv_img_rotate_dsc_t * dsc, lv_coord_t x, lv_coord
/*Get the mixture of the original source and the neightboor pixels in both directions*/ /*Get the mixture of the original source and the neightboor pixels in both directions*/
lv_color_t c_x_dest; lv_color_t c_x_dest;
lv_color_t c_y_dest; lv_color_t c_y_dest;
lv_opa_t opa_x_dest; lv_opa_t opa_x_dest = 0;
lv_opa_t opa_y_dest; lv_opa_t opa_y_dest = 0;
int32_t xn; /*x neightboor*/ int32_t xn; /*x neightboor*/
lv_opa_t xr; /*x mix ratio*/ lv_opa_t xr; /*x mix ratio*/
lv_color_t c_dest_xn; lv_color_t c_dest_xn;
lv_opa_t opa_dest_xn; lv_opa_t opa_dest_xn = 0;
if(xs_fract < 0x70) { if(xs_fract < 0x70) {
xn = xs_int - 1; xn = xs_int - 1;
@@ -450,13 +452,12 @@ bool lv_img_buf_get_px_rotated(lv_img_rotate_dsc_t * dsc, lv_coord_t x, lv_coord
int32_t yn; /*x neightboor*/ int32_t yn; /*x neightboor*/
lv_opa_t yr; /*x mix ratio*/ lv_opa_t yr; /*x mix ratio*/
lv_color_t c_dest_yn; lv_color_t c_dest_yn;
lv_opa_t opa_dest_yn; lv_opa_t opa_dest_yn = 0;
if(ys_fract < 0x70) { if(ys_fract < 0x70) {
yn = ys_int - 1; yn = ys_int - 1;
if(yn < 0) return false; if(yn < 0) return false;
lv_opa_t yr; /*y mix ratio*/
yr = ys_fract + 0x80; yr = ys_fract + 0x80;
if(dsc->native_color) { if(dsc->native_color) {

View File

@@ -395,7 +395,6 @@ static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area
#if LV_USE_GROUP #if LV_USE_GROUP
/*Draw the border*/ /*Draw the border*/
if(lv_obj_is_focused(bar)) { if(lv_obj_is_focused(bar)) {
lv_opa_t opa_scale = lv_obj_get_opa_scale(bar);
const lv_style_t * style_bg = lv_bar_get_style(bar, LV_BAR_STYLE_BG); const lv_style_t * style_bg = lv_bar_get_style(bar, LV_BAR_STYLE_BG);
lv_style_t style_tmp; lv_style_t style_tmp;
lv_style_copy(&style_tmp, style_bg); lv_style_copy(&style_tmp, style_bg);

View File

@@ -54,7 +54,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static bool lv_cpicker_design(lv_obj_t * cpicker, const lv_area_t * mask, lv_design_mode_t mode); static lv_design_res_t lv_cpicker_design(lv_obj_t * cpicker, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * param); static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * param);
static void invalidate_indic(lv_obj_t * cpicker); static void invalidate_indic(lv_obj_t * cpicker);
@@ -517,13 +517,13 @@ bool lv_cpicker_get_preview(lv_obj_t * cpicker)
* (return 'true' if yes) * (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true') * LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn * LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @return true/false, depends on 'mode' * @return return an element of `lv_design_res_t`
*/ */
static bool lv_cpicker_design(lv_obj_t * cpicker, const lv_area_t * mask, lv_design_mode_t mode) static lv_design_res_t lv_cpicker_design(lv_obj_t * cpicker, const lv_area_t * clip_area, lv_design_mode_t mode)
{ {
/*Return false if the object is not covers the mask_p area*/ /*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) { if(mode == LV_DESIGN_COVER_CHK) {
return false; return LV_DESIGN_RES_NOT_COVER;
} }
/*Draw the object*/ /*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) { else if(mode == LV_DESIGN_DRAW_MAIN) {
@@ -531,18 +531,18 @@ static bool lv_cpicker_design(lv_obj_t * cpicker, const lv_area_t * mask, lv_des
lv_opa_t opa_scale = lv_obj_get_opa_scale(cpicker); lv_opa_t opa_scale = lv_obj_get_opa_scale(cpicker);
if(ext->type == LV_CPICKER_TYPE_DISC) { if(ext->type == LV_CPICKER_TYPE_DISC) {
draw_disc_grad(cpicker, mask, opa_scale); draw_disc_grad(cpicker, clip_area, opa_scale);
} else if(ext->type == LV_CPICKER_TYPE_RECT) { } else if(ext->type == LV_CPICKER_TYPE_RECT) {
draw_rect_grad(cpicker, mask, opa_scale); draw_rect_grad(cpicker, clip_area, opa_scale);
} }
draw_indic(cpicker, mask, opa_scale); draw_indic(cpicker, clip_area, opa_scale);
} }
/*Post draw when the children are drawn*/ /*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) { else if(mode == LV_DESIGN_DRAW_POST) {
} }
return true; return LV_DESIGN_RES_OK;
} }
static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask, lv_opa_t opa_scale) static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask, lv_opa_t opa_scale)
@@ -578,9 +578,7 @@ static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask, lv_opa_t
if(ext->preview) { if(ext->preview) {
/*Mask out the center area*/ /*Mask out the center area*/
const lv_style_t * style_main = lv_cpicker_get_style(cpicker, LV_CPICKER_STYLE_MAIN);
lv_style_copy(&style, style_main); lv_style_copy(&style, style_main);
style.body.radius = LV_RADIUS_CIRCLE; style.body.radius = LV_RADIUS_CIRCLE;
lv_area_t area_mid; lv_area_t area_mid;

View File

@@ -705,7 +705,7 @@ static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_ar
lv_draw_rect(&page->coords, clip_area, &style_tmp, lv_obj_get_opa_scale(page)); lv_draw_rect(&page->coords, clip_area, &style_tmp, lv_obj_get_opa_scale(page));
if(style->body.corner_mask) { if(style->body.corner_mask) {
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG); style = lv_page_get_style(page, LV_PAGE_STYLE_BG);
lv_draw_mask_param_t mp; lv_draw_mask_param_t mp;
lv_draw_mask_radius_init(&mp, &page->coords, style->body.radius, false); lv_draw_mask_radius_init(&mp, &page->coords, style->body.radius, false);
lv_draw_mask_add(&mp, page + 4); lv_draw_mask_add(&mp, page + 4);

View File

@@ -299,7 +299,6 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
int16_t new_value = 0; int16_t new_value = 0;
if(w >= h) { if(w >= h) {
lv_coord_t indic_w = w - indic_style->body.padding.left - indic_style->body.padding.right; lv_coord_t indic_w = w - indic_style->body.padding.left - indic_style->body.padding.right;
int32_t range = ext->bar.max_value - ext->bar.min_value;
new_value = p.x - (slider->coords.x1 + indic_style->body.padding.left); /*Make the point relative to the indicator*/ new_value = p.x - (slider->coords.x1 + indic_style->body.padding.left); /*Make the point relative to the indicator*/
new_value = (new_value * range) / indic_w; new_value = (new_value * range) / indic_w;
new_value += ext->bar.min_value; new_value += ext->bar.min_value;

View File

@@ -731,7 +731,7 @@ static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, v
vect.x = vect.x * (100 - LV_INDEV_DEF_DRAG_THROW) / 100; vect.x = vect.x * (100 - LV_INDEV_DEF_DRAG_THROW) / 100;
} }
lv_res_t res = lv_indev_finish_drag(indev); res = lv_indev_finish_drag(indev);
if(res != LV_RES_OK) return res; if(res != LV_RES_OK) return res;
lv_obj_t * tab_page = lv_tabview_get_tab(tabview, ext->tab_cur); lv_obj_t * tab_page = lv_tabview_get_tab(tabview, ext->tab_cur);
lv_coord_t page_x1 = tab_page->coords.x1 - tabview->coords.x1 + x_predict; lv_coord_t page_x1 = tab_page->coords.x1 - tabview->coords.x1 + x_predict;

View File

@@ -364,7 +364,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
else if(sign == LV_SIGNAL_DRAG_THROW_BEGIN) { else if(sign == LV_SIGNAL_DRAG_THROW_BEGIN) {
drag_end_handler(tileview); drag_end_handler(tileview);
lv_res_t res = lv_indev_finish_drag(lv_indev_get_act()); res = lv_indev_finish_drag(lv_indev_get_act());
if(res != LV_RES_OK) return res; if(res != LV_RES_OK) return res;
} }
/*Apply constraint on moving of the tileview*/ /*Apply constraint on moving of the tileview*/