From 0831b6ba761bf68e535a158ff93ef3551d2bd108 Mon Sep 17 00:00:00 2001 From: guoweilkd Date: Tue, 21 Dec 2021 22:09:17 +0800 Subject: [PATCH] fix(style):add const qualifier for lv_style_get_prop() (#2933) --- src/misc/lv_style.c | 2 +- src/misc/lv_style.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index a0bafd23c..8b065a8e6 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -208,7 +208,7 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_ style->has_group |= 1 << group; } -lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value) +lv_res_t lv_style_get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value) { return lv_style_get_prop_inlined(style, prop, value); } diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 91adfd19a..fc445f80d 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -339,7 +339,7 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_ * LV_RES_OK: the property was fond, and `value` is set accordingly * @note For performance reasons there are no sanity check on `style` */ -lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value); +lv_res_t lv_style_get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value); /** @@ -352,7 +352,8 @@ lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_va * @note For performance reasons there are no sanity check on `style` * @note This function is the same as ::lv_style_get_prop but inlined. Use it only on performance critical places */ -static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value) +static inline lv_res_t lv_style_get_prop_inlined(const lv_style_t * style, lv_style_prop_t prop, + lv_style_value_t * value) { if(style->is_const) { const lv_style_const_prop_t * const_prop;