chore: fix minor compile warnings (#6987)
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
2
Kconfig
2
Kconfig
@@ -1578,7 +1578,7 @@ menu "LVGL configuration"
|
|||||||
default 9 # LVGL_VERSION_MAJOR
|
default 9 # LVGL_VERSION_MAJOR
|
||||||
config LVGL_VERSION_MINOR
|
config LVGL_VERSION_MINOR
|
||||||
int
|
int
|
||||||
default 2 # LVGL_VERSION_MINOR
|
default 3 # LVGL_VERSION_MINOR
|
||||||
config LVGL_VERSION_PATCH
|
config LVGL_VERSION_PATCH
|
||||||
int
|
int
|
||||||
default 0 # LVGL_VERSION_PATCH
|
default 0 # LVGL_VERSION_PATCH
|
||||||
|
|||||||
@@ -1,52 +1,56 @@
|
|||||||
#include "./lv_i18n.h"
|
#include "./lv_i18n.h"
|
||||||
#include "../../../src/stdlib/lv_string.h"
|
#include "../../../src/stdlib/lv_string.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Define plural operands
|
|
||||||
// http://unicode.org/reports/tr35/tr35-numbers.html#Operands
|
|
||||||
|
|
||||||
// Integer version, simplified
|
/**
|
||||||
|
* Define plural operands
|
||||||
|
* http://unicode.org/reports/tr35/tr35-numbers.html#Operands
|
||||||
|
*/
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
/* Integer version, simplified */
|
||||||
|
|
||||||
static inline uint32_t op_n(int32_t val)
|
static inline uint32_t op_n(int32_t val)
|
||||||
{
|
{
|
||||||
return (uint32_t)(val < 0 ? -val : val);
|
return (uint32_t)(val < 0 ? -val : val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t op_i(uint32_t val)
|
static inline uint32_t op_i(uint32_t val)
|
||||||
{
|
{
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
// always zero, when decimal part not exists.
|
|
||||||
|
/* always zero, when decimal part not exists. */
|
||||||
static inline uint32_t op_v(uint32_t val)
|
static inline uint32_t op_v(uint32_t val)
|
||||||
{
|
{
|
||||||
UNUSED(val);
|
LV_UNUSED(val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t op_w(uint32_t val)
|
static inline uint32_t op_w(uint32_t val)
|
||||||
{
|
{
|
||||||
UNUSED(val);
|
LV_UNUSED(val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static inline uint32_t op_f(uint32_t val)
|
static inline uint32_t op_f(uint32_t val)
|
||||||
{
|
{
|
||||||
UNUSED(val);
|
LV_UNUSED(val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t op_t(uint32_t val)
|
static inline uint32_t op_t(uint32_t val)
|
||||||
{
|
{
|
||||||
UNUSED(val);
|
LV_UNUSED(val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t en_plural_fn(int32_t num)
|
static uint8_t en_plural_fn(int32_t num)
|
||||||
{
|
{
|
||||||
uint32_t n = op_n(num);
|
uint32_t n = op_n(num);
|
||||||
UNUSED(n);
|
LV_UNUSED(n);
|
||||||
uint32_t i = op_i(n);
|
uint32_t i = op_i(n);
|
||||||
UNUSED(i);
|
LV_UNUSED(i);
|
||||||
uint32_t v = op_v(n);
|
uint32_t v = op_v(n);
|
||||||
UNUSED(v);
|
LV_UNUSED(v);
|
||||||
|
|
||||||
if(i == 1 && v == 0) return LV_I18N_PLURAL_TYPE_ONE;
|
if(i == 1 && v == 0) return LV_I18N_PLURAL_TYPE_ONE;
|
||||||
return LV_I18N_PLURAL_TYPE_OTHER;
|
return LV_I18N_PLURAL_TYPE_OTHER;
|
||||||
@@ -80,15 +84,13 @@ static lv_i18n_phrase_t ar_singulars[] = {
|
|||||||
{"Distance", "المسافة"},
|
{"Distance", "المسافة"},
|
||||||
{"Top speed", "السرعة القصوى"},
|
{"Top speed", "السرعة القصوى"},
|
||||||
{"March %d", "مارس %d"},
|
{"March %d", "مارس %d"},
|
||||||
{NULL, NULL} // End mark
|
{NULL, NULL} /* End mark */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static uint8_t ar_plural_fn(int32_t num)
|
static uint8_t ar_plural_fn(int32_t num)
|
||||||
{
|
{
|
||||||
uint32_t n = op_n(num);
|
uint32_t n = op_n(num);
|
||||||
UNUSED(n);
|
LV_UNUSED(n);
|
||||||
|
|
||||||
uint32_t n100 = n % 100;
|
uint32_t n100 = n % 100;
|
||||||
if(n == 0) return LV_I18N_PLURAL_TYPE_ZERO;
|
if(n == 0) return LV_I18N_PLURAL_TYPE_ZERO;
|
||||||
@@ -127,14 +129,12 @@ static lv_i18n_phrase_t zh_singulars[] = {
|
|||||||
{"Distance", "距离"},
|
{"Distance", "距离"},
|
||||||
{"Top speed", "最高时速"},
|
{"Top speed", "最高时速"},
|
||||||
{"March %d", "三月 %d"},
|
{"March %d", "三月 %d"},
|
||||||
{NULL, NULL} // End mark
|
{NULL, NULL} /* End mark */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static uint8_t zh_plural_fn(int32_t num)
|
static uint8_t zh_plural_fn(int32_t num)
|
||||||
{
|
{
|
||||||
UNUSED(num);
|
LV_UNUSED(num);
|
||||||
|
|
||||||
return LV_I18N_PLURAL_TYPE_OTHER;
|
return LV_I18N_PLURAL_TYPE_OTHER;
|
||||||
}
|
}
|
||||||
@@ -150,13 +150,10 @@ const lv_i18n_language_pack_t lv_i18n_language_pack[] = {
|
|||||||
&en_lang,
|
&en_lang,
|
||||||
&ar_lang,
|
&ar_lang,
|
||||||
&zh_lang,
|
&zh_lang,
|
||||||
NULL // End mark
|
NULL /* End mark */
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
/* Internal state */
|
||||||
|
|
||||||
|
|
||||||
// Internal state
|
|
||||||
static const lv_i18n_language_pack_t * current_lang_pack;
|
static const lv_i18n_language_pack_t * current_lang_pack;
|
||||||
static const lv_i18n_lang_t * current_lang;
|
static const lv_i18n_lang_t * current_lang;
|
||||||
|
|
||||||
@@ -195,7 +192,7 @@ int lv_i18n_set_locale(const char * l_name)
|
|||||||
uint16_t i;
|
uint16_t i;
|
||||||
|
|
||||||
for(i = 0; current_lang_pack[i] != NULL; i++) {
|
for(i = 0; current_lang_pack[i] != NULL; i++) {
|
||||||
// Found -> finish
|
/* Found -> finish */
|
||||||
if(lv_strcmp(current_lang_pack[i]->locale_name, l_name) == 0) {
|
if(lv_strcmp(current_lang_pack[i]->locale_name, l_name) == 0) {
|
||||||
current_lang = current_lang_pack[i];
|
current_lang = current_lang_pack[i];
|
||||||
return 0;
|
return 0;
|
||||||
@@ -232,17 +229,17 @@ const char * lv_i18n_get_text(const char * msg_id)
|
|||||||
const lv_i18n_lang_t * lang = current_lang;
|
const lv_i18n_lang_t * lang = current_lang;
|
||||||
const void * txt;
|
const void * txt;
|
||||||
|
|
||||||
// Search in current locale
|
/* Search in current locale */
|
||||||
if(lang->singulars != NULL) {
|
if(lang->singulars != NULL) {
|
||||||
txt = __lv_i18n_get_text_core(lang->singulars, msg_id);
|
txt = __lv_i18n_get_text_core(lang->singulars, msg_id);
|
||||||
if(txt != NULL) return txt;
|
if(txt != NULL) return txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to fallback
|
/* Try to fallback */
|
||||||
if(lang == current_lang_pack[0]) return msg_id;
|
if(lang == current_lang_pack[0]) return msg_id;
|
||||||
lang = current_lang_pack[0];
|
lang = current_lang_pack[0];
|
||||||
|
|
||||||
// Repeat search for default locale
|
/* Repeat search for default locale */
|
||||||
if(lang->singulars != NULL) {
|
if(lang->singulars != NULL) {
|
||||||
txt = __lv_i18n_get_text_core(lang->singulars, msg_id);
|
txt = __lv_i18n_get_text_core(lang->singulars, msg_id);
|
||||||
if(txt != NULL) return txt;
|
if(txt != NULL) return txt;
|
||||||
@@ -265,7 +262,7 @@ const char * lv_i18n_get_text_plural(const char * msg_id, int32_t num)
|
|||||||
const void * txt;
|
const void * txt;
|
||||||
lv_i18n_plural_type_t ptype;
|
lv_i18n_plural_type_t ptype;
|
||||||
|
|
||||||
// Search in current locale
|
/* Search in current locale */
|
||||||
if(lang->locale_plural_fn != NULL) {
|
if(lang->locale_plural_fn != NULL) {
|
||||||
ptype = lang->locale_plural_fn(num);
|
ptype = lang->locale_plural_fn(num);
|
||||||
|
|
||||||
@@ -275,11 +272,11 @@ const char * lv_i18n_get_text_plural(const char * msg_id, int32_t num)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to fallback
|
/* Try to fallback */
|
||||||
if(lang == current_lang_pack[0]) return msg_id;
|
if(lang == current_lang_pack[0]) return msg_id;
|
||||||
lang = current_lang_pack[0];
|
lang = current_lang_pack[0];
|
||||||
|
|
||||||
// Repeat search for default locale
|
/* Repeat search for default locale */
|
||||||
if(lang->locale_plural_fn != NULL) {
|
if(lang->locale_plural_fn != NULL) {
|
||||||
ptype = lang->locale_plural_fn(num);
|
ptype = lang->locale_plural_fn(num);
|
||||||
|
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ lv_color_format_t lv_display_get_color_format(lv_display_t * disp)
|
|||||||
|
|
||||||
void lv_display_set_tile_cnt(lv_display_t * disp, uint32_t tile_cnt)
|
void lv_display_set_tile_cnt(lv_display_t * disp, uint32_t tile_cnt)
|
||||||
{
|
{
|
||||||
LV_ASSERT_FORMAT_MSG(tile_cnt < 256, "tile_cnt must be smaller than 256 (%d was used)", tile_cnt);
|
LV_ASSERT_FORMAT_MSG(tile_cnt < 256, "tile_cnt must be smaller than 256 (%" LV_PRId32 " was used)", tile_cnt);
|
||||||
|
|
||||||
if(disp == NULL) disp = lv_display_get_default();
|
if(disp == NULL) disp = lv_display_get_default();
|
||||||
if(disp == NULL) return;
|
if(disp == NULL) return;
|
||||||
|
|||||||
2
src/misc/cache/lv_image_cache.c
vendored
2
src/misc/cache/lv_image_cache.c
vendored
@@ -173,7 +173,7 @@ static void iter_inspect_cb(void * elem)
|
|||||||
LV_UNUSED(entry);
|
LV_UNUSED(entry);
|
||||||
|
|
||||||
/* size data_size cf rc type decoded src*/
|
/* size data_size cf rc type decoded src*/
|
||||||
#define IMAGE_CACHE_DUMP_FORMAT " %4dx%-4d %9"LV_PRIu32" %d %d "
|
#define IMAGE_CACHE_DUMP_FORMAT " %4dx%-4d %9"LV_PRIu32" %d %"LV_PRId32" "
|
||||||
switch(data->src_type) {
|
switch(data->src_type) {
|
||||||
case LV_IMAGE_SRC_FILE:
|
case LV_IMAGE_SRC_FILE:
|
||||||
LV_LOG_USER(IMAGE_CACHE_DUMP_FORMAT "file\t%-12p\t%s", header->w, header->h, decoded->data_size, header->cf,
|
LV_LOG_USER(IMAGE_CACHE_DUMP_FORMAT "file\t%-12p\t%s", header->w, header->h, decoded->data_size, header->cf,
|
||||||
|
|||||||
2
src/misc/cache/lv_image_header_cache.c
vendored
2
src/misc/cache/lv_image_header_cache.c
vendored
@@ -161,7 +161,7 @@ static void iter_inspect_cb(void * elem)
|
|||||||
LV_UNUSED(entry);
|
LV_UNUSED(entry);
|
||||||
|
|
||||||
/* size data_size cf rc type decoded src*/
|
/* size data_size cf rc type decoded src*/
|
||||||
#define IMAGE_CACHE_DUMP_FORMAT " %4dx%-4d %9"LV_PRIu32" %d %d "
|
#define IMAGE_CACHE_DUMP_FORMAT " %4dx%-4d %9"LV_PRIu32" %d %" LV_PRId32 " "
|
||||||
switch(data->src_type) {
|
switch(data->src_type) {
|
||||||
case LV_IMAGE_SRC_FILE:
|
case LV_IMAGE_SRC_FILE:
|
||||||
LV_LOG_USER(IMAGE_CACHE_DUMP_FORMAT "file\t%-12p\t%s", header->w, header->h, decoded->data_size, header->cf,
|
LV_LOG_USER(IMAGE_CACHE_DUMP_FORMAT "file\t%-12p\t%s", header->w, header->h, decoded->data_size, header->cf,
|
||||||
|
|||||||
Reference in New Issue
Block a user