summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c50
1 files changed, 31 insertions, 19 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 302cf51e26..ac23cafe96 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -770,11 +770,15 @@ int settings_save( void )
770 save_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8); 770 save_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8);
771 save_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), RTC_BLOCK_SIZE*8); 771 save_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), RTC_BLOCK_SIZE*8);
772 772
773 strncpy(&config_block[0xb8], global_settings.wps_file, MAX_FILENAME); 773 strncpy((char *)&config_block[0xb8], (char *)global_settings.wps_file,
774 strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); 774 MAX_FILENAME);
775 strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); 775 strncpy((char *)&config_block[0xcc], (char *)global_settings.lang_file,
776 MAX_FILENAME);
777 strncpy((char *)&config_block[0xe0], (char *)global_settings.font_file,
778 MAX_FILENAME);
776#ifdef HAVE_REMOTE_LCD 779#ifdef HAVE_REMOTE_LCD
777 strncpy(&config_block[0xf4], global_settings.rwps_file, MAX_FILENAME); 780 strncpy((char *)&config_block[0xf4], (char *)global_settings.rwps_file,
781 MAX_FILENAME);
778#endif 782#endif
779 783
780 if(save_config_buffer()) 784 if(save_config_buffer())
@@ -1053,11 +1057,15 @@ void settings_load(int which)
1053 if ( global_settings.contrast < MIN_CONTRAST_SETTING ) 1057 if ( global_settings.contrast < MIN_CONTRAST_SETTING )
1054 global_settings.contrast = lcd_default_contrast(); 1058 global_settings.contrast = lcd_default_contrast();
1055 1059
1056 strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME); 1060 strncpy((char *)global_settings.wps_file, (char *)&config_block[0xb8],
1057 strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); 1061 MAX_FILENAME);
1058 strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); 1062 strncpy((char *)global_settings.lang_file, (char *)&config_block[0xcc],
1063 MAX_FILENAME);
1064 strncpy((char *)global_settings.font_file, (char *)&config_block[0xe0],
1065 MAX_FILENAME);
1059#ifdef HAVE_REMOTE_LCD 1066#ifdef HAVE_REMOTE_LCD
1060 strncpy(global_settings.rwps_file, &config_block[0xf4], MAX_FILENAME); 1067 strncpy((char *)global_settings.rwps_file, (char *)&config_block[0xf4],
1068 MAX_FILENAME);
1061#endif 1069#endif
1062 } 1070 }
1063} 1071}
@@ -1198,25 +1206,25 @@ bool settings_load_config(const char* file)
1198 /* check for the string values */ 1206 /* check for the string values */
1199 if (!strcasecmp(name, "wps")) { 1207 if (!strcasecmp(name, "wps")) {
1200 if (wps_data_load(gui_wps[0].data,value,true, false)) 1208 if (wps_data_load(gui_wps[0].data,value,true, false))
1201 set_file(value, global_settings.wps_file, MAX_FILENAME); 1209 set_file(value, (char *)global_settings.wps_file, MAX_FILENAME);
1202 } 1210 }
1203#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) 1211#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
1204 else if (!strcasecmp(name, "rwps")) { 1212 else if (!strcasecmp(name, "rwps")) {
1205 if (wps_data_load(gui_wps[1].data,value,true, false)) 1213 if (wps_data_load(gui_wps[1].data,value,true, false))
1206 set_file(value, global_settings.rwps_file, MAX_FILENAME); 1214 set_file(value, (char *)global_settings.rwps_file, MAX_FILENAME);
1207 } 1215 }
1208#endif 1216#endif
1209 else if (!strcasecmp(name, "lang")) { 1217 else if (!strcasecmp(name, "lang")) {
1210 if (!lang_load(value)) 1218 if (!lang_load(value))
1211 { 1219 {
1212 set_file(value, global_settings.lang_file, MAX_FILENAME); 1220 set_file(value, (char *)global_settings.lang_file, MAX_FILENAME);
1213 talk_init(); /* use voice of same language */ 1221 talk_init(); /* use voice of same language */
1214 } 1222 }
1215 } 1223 }
1216#ifdef HAVE_LCD_BITMAP 1224#ifdef HAVE_LCD_BITMAP
1217 else if (!strcasecmp(name, "font")) { 1225 else if (!strcasecmp(name, "font")) {
1218 if (font_load(value)) 1226 if (font_load(value))
1219 set_file(value, global_settings.font_file, MAX_FILENAME); 1227 set_file(value, (char *)global_settings.font_file, MAX_FILENAME);
1220 } 1228 }
1221#endif 1229#endif
1222 1230
@@ -1367,7 +1375,7 @@ bool settings_save_config(void)
1367 1375
1368 close(fd); 1376 close(fd);
1369 1377
1370 gui_syncsplash(HZ, true, "%s %s", str(LANG_SETTINGS_SAVED1), 1378 gui_syncsplash(HZ, true, (unsigned char *)"%s %s", str(LANG_SETTINGS_SAVED1),
1371 str(LANG_SETTINGS_SAVED2)); 1379 str(LANG_SETTINGS_SAVED2));
1372 return true; 1380 return true;
1373} 1381}
@@ -1447,9 +1455,9 @@ void settings_reset(void) {
1447bool set_bool(const char* string, bool* variable ) 1455bool set_bool(const char* string, bool* variable )
1448{ 1456{
1449 return set_bool_options(string, variable, 1457 return set_bool_options(string, variable,
1450 STR(LANG_SET_BOOL_YES), 1458 (char *)STR(LANG_SET_BOOL_YES),
1451 STR(LANG_SET_BOOL_NO), 1459 (char *)STR(LANG_SET_BOOL_NO),
1452 NULL); 1460 NULL);
1453} 1461}
1454 1462
1455/* wrapper to convert from int param to bool param in set_option */ 1463/* wrapper to convert from int param to bool param in set_option */
@@ -1467,7 +1475,10 @@ bool set_bool_options(const char* string, bool* variable,
1467 const char* no_str, int no_voice, 1475 const char* no_str, int no_voice,
1468 void (*function)(bool)) 1476 void (*function)(bool))
1469{ 1477{
1470 struct opt_items names[] = { {no_str, no_voice}, {yes_str, yes_voice} }; 1478 struct opt_items names[] = {
1479 {(unsigned char *)no_str, no_voice},
1480 {(unsigned char *)yes_str, yes_voice}
1481 };
1471 bool result; 1482 bool result;
1472 1483
1473 boolfunction = function; 1484 boolfunction = function;
@@ -1492,7 +1503,7 @@ void talk_unit(int unit, int value)
1492 } 1503 }
1493} 1504}
1494 1505
1495bool set_int(const char* string, 1506bool set_int(const unsigned char* string,
1496 const char* unit, 1507 const char* unit,
1497 int voice_unit, 1508 int voice_unit,
1498 int* variable, 1509 int* variable,
@@ -1505,7 +1516,8 @@ bool set_int(const char* string,
1505 int button; 1516 int button;
1506 int oldvalue=*variable; 1517 int oldvalue=*variable;
1507 struct gui_select select; 1518 struct gui_select select;
1508 gui_select_init_numeric(&select, string, *variable, min, max, step, unit, formatter); 1519 gui_select_init_numeric(&select, (char *)string, *variable, min, max, step, unit,
1520 formatter);
1509 gui_syncselect_draw(&select); 1521 gui_syncselect_draw(&select);
1510 talk_unit(voice_unit, *variable); 1522 talk_unit(voice_unit, *variable);
1511 while (!gui_select_is_validated(&select)) 1523 while (!gui_select_is_validated(&select))