fix(grid): fix uninitialized var warnings (#8592)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
André Costa
2025-07-24 18:40:12 +02:00
committed by GitHub
parent 1253616416
commit 639c23cfce
+20 -11
View File
@@ -54,10 +54,10 @@ typedef struct {
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void grid_update(lv_obj_t * cont, void * user_data); static void grid_update(lv_obj_t * cont, void * user_data);
static void calc(lv_obj_t * obj, lv_grid_calc_t * calc); static lv_result_t calc(lv_obj_t * obj, lv_grid_calc_t * calc);
static void calc_free(lv_grid_calc_t * calc); static void calc_free(lv_grid_calc_t * calc);
static void calc_cols(lv_obj_t * cont, lv_grid_calc_t * c); static lv_result_t calc_cols(lv_obj_t * cont, lv_grid_calc_t * c);
static void calc_rows(lv_obj_t * cont, lv_grid_calc_t * c); static lv_result_t calc_rows(lv_obj_t * cont, lv_grid_calc_t * c);
static void item_repos(lv_obj_t * item, lv_grid_calc_t * c, item_repos_hint_t * hint); static void item_repos(lv_obj_t * item, lv_grid_calc_t * c, item_repos_hint_t * hint);
static int32_t grid_align(int32_t cont_size, bool auto_size, lv_grid_align_t align, int32_t gap, static int32_t grid_align(int32_t cont_size, bool auto_size, lv_grid_align_t align, int32_t gap,
uint32_t track_num, uint32_t track_num,
@@ -230,15 +230,21 @@ static void grid_update(lv_obj_t * cont, void * user_data)
* @param calc store the calculated cells sizes here * @param calc store the calculated cells sizes here
* @note `lv_grid_calc_free(calc_out)` needs to be called when `calc_out` is not needed anymore * @note `lv_grid_calc_free(calc_out)` needs to be called when `calc_out` is not needed anymore
*/ */
static void calc(lv_obj_t * cont, lv_grid_calc_t * calc_out) static lv_result_t calc(lv_obj_t * cont, lv_grid_calc_t * calc_out)
{ {
if(lv_obj_get_child(cont, 0) == NULL) { if(lv_obj_get_child(cont, 0) == NULL) {
lv_memzero(calc_out, sizeof(lv_grid_calc_t)); lv_memzero(calc_out, sizeof(lv_grid_calc_t));
return; return LV_RESULT_INVALID;
} }
calc_rows(cont, calc_out); if(calc_rows(cont, calc_out) == LV_RESULT_INVALID) {
calc_cols(cont, calc_out); /* Warning is already logged inside `calc_rows` */
return LV_RESULT_INVALID;
}
if(calc_cols(cont, calc_out) == LV_RESULT_INVALID) {
/* Warning is already logged inside `calc_cols` */
return LV_RESULT_INVALID;
}
int32_t col_gap = lv_obj_get_style_pad_column(cont, LV_PART_MAIN); int32_t col_gap = lv_obj_get_style_pad_column(cont, LV_PART_MAIN);
int32_t row_gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); int32_t row_gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN);
@@ -258,6 +264,7 @@ static void calc(lv_obj_t * cont, lv_grid_calc_t * calc_out)
calc_out->y, false); calc_out->y, false);
LV_ASSERT_MEM_INTEGRITY(); LV_ASSERT_MEM_INTEGRITY();
return LV_RESULT_OK;
} }
/** /**
@@ -272,7 +279,7 @@ static void calc_free(lv_grid_calc_t * calc)
lv_free(calc->h); lv_free(calc->h);
} }
static void calc_cols(lv_obj_t * cont, lv_grid_calc_t * c) static lv_result_t calc_cols(lv_obj_t * cont, lv_grid_calc_t * c)
{ {
const int32_t * col_templ; const int32_t * col_templ;
@@ -283,7 +290,7 @@ static void calc_cols(lv_obj_t * cont, lv_grid_calc_t * c)
col_templ = get_col_dsc(parent); col_templ = get_col_dsc(parent);
if(col_templ == NULL) { if(col_templ == NULL) {
LV_LOG_WARN("No col descriptor found even on the parent"); LV_LOG_WARN("No col descriptor found even on the parent");
return; return LV_RESULT_INVALID;
} }
int32_t pos = get_col_pos(cont); int32_t pos = get_col_pos(cont);
@@ -363,9 +370,10 @@ static void calc_cols(lv_obj_t * cont, lv_grid_calc_t * c)
if(subgrid) { if(subgrid) {
lv_free((void *)col_templ); lv_free((void *)col_templ);
} }
return LV_RESULT_OK;
} }
static void calc_rows(lv_obj_t * cont, lv_grid_calc_t * c) static lv_result_t calc_rows(lv_obj_t * cont, lv_grid_calc_t * c)
{ {
const int32_t * row_templ; const int32_t * row_templ;
row_templ = get_row_dsc(cont); row_templ = get_row_dsc(cont);
@@ -375,7 +383,7 @@ static void calc_rows(lv_obj_t * cont, lv_grid_calc_t * c)
row_templ = get_row_dsc(parent); row_templ = get_row_dsc(parent);
if(row_templ == NULL) { if(row_templ == NULL) {
LV_LOG_WARN("No row descriptor found even on the parent"); LV_LOG_WARN("No row descriptor found even on the parent");
return; return LV_RESULT_INVALID;
} }
int32_t pos = get_row_pos(cont); int32_t pos = get_row_pos(cont);
@@ -452,6 +460,7 @@ static void calc_rows(lv_obj_t * cont, lv_grid_calc_t * c)
if(subgrid) { if(subgrid) {
lv_free((void *)row_templ); lv_free((void *)row_templ);
} }
return LV_RESULT_OK;
} }
/** /**