Skip to content

Commit

Permalink
Merge pull request #459 from Master92/compile_warnings
Browse files Browse the repository at this point in the history
Prevent possible invalid memory accesses by sprintf
  • Loading branch information
ligenxxxx authored Nov 21, 2024
2 parents ed01b32 + 26e1d41 commit 4e963ad
Show file tree
Hide file tree
Showing 33 changed files with 245 additions and 245 deletions.
10 changes: 5 additions & 5 deletions src/core/dvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ void dvr_update_status() {
void dvr_enable_line_out(bool enable) {
char buf[128];
if (enable) {
sprintf(buf, "%s out_on", AUDIO_SEL_SH);
snprintf(buf, sizeof(buf), "%s out_on", AUDIO_SEL_SH);
system_exec(buf);
sprintf(buf, "%s out_linein_on", AUDIO_SEL_SH);
snprintf(buf, sizeof(buf), "%s out_linein_on", AUDIO_SEL_SH);
system_exec(buf);
sprintf(buf, "%s out_dac_off", AUDIO_SEL_SH);
snprintf(buf, sizeof(buf), "%s out_dac_off", AUDIO_SEL_SH);
system_exec(buf);
} else {
sprintf(buf, "%s out_off", AUDIO_SEL_SH);
snprintf(buf, sizeof(buf), "%s out_off", AUDIO_SEL_SH);
system_exec(buf);
}
}
Expand All @@ -65,7 +65,7 @@ void dvr_select_audio_source(uint8_t source) {

if (source > 2)
source = 2;
sprintf(buf, "%s %s", AUDIO_SEL_SH, audio_source[source]);
snprintf(buf, sizeof(buf), "%s %s", AUDIO_SEL_SH, audio_source[source]);
system_exec(buf);
}

Expand Down
24 changes: 12 additions & 12 deletions src/core/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void osd_resource_path(char *buf, const char *fmt, osd_resource_t osd_resource_t

va_list args;
va_start(args, osd_resource_type);
vsprintf(filename, fmt, args);
vsnprintf(filename, sizeof(filename), fmt, args);
va_end(args);
strcpy(buf2, buf);
strcpy(buf, RESOURCE_PATH_SDCARD);
Expand Down Expand Up @@ -292,12 +292,12 @@ void osd_channel_show(bool bShow) {
if (channel_osd_mode & 0x80) {
ch = channel_osd_mode & 0x7F;
color = lv_color_make(0xFF, 0x20, 0x20);
sprintf(buf, " To %s? ", channel2str(g_setting.source.hdzero_band, ch));
snprintf(buf, sizeof(buf), " To %s? ", channel2str(g_setting.source.hdzero_band, ch));
lv_obj_set_style_bg_opa(g_osd_hdzero.channel[is_fhd], LV_OPA_100, 0);
} else {
ch = g_setting.scan.channel & 0x7F;
color = lv_color_make(0xFF, 0xFF, 0xFF);
sprintf(buf, "CH:%s", channel2str(g_setting.source.hdzero_band, ch));
snprintf(buf, sizeof(buf), "CH:%s", channel2str(g_setting.source.hdzero_band, ch));
lv_obj_set_style_bg_opa(g_osd_hdzero.channel[is_fhd], 0, 0);
}

Expand Down Expand Up @@ -644,13 +644,13 @@ void osd_hdzero_update(void) {
lv_obj_add_flag(g_osd_hdzero.ant3[is_fhd], LV_OBJ_FLAG_HIDDEN);

if (g_setting.storage.selftest) {
sprintf(buf, "T:%d-%d", fan_speed.top, g_temperature.top / 10);
snprintf(buf, sizeof(buf), "T:%d-%d", fan_speed.top, g_temperature.top / 10);
lv_label_set_text(g_osd_hdzero.osd_tempe[is_fhd][0], buf);

sprintf(buf, "L:%d-%d", fan_speed.left, g_temperature.left / 10);
snprintf(buf, sizeof(buf), "L:%d-%d", fan_speed.left, g_temperature.left / 10);
lv_label_set_text(g_osd_hdzero.osd_tempe[is_fhd][1], buf);

sprintf(buf, "R:%d-%d", fan_speed.right, g_temperature.right / 10);
snprintf(buf, sizeof(buf), "R:%d-%d", fan_speed.right, g_temperature.right / 10);
lv_label_set_text(g_osd_hdzero.osd_tempe[is_fhd][2], buf);
}
}
Expand Down Expand Up @@ -929,13 +929,13 @@ void load_fc_osd_font(uint8_t fhd) {
int i;

if (fhd) {
sprintf(fp[0], "%s%s_FHD_000.bmp", FC_OSD_SDCARD_PATH, fc_variant);
sprintf(fp[1], "%s%s_FHD_000.bmp", FC_OSD_LOCAL_PATH, fc_variant);
sprintf(fp[2], "%sBTFL_FHD_000.bmp", FC_OSD_LOCAL_PATH);
snprintf(fp[0], sizeof(fp[0]), "%s%s_FHD_000.bmp", FC_OSD_SDCARD_PATH, fc_variant);
snprintf(fp[1], sizeof(fp[1]), "%s%s_FHD_000.bmp", FC_OSD_LOCAL_PATH, fc_variant);
snprintf(fp[2], sizeof(fp[2]), "%sBTFL_FHD_000.bmp", FC_OSD_LOCAL_PATH);
} else {
sprintf(fp[0], "%s%s_000.bmp", FC_OSD_SDCARD_PATH, fc_variant);
sprintf(fp[1], "%s%s_000.bmp", FC_OSD_LOCAL_PATH, fc_variant);
sprintf(fp[2], "%sBTFL_000.bmp", FC_OSD_LOCAL_PATH);
snprintf(fp[0], sizeof(fp[0]), "%s%s_000.bmp", FC_OSD_SDCARD_PATH, fc_variant);
snprintf(fp[1], sizeof(fp[1]), "%s%s_000.bmp", FC_OSD_LOCAL_PATH, fc_variant);
snprintf(fp[2], sizeof(fp[2]), "%sBTFL_000.bmp", FC_OSD_LOCAL_PATH);
}

// Optimized for runtime execution
Expand Down
26 changes: 13 additions & 13 deletions src/core/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,17 @@ const setting_t g_setting_defaults = {
int settings_put_osd_element_shown(bool show, char *config_name) {
char setting_key[128];

sprintf(setting_key, "element_%s_show", config_name);
snprintf(setting_key, sizeof(setting_key), "element_%s_show", config_name);
return settings_put_bool("osd", setting_key, show);
}

int settings_put_osd_element_pos_x(const setting_osd_goggle_element_positions_t *pos, char *config_name) {
char setting_key[128];
int ret = 0;

sprintf(setting_key, "element_%s_pos_4_3_x", config_name);
snprintf(setting_key, sizeof(setting_key), "element_%s_pos_4_3_x", config_name);
ret = ini_putl("osd", setting_key, pos->mode_4_3.x, SETTING_INI);
sprintf(setting_key, "element_%s_pos_16_9_x", config_name);
snprintf(setting_key, sizeof(setting_key), "element_%s_pos_16_9_x", config_name);
ret &= ini_putl("osd", setting_key, pos->mode_16_9.x, SETTING_INI);
return ret;
}
Expand All @@ -246,9 +246,9 @@ int settings_put_osd_element_pos_y(const setting_osd_goggle_element_positions_t
char setting_key[128];
int ret = 0;

sprintf(setting_key, "element_%s_pos_4_3_y", config_name);
snprintf(setting_key, sizeof(setting_key), "element_%s_pos_4_3_y", config_name);
ret = ini_putl("osd", setting_key, pos->mode_4_3.y, SETTING_INI);
sprintf(setting_key, "element_%s_pos_16_9_y", config_name);
snprintf(setting_key, sizeof(setting_key), "element_%s_pos_16_9_y", config_name);
ret &= ini_putl("osd", setting_key, pos->mode_16_9.y, SETTING_INI);
return ret;
}
Expand All @@ -265,19 +265,19 @@ int settings_put_osd_element(const setting_osd_goggle_element_t *element, char *
static void settings_load_osd_element(setting_osd_goggle_element_t *element, char *config_name, const setting_osd_goggle_element_t *defaults) {
char buf[128];

sprintf(buf, "element_%s_show", config_name);
snprintf(buf, sizeof(buf), "element_%s_show", config_name);
element->show = settings_get_bool("osd", buf, defaults->show);

sprintf(buf, "element_%s_pos_4_3_x", config_name);
snprintf(buf, sizeof(buf), "element_%s_pos_4_3_x", config_name);
element->position.mode_4_3.x = ini_getl("osd", buf, defaults->position.mode_4_3.x, SETTING_INI);

sprintf(buf, "element_%s_pos_4_3_y", config_name);
snprintf(buf, sizeof(buf), "element_%s_pos_4_3_y", config_name);
element->position.mode_4_3.y = ini_getl("osd", buf, defaults->position.mode_4_3.y, SETTING_INI);

sprintf(buf, "element_%s_pos_16_9_x", config_name);
snprintf(buf, sizeof(buf), "element_%s_pos_16_9_x", config_name);
element->position.mode_16_9.x = ini_getl("osd", buf, defaults->position.mode_16_9.x, SETTING_INI);

sprintf(buf, "element_%s_pos_16_9_y", config_name);
snprintf(buf, sizeof(buf), "element_%s_pos_16_9_y", config_name);
element->position.mode_16_9.y = ini_getl("osd", buf, defaults->position.mode_16_9.y, SETTING_INI);
}

Expand All @@ -295,11 +295,11 @@ int settings_put_bool(char *section, char *key, bool value) {
void settings_reset(void) {
char buf[256];

sprintf(buf, "rm -f %s", SETTING_INI);
snprintf(buf, sizeof(buf), "rm -f %s", SETTING_INI);
system_exec(buf);
usleep(50);

sprintf(buf, "touch %s", SETTING_INI);
snprintf(buf, sizeof(buf), "touch %s", SETTING_INI);
system_exec(buf);
usleep(50);

Expand All @@ -310,7 +310,7 @@ void settings_init(void) {
// check if backup of old settings file exists after goggle update
if (fs_file_exists("/mnt/UDISK/setting.ini")) {
char buf[256];
sprintf(buf, "cp -f /mnt/UDISK/setting.ini %s", SETTING_INI);
snprintf(buf, sizeof(buf), "cp -f /mnt/UDISK/setting.ini %s", SETTING_INI);
system_exec(buf);
usleep(10);
system_exec("rm /mnt/UDISK/setting.ini");
Expand Down
4 changes: 2 additions & 2 deletions src/driver/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void gpio_open(int port_num) {
}

char buf[64];
sprintf(buf, "/sys/class/gpio/gpio%d/direction", port_num);
snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/direction", port_num);

if (!fs_printf(buf, "out")) {
return;
Expand All @@ -45,6 +45,6 @@ void gpio_open(int port_num) {

void gpio_set(int port_num, bool val) {
char buf[64];
sprintf(buf, "/sys/class/gpio/gpio%d/value", port_num);
snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/value", port_num);
fs_printf(buf, "%d", val ? 1 : 0);
}
2 changes: 1 addition & 1 deletion src/driver/nct75.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int nct_read_temperature(nct_type_t type) {

int dev_id = type + (getHwRevision() == HW_REV_1 ? 1 : 0);

sprintf(buf, "/sys/bus/iio/devices/iio:device%d/in_voltage0_raw", dev_id);
snprintf(buf, sizeof(buf), "/sys/bus/iio/devices/iio:device%d/in_voltage0_raw", dev_id);
fp = fopen(buf, "r");
if (!fp) {
static bool bFirst = true;
Expand Down
2 changes: 1 addition & 1 deletion src/lang/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool language_config() {
int i = 0;

for (i = 0; i < LANG_END; i++) {
sprintf(buf, "/mnt/extsd/%s", language_config_file[i]);
snprintf(buf, sizeof(buf), "/mnt/extsd/%s", language_config_file[i]);
if (access(buf, F_OK) == 0) {
LOGI("%s found", language_config_file[i]);
ini_putl("language", "lang", i, SETTING_INI);
Expand Down
2 changes: 1 addition & 1 deletion src/record/confparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ void conf_loadRecordParams(char* confFile, RecordParams_t* para)
memset(para->diskPath, 0, sizeof(para->packPath));
strcpy(para->diskPath, sTemp);
memset(para->packPath, 0, sizeof(para->packPath));
sprintf(para->packPath, "%s%s", para->diskPath, REC_packPATH);
snprintf(para->packPath, MAX_pathLEN, "%s%s", para->diskPath, REC_packPATH);
}

lValue = ini_gets(SEC_RECORD, KEY_TYPE, REC_packTYPE, sTemp, sizearray(sTemp), confFile);
Expand Down
22 changes: 11 additions & 11 deletions src/record/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ int already_running(void)
exit(1);
}
ftruncate(fd, 0);
sprintf(buf, "%ld", (long)getpid());
snprintf(buf, sizeof(buf), "%ld", (long)getpid());
write(fd, buf, strlen(buf)+1);
return(0);
}
Expand Down Expand Up @@ -203,7 +203,7 @@ void record_saveStatus(RecordContext_t* recCtx, RecordStatus_e recStatus)
LOGE( "can't lock %s: %s", REC_dataFILE, strerror(errno));
}
ftruncate(fd, 0);
sprintf(buf, "%d", recCtx->status);
snprintf(buf, sizeof(buf), "%d", recCtx->status);
write(fd, buf, strlen(buf)+1);
close(fd);

Expand Down Expand Up @@ -354,13 +354,13 @@ int record_start(RecordContext_t* recCtx)
char sFile[256];
switch (recCtx->params.fileNaming) {
case NAMING_CONTIGUOUS:
REC_filePathGet(sFile, recCtx->params.packPath, REC_packPREFIX, nbFileIndex, recCtx->params.packType);
REC_filePathGet(sFile, sizeof(sFile), recCtx->params.packPath, REC_packPREFIX, nbFileIndex, recCtx->params.packType);
break;
case NAMING_DATE: {
const time_t t = time(0);
const struct tm* date = localtime(&t);
sprintf(dateString, "%04d%02d%02d-%02d%02d%02d", date->tm_year + 1900, date->tm_mon + 1, date->tm_mday, date->tm_hour, date->tm_min, date->tm_sec);
sprintf(sFile, "%s%s.%s", recCtx->params.packPath, dateString, recCtx->params.packType);
snprintf(dateString, sizeof(dateString), "%04d%02d%02d-%02d%02d%02d", date->tm_year + 1900, date->tm_mon + 1, date->tm_mday, date->tm_hour, date->tm_min, date->tm_sec);
snprintf(sFile, sizeof(sFile), "%s%s.%s", recCtx->params.packPath, dateString, recCtx->params.packType);
break;
}
}
Expand Down Expand Up @@ -429,7 +429,7 @@ int record_start(RecordContext_t* recCtx)
strcpy(fileName, strrchr(sFile, '/') + 1);
av_dict_set(&ff->ofmtContext->metadata, "title", fileName, 0);

sprintf(localDateString, "%04d-%02d-%02d %02d:%02d:%02d", date->tm_year + 1900, date->tm_mon + 1, date->tm_mday, date->tm_hour, date->tm_min, date->tm_sec);
snprintf(localDateString, sizeof(localDateString), "%04d-%02d-%02d %02d:%02d:%02d", date->tm_year + 1900, date->tm_mon + 1, date->tm_mday, date->tm_hour, date->tm_min, date->tm_sec);
av_dict_set(&ff->ofmtContext->metadata, "date", localDateString, 0);
}

Expand Down Expand Up @@ -462,10 +462,10 @@ int record_start(RecordContext_t* recCtx)

switch (recCtx->params.fileNaming) {
case NAMING_CONTIGUOUS:
REC_filePathGet(sFile, recCtx->params.packPath, REC_packPREFIX, nbFileIndex, REC_packSnapTYPE);
REC_filePathGet(sFile, sizeof(sFile), recCtx->params.packPath, REC_packPREFIX, nbFileIndex, REC_packSnapTYPE);
break;
case NAMING_DATE:
sprintf(sFile, "%s%s.%s", recCtx->params.packPath, dateString, REC_packSnapTYPE);
snprintf(sFile, sizeof(sFile), "%s%s.%s", recCtx->params.packPath, dateString, REC_packSnapTYPE);
break;
}
ret = record_takePicture(recCtx, sFile);
Expand Down Expand Up @@ -519,7 +519,7 @@ bool record_pack(RecordContext_t* recCtx)
VencSpspps_t veHeader = { NULL, 0 };
int nbFileIndex = recCtx->nbFileIndex;
char sFile[256];
REC_filePathGet(sFile, recCtx->params.packPath, REC_packPREFIX, nbFileIndex, recCtx->params.packType);
REC_filePathGet(sFile, sizeof(sFile), recCtx->params.packPath, REC_packPREFIX, nbFileIndex, recCtx->params.packType);

FFPack_t* ff = ffpack_openFile(sFile, NULL);
if( ff == NULL ) {
Expand Down Expand Up @@ -577,7 +577,7 @@ bool record_pack(RecordContext_t* recCtx)

pthread_mutex_unlock(&recCtx->mutex);

REC_filePathGet(sFile, recCtx->params.packPath, REC_packPREFIX, nbFileIndex, REC_packSnapTYPE);
REC_filePathGet(sFile, sizeof(sFile), recCtx->params.packPath, REC_packPREFIX, nbFileIndex, REC_packSnapTYPE);
record_takePicture(recCtx, sFile);

return true;
Expand Down Expand Up @@ -888,7 +888,7 @@ void record_checkConf(RecordContext_t* recCtx, char* confSet)
readlink("/proc/self/exe", sTemp, MAX_pathLEN);
p = strrchr(sTemp,'/');
*p = '\0';
sprintf(recCtx->confFile, "%s/%s", sTemp, REC_confFILE);
snprintf(recCtx->confFile, MAX_pathLEN, "%s/%s", sTemp, REC_confFILE);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/record/record_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ extern "C" {
#define REC_packTypesNUM 2
#define REC_starFORMAT "%u:%02u star\n"

#define REC_filePathGet(BUFF, PATH, PREFIX, INDEX, FILEFMT) \
sprintf((BUFF), "%s%s%04d.%s", (PATH), (PREFIX), (INDEX), (FILEFMT));
#define REC_filePathGet(BUFF, MAXLEN, PATH, PREFIX, INDEX, FILEFMT) \
snprintf((BUFF), (MAXLEN), "%s%s%04d.%s", (PATH), (PREFIX), (INDEX), (FILEFMT));

#define ZeroMemory(p, size) memset(p, 0, size)

Expand Down
4 changes: 2 additions & 2 deletions src/rtspLive/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int already_running(void)
exit(1);
}
ftruncate(fd, 0);
sprintf(buf, "%ld", (long)getpid());
snprintf(buf, sizeof(buf), "%ld", (long)getpid());
write(fd, buf, strlen(buf)+1);
return(0);
}
Expand Down Expand Up @@ -179,7 +179,7 @@ void live_checkConf(LiveContext_t* liveCtx, char* confSet)
readlink("/proc/self/exe", sTemp, MAX_pathLEN);
p = strrchr(sTemp,'/');
*p = '\0';
sprintf(liveCtx->confFile, "%s/%s", sTemp, REC_confFILE);
snprintf(liveCtx->confFile, MAX_pathLEN, "%s/%s", sTemp, REC_confFILE);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ui/page_autoscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static lv_obj_t *page_autoscan_create(lv_obj_t *parent, panel_arr_t *arr) {
lv_obj_add_style(section, &style_submenu, LV_PART_MAIN);
lv_obj_set_size(section, 1053, 894);

sprintf(buf, "%s:", _lang("Auto Scan"));
snprintf(buf, sizeof(buf), "%s:", _lang("Auto Scan"));
create_text(NULL, section, false, buf, LV_MENU_ITEM_BUILDER_VARIANT_2);

lv_obj_t *cont = lv_obj_create(section);
Expand All @@ -45,7 +45,7 @@ static lv_obj_t *page_autoscan_create(lv_obj_t *parent, panel_arr_t *arr) {
btn_group_t btn_group;
create_btn_group_item(&btn_group0, cont, 3, _lang("Auto Scan"), _lang("On"), _lang("Last"), _lang("Off"), "", 0);
create_btn_group_item2(&btn_group1, cont, 5, _lang("Default"), _lang("Last"), _lang("HDZero"), _lang("Expansion"), _lang("AV In"), _lang("HDMI In"), " ", 1); // 2 rows
sprintf(buf, "< %s", _lang("Back"));
snprintf(buf, sizeof(buf), "< %s", _lang("Back"));
create_label_item(cont, buf, 1, 3, 1);

lv_obj_t *label2 = lv_label_create(cont);
Expand Down
12 changes: 6 additions & 6 deletions src/ui/page_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ static lv_obj_t *page_clock_create(lv_obj_t *parent, panel_arr_t *arr) {
lv_obj_add_style(section, &style_submenu, LV_PART_MAIN);
lv_obj_set_size(section, 1053, 894);

sprintf(buf, "%s:", _lang("Clock"));
snprintf(buf, sizeof(buf), "%s:", _lang("Clock"));
create_text(NULL, section, false, buf, LV_MENU_ITEM_BUILDER_VARIANT_2);

lv_obj_t *cont = lv_obj_create(section);
Expand All @@ -379,7 +379,7 @@ static lv_obj_t *page_clock_create(lv_obj_t *parent, panel_arr_t *arr) {
page_clock_create_dropdown(cont, ITEM_MINUTE, page_clock_rtc_date.min, 2, 1);
page_clock_create_dropdown(cont, ITEM_SECOND, page_clock_rtc_date.sec, 3, 1);

sprintf(buf, "%s/%s", _lang("AM"), _lang("PM"));
snprintf(buf, sizeof(buf), "%s/%s", _lang("AM"), _lang("PM"));
create_btn_group_item(&page_clock_items[ITEM_FORMAT].data.btn, cont, 2, _lang("Format"), buf, _lang("24 Hour"), "", "", 2);
page_clock_items[ITEM_FORMAT].type = ITEM_TYPE_BTN;
page_clock_items[ITEM_FORMAT].panel = arr->panel[2];
Expand All @@ -389,7 +389,7 @@ static lv_obj_t *page_clock_create(lv_obj_t *parent, panel_arr_t *arr) {
page_clock_items[ITEM_SET_CLOCK].type = ITEM_TYPE_OBJ;
page_clock_items[ITEM_SET_CLOCK].panel = arr->panel[3];

sprintf(buf, "< %s", _lang("Back"));
snprintf(buf, sizeof(buf), "< %s", _lang("Back"));
page_clock_items[ITEM_BACK].data.obj = create_label_item(cont, buf, 1, 4, 1);
page_clock_items[ITEM_BACK].type = ITEM_TYPE_OBJ;
page_clock_items[ITEM_BACK].panel = arr->panel[4];
Expand All @@ -398,7 +398,7 @@ static lv_obj_t *page_clock_create(lv_obj_t *parent, panel_arr_t *arr) {

if (rtc_has_battery() != 0) {
lv_obj_t *note = lv_label_create(cont);
sprintf(buf, "*%s.", _lang("Battery not installed or clock not configured"));
snprintf(buf, sizeof(buf), "*%s.", _lang("Battery not installed or clock not configured"));
lv_label_set_text(note, buf);
lv_obj_set_style_text_font(note, &lv_font_montserrat_16, 0);
lv_obj_set_style_text_align(note, LV_TEXT_ALIGN_LEFT, 0);
Expand Down Expand Up @@ -520,13 +520,13 @@ static void page_clock_on_click(uint8_t key, int sel) {
break;
case ITEM_SET_CLOCK:
if (page_clock_set_clock_confirm) {
sprintf(buf, "#FF0000 %s %s...#", _lang("Updating"), _lang("Clock"));
snprintf(buf, sizeof(buf), "#FF0000 %s %s...#", _lang("Updating"), _lang("Clock"));
lv_label_set_text(page_clock_items[ITEM_SET_CLOCK].data.obj, buf);
page_clock_set_clock_timer = lv_timer_create(page_clock_set_clock_timer_cb, 1000, NULL);
lv_timer_set_repeat_count(page_clock_set_clock_timer, 1);
page_clock_set_clock_confirm = 2;
} else {
sprintf(buf, "#FFFF00 %s...#", _lang("Click to confirm or Scroll to cancel"));
snprintf(buf, sizeof(buf), "#FFFF00 %s...#", _lang("Click to confirm or Scroll to cancel"));
lv_label_set_text(page_clock_items[ITEM_SET_CLOCK].data.obj, buf);
page_clock_set_clock_confirm = 1;
}
Expand Down
Loading

0 comments on commit 4e963ad

Please sign in to comment.