From f981ea93fb411019133a022c7dd873166d66b5dd Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 5 Dec 2005 22:44:42 +0000 Subject: kill gcc4 warnings git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8162 a1c6a512-1295-4272-9138-f99709370657 --- apps/bookmark.c | 22 +++++------ apps/codecs.h | 2 +- apps/dbtree.c | 28 +++++++------- apps/filetree.c | 26 ++++++------- apps/filetypes.c | 50 ++++++++++++------------ apps/filetypes.h | 2 +- apps/gui/gwps-common.c | 44 +++++++++++++-------- apps/gui/splash.c | 4 +- apps/gui/splash.h | 2 +- apps/gui/textarea.c | 5 ++- apps/gui/yesno.c | 4 +- apps/language.c | 2 +- apps/main_menu.c | 22 +++++------ apps/menu.c | 4 +- apps/misc.c | 14 +++---- apps/onplay.c | 24 ++++++------ apps/pcmbuf.c | 4 +- apps/playback.c | 12 +++--- apps/playlist.c | 34 ++++++++-------- apps/playlist_menu.c | 2 +- apps/playlist_viewer.c | 13 ++++--- apps/plugin.h | 2 +- apps/screens.c | 14 +++---- apps/settings.c | 50 +++++++++++++++--------- apps/settings.h | 5 ++- apps/settings_menu.c | 103 +++++++++++++++++++++++++------------------------ apps/sleeptimer.c | 2 +- apps/sound_menu.c | 2 +- apps/talk.c | 2 +- apps/tree.c | 21 +++++----- 30 files changed, 275 insertions(+), 246 deletions(-) diff --git a/apps/bookmark.c b/apps/bookmark.c index 4ca828089f..8980e4fc26 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -207,14 +207,14 @@ bool bookmark_autobookmark(void) return write_bookmark(false); } #ifdef HAVE_LCD_BITMAP - char *lines[]={str(LANG_AUTO_BOOKMARK_QUERY), - str(LANG_CONFIRM_WITH_PLAY_RECORDER), - str(LANG_CANCEL_WITH_ANY_RECORDER)}; - struct text_message message={lines, 3}; + unsigned char *lines[]={str(LANG_AUTO_BOOKMARK_QUERY), + str(LANG_CONFIRM_WITH_PLAY_RECORDER), + str(LANG_CANCEL_WITH_ANY_RECORDER)}; + struct text_message message={(char **)lines, 3}; #else - char *lines[]={str(LANG_AUTO_BOOKMARK_QUERY), - str(LANG_RESUME_CONFIRM_PLAYER)}; - struct text_message message={lines, 2}; + unsigned char *lines[]={str(LANG_AUTO_BOOKMARK_QUERY), + str(LANG_RESUME_CONFIRM_PLAYER)}; + struct text_message message={(char **)lines, 2}; #endif gui_syncstatusbar_draw(&statusbars, false); if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) @@ -766,7 +766,7 @@ static void display_bookmark(const char* bookmark, dot=NULL; if (dot) *dot='\0'; - lcd_puts_scroll(0, 0, global_filename); + lcd_puts_scroll(0, 0, (unsigned char *)global_filename); if (dot) *dot='.'; @@ -774,12 +774,12 @@ static void display_bookmark(const char* bookmark, snprintf(global_temp_buffer, sizeof(global_temp_buffer), "%s: %2d/%2d", str(LANG_BOOKMARK_SELECT_BOOKMARK_TEXT), bookmark_id + 1, bookmark_count); - lcd_puts_scroll(0, 1, global_temp_buffer); + lcd_puts_scroll(0, 1, (unsigned char *)global_temp_buffer); /* bookmark resume index */ snprintf(global_temp_buffer, sizeof(global_temp_buffer), "%s: %2d", str(LANG_BOOKMARK_SELECT_INDEX_TEXT), resume_index+1); - lcd_puts_scroll(0, 2, global_temp_buffer); + lcd_puts_scroll(0, 2, (unsigned char *)global_temp_buffer); /* elapsed time*/ if ( ms < 3600000 ) @@ -799,7 +799,7 @@ static void display_bookmark(const char* bookmark, ms % 3600000 / 60000, (unsigned int)(ms % 60000) / 1000); } - lcd_puts_scroll(0, 3, global_temp_buffer); + lcd_puts_scroll(0, 3, (unsigned char *)global_temp_buffer); /* commands */ lcd_puts_scroll(0, 4, str(LANG_BOOKMARK_SELECT_PLAY)); diff --git a/apps/codecs.h b/apps/codecs.h index 75903bc858..b9b4bb4c71 100644 --- a/apps/codecs.h +++ b/apps/codecs.h @@ -168,7 +168,7 @@ struct codec_api { /* Configure different codec buffer parameters. */ void (*configure)(int setting, void *value); - void (*splash)(int ticks, bool center, const char *fmt, ...); + void (*splash)(int ticks, bool center, const unsigned char *fmt, ...); /* file */ int (*PREFIX(open))(const char* pathname, int flags); diff --git a/apps/dbtree.c b/apps/dbtree.c index b8a4c4703e..a9d90b348b 100644 --- a/apps/dbtree.c +++ b/apps/dbtree.c @@ -88,13 +88,13 @@ int db_load(struct tree_context* c) static const int tables[] = {allartists, allalbums, allsongs, search }; char* nbuf = (char*)nptr; - char* labels[] = { str(LANG_ID3DB_ARTISTS), - str(LANG_ID3DB_ALBUMS), - str(LANG_ID3DB_SONGS), - str(LANG_ID3DB_SEARCH)}; + unsigned char* labels[] = { str(LANG_ID3DB_ARTISTS), + str(LANG_ID3DB_ALBUMS), + str(LANG_ID3DB_SONGS), + str(LANG_ID3DB_SEARCH)}; DEBUGF("dbload table root\n"); for (i=0; i < 4; i++) { - strcpy(nbuf, labels[i]); + strcpy(nbuf, (char *)labels[i]); dptr[0] = (unsigned long)nbuf; dptr[1] = tables[i]; nbuf += strlen(nbuf) + 1; @@ -109,12 +109,12 @@ int db_load(struct tree_context* c) searchalbums, searchsongs}; char* nbuf = (char*)nptr; - char* labels[] = { str(LANG_ID3DB_SEARCH_ARTISTS), - str(LANG_ID3DB_SEARCH_ALBUMS), - str(LANG_ID3DB_SEARCH_SONGS)}; + unsigned char* labels[] = { str(LANG_ID3DB_SEARCH_ARTISTS), + str(LANG_ID3DB_SEARCH_ALBUMS), + str(LANG_ID3DB_SEARCH_SONGS)}; DEBUGF("dbload table search\n"); for (i=0; i < 3; i++) { - strcpy(nbuf, labels[i]); + strcpy(nbuf, (char *)labels[i]); dptr[0] = (unsigned long)nbuf; dptr[1] = tables[i]; nbuf += strlen(nbuf) + 1; @@ -131,9 +131,9 @@ int db_load(struct tree_context* c) i = db_search(c, searchstring); c->dirlength = c->filesindir = i; if (c->dirfull) { - gui_syncsplash(HZ, true, "%s %s", - str(LANG_SHOWDIR_ERROR_BUFFER), - str(LANG_SHOWDIR_ERROR_FULL)); + gui_syncsplash(HZ, true, (unsigned char *)"%s %s", + str(LANG_SHOWDIR_ERROR_BUFFER), + str(LANG_SHOWDIR_ERROR_FULL)); c->dirfull = false; } else @@ -313,7 +313,7 @@ int db_load(struct tree_context* c) } if (c->currtable == albums4artist && !c->dirfull) { - strcpy((char*)nptr, str(LANG_ID3DB_ALL_SONGS)); + strcpy((char*)nptr, (char *)str(LANG_ID3DB_ALL_SONGS)); dptr[0] = (unsigned long)nptr; dptr[1] = extra; /* offset to artist */ hits++; @@ -554,7 +554,7 @@ int db_get_icon(struct tree_context* c) } #ifdef HAVE_LCD_BITMAP - return bitmap_icons_6x8[icon]; + return (char *)bitmap_icons_6x8[icon]; #else return icon; #endif diff --git a/apps/filetree.c b/apps/filetree.c index 708c135be7..b870f969b5 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -106,10 +106,10 @@ static void check_file_thumbnails(struct tree_context* c) { int ext_pos; - ext_pos = strlen(entry->d_name) - strlen(file_thumbnail_ext); + ext_pos = strlen((char *)entry->d_name) - strlen(file_thumbnail_ext); if (ext_pos <= 0 /* too short to carry ".talk" */ || (entry->attribute & ATTR_DIRECTORY) /* no file */ - || strcasecmp(&entry->d_name[ext_pos], file_thumbnail_ext)) + || strcasecmp((char *)&entry->d_name[ext_pos], file_thumbnail_ext)) { /* or doesn't end with ".talk", no candidate */ continue; } @@ -121,7 +121,7 @@ static void check_file_thumbnails(struct tree_context* c) /* search corresponding file in dir cache */ for (i=0; i < c->filesindir; i++) { - if (!strcasecmp(dircache[i].name, entry->d_name)) + if (!strcasecmp(dircache[i].name, (char *)entry->d_name)) { /* match */ dircache[i].attr |= TREE_ATTR_THUMBNAIL; /* set the flag */ break; /* exit search loop, because we found it */ @@ -219,14 +219,12 @@ int ft_load(struct tree_context* c, const char* tempdir) if (!entry) break; - len = strlen(entry->d_name); + len = strlen((char *)entry->d_name); /* skip directories . and .. */ if ((entry->attribute & ATTR_DIRECTORY) && - (((len == 1) && - (!strncmp(entry->d_name, ".", 1))) || - ((len == 2) && - (!strncmp(entry->d_name, "..", 2))))) { + (((len == 1) && (!strncmp((char *)entry->d_name, ".", 1))) || + ((len == 2) && (!strncmp((char *)entry->d_name, "..", 2))))) { i--; continue; } @@ -249,7 +247,7 @@ int ft_load(struct tree_context* c, const char* tempdir) /* check for known file types */ if ( !(dptr->attr & ATTR_DIRECTORY) ) - dptr->attr |= filetype_get_attr(entry->d_name); + dptr->attr |= filetype_get_attr((char *)entry->d_name); #ifdef BOOTFILE /* memorize/compare details about the boot file */ @@ -295,7 +293,7 @@ int ft_load(struct tree_context* c, const char* tempdir) dptr->time_write = (long)entry->wrtdate<<16 | (long)entry->wrttime; /* in one # */ - strcpy(dptr->name,entry->d_name); + strcpy(dptr->name, (char *)entry->d_name); name_buffer_used += len + 1; if (dptr->attr & ATTR_DIRECTORY) /* count the remaining dirs */ @@ -384,7 +382,7 @@ int ft_enter(struct tree_context* c) /* wps config file */ case TREE_ATTR_WPS: wps_data_load(gui_wps[0].data, buf, true, true); - set_file(buf, global_settings.wps_file, + set_file(buf, (char *)global_settings.wps_file, MAX_FILENAME); break; @@ -392,7 +390,7 @@ int ft_enter(struct tree_context* c) /* remote-wps config file */ case TREE_ATTR_RWPS: wps_data_load(gui_wps[1].data, buf, true, true); - set_file(buf, global_settings.rwps_file, + set_file(buf, (char *)global_settings.rwps_file, MAX_FILENAME); break; #endif @@ -416,7 +414,7 @@ int ft_enter(struct tree_context* c) case TREE_ATTR_LNG: if(!lang_load(buf)) { - set_file(buf, global_settings.lang_file, + set_file(buf, (char *)global_settings.lang_file, MAX_FILENAME); talk_init(); /* use voice of same language */ gui_syncsplash(HZ, true, str(LANG_LANGUAGE_LOADED)); @@ -426,7 +424,7 @@ int ft_enter(struct tree_context* c) #ifdef HAVE_LCD_BITMAP case TREE_ATTR_FONT: font_load(buf); - set_file(buf, global_settings.font_file, MAX_FILENAME); + set_file(buf, (char *)global_settings.font_file, MAX_FILENAME); break; #endif diff --git a/apps/filetypes.c b/apps/filetypes.c index e2240089ce..4e88f81dec 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -149,7 +149,7 @@ void filetype_init(void) /* get icon */ #ifdef HAVE_LCD_BITMAP -const char* filetype_get_icon(int attr) +const unsigned char* filetype_get_icon(int attr) #else int filetype_get_icon(int attr) #endif @@ -249,7 +249,7 @@ int filetype_load_menu(struct menu_item* menu,int max_items) cp=strrchr(filetypes[i].plugin,'/'); if (cp) cp++; else cp=filetypes[i].plugin; - menu[cnt].desc = cp; + menu[cnt].desc = (unsigned char *)cp; cnt++; if (cnt == max_items) break; @@ -317,14 +317,14 @@ static void scan_plugins(void) /* exttypes[] full, bail out */ if (cnt_exttypes >= MAX_EXTTYPES) { - gui_syncsplash(HZ,true,str(LANG_FILETYPES_EXTENSION_FULL)); + gui_syncsplash(HZ, true, str(LANG_FILETYPES_EXTENSION_FULL)); break; } /* filetypes[] full, bail out */ if (cnt_filetypes >= MAX_FILETYPES) { - gui_syncsplash(HZ,true,str(LANG_FILETYPES_FULL)); + gui_syncsplash(HZ, true, str(LANG_FILETYPES_FULL)); break; } @@ -348,31 +348,31 @@ static void scan_plugins(void) } /* filter out non rock files */ - if (strcasecmp( - &entry->d_name[strlen(entry->d_name) - sizeof(ROCK_EXTENSION) + 1], - ROCK_EXTENSION)) { + if (strcasecmp((char *)&entry->d_name[strlen((char *)entry->d_name) - + sizeof(ROCK_EXTENSION) + 1], + ROCK_EXTENSION)) { continue; } /* filter out to long filenames */ - if (strlen(entry->d_name) > MAX_PLUGIN_LENGTH + 5) + if (strlen((char *)entry->d_name) > MAX_PLUGIN_LENGTH + 5) { - gui_syncsplash(HZ,true,str(LANG_FILETYPES_PLUGIN_NAME_LONG)); + gui_syncsplash(HZ, true, str(LANG_FILETYPES_PLUGIN_NAME_LONG)); continue; } - dot=strrchr(entry->d_name,'.'); + dot=strrchr((char *)entry->d_name,'.'); *dot='\0'; - dash=strchr(entry->d_name,'-'); + dash=strchr((char *)entry->d_name,'-'); /* add plugin and extension */ if (dash) { *dash='\0'; - ix=(filetype_get_attr(entry->d_name) >> 8); + ix=(filetype_get_attr((char *)entry->d_name) >> 8); if (!ix) { - cp=get_string(entry->d_name); + cp=get_string((char *)entry->d_name); if (cp) { exttypes[cnt_exttypes].extension=cp; @@ -385,7 +385,7 @@ static void scan_plugins(void) cnt_exttypes++; *dash='-'; - cp=get_string(entry->d_name); + cp=get_string((char *)entry->d_name); if (cp) { filetypes[cnt_filetypes].plugin=cp; @@ -402,7 +402,7 @@ static void scan_plugins(void) *dash='-'; if (!filetypes[ix].plugin) { - cp=get_string(entry->d_name); + cp=get_string((char *)entry->d_name); if (cp) { filetypes[cnt_filetypes].plugin=cp; @@ -421,7 +421,7 @@ static void scan_plugins(void) for (i = first_soft_filetype; i < cnt_filetypes; i++) { if (filetypes[i].plugin) - if (!strcasecmp(filetypes[i].plugin,entry->d_name)) + if (!strcasecmp(filetypes[i].plugin, (char *)entry->d_name)) { found=true; break; @@ -430,7 +430,7 @@ static void scan_plugins(void) if (!found) { - cp=get_string(entry->d_name); + cp=get_string((char *)entry->d_name); if (cp) { filetypes[cnt_filetypes].plugin=cp; @@ -477,7 +477,7 @@ static int add_plugin(char *plugin) { cp = string2icon(icon); if (cp) - filetypes[cnt_filetypes].icon = cp; + filetypes[cnt_filetypes].icon = (unsigned char *)cp; else return 0; } @@ -498,7 +498,7 @@ static int add_plugin(char *plugin) { cp = string2icon(icon); if (cp) - filetypes[cnt_filetypes].icon = cp; + filetypes[cnt_filetypes].icon = (unsigned char *)cp; else return 0; } @@ -538,13 +538,13 @@ bool read_config(const char* file) { if (cnt_exttypes >= MAX_EXTTYPES) { - gui_syncsplash(HZ,true,str(LANG_FILETYPES_EXTENSION_FULL)); + gui_syncsplash(HZ, true, str(LANG_FILETYPES_EXTENSION_FULL)); break; } if (cnt_filetypes >= MAX_FILETYPES) { - gui_syncsplash(HZ,true,str(LANG_FILETYPES_FULL)); + gui_syncsplash(HZ, true, str(LANG_FILETYPES_FULL)); break; } @@ -635,7 +635,7 @@ bool read_config(const char* file) { cp = string2icon(str[icon]); if (cp) - exttypes[i].type->icon = cp; + exttypes[i].type->icon = (unsigned char *)cp; } } } @@ -713,7 +713,7 @@ static char* string2icon(const char* str) (unsigned long) string_buffer - (unsigned long) next_free_string) < ICON_LENGTH) { - gui_syncsplash(HZ,true,str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); + gui_syncsplash(HZ, true, str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); return NULL; } @@ -762,14 +762,14 @@ static char* get_string(const char* str) (unsigned long) string_buffer - (unsigned long) next_free_string)) { - strcpy(next_free_string,str); + strcpy(next_free_string, str); cp=next_free_string; next_free_string=&next_free_string[l]; return cp; } else { - gui_syncsplash(HZ,true,str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); + gui_syncsplash(HZ, true, str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); return NULL; } } diff --git a/apps/filetypes.h b/apps/filetypes.h index e72dd6ffd3..7416c93b00 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h @@ -25,7 +25,7 @@ int filetype_get_attr(const char*); #ifdef HAVE_LCD_BITMAP -const char* filetype_get_icon(int); +const unsigned char* filetype_get_icon(int); #else int filetype_get_icon(int); #endif diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index afc00a4519..665f6f4bb0 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -1130,7 +1130,7 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir, /* load the image */ ret = read_bmp_file(imgname, &data->img[n].w, - &data->img[n].h, img_buf_ptr, + &data->img[n].h, (char *)img_buf_ptr, img_buf_free); if (ret > 0) { @@ -1389,10 +1389,11 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, #endif #ifdef HAVE_LCD_BITMAP /* calculate different string sizes and positions */ - display->getstringsize(" ", &space_width, &string_height); + display->getstringsize((unsigned char *)" ", &space_width, &string_height); if (data->format_align[i][data->curr_subline[i]].left != 0) { - display->getstringsize(data->format_align[i][data->curr_subline[i]].left, - &left_width, &string_height); + display->getstringsize((unsigned char *)data->format_align[i] + [data->curr_subline[i]].left, + &left_width, &string_height); } else { left_width = 0; @@ -1400,8 +1401,9 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, left_xpos = 0; if (data->format_align[i][data->curr_subline[i]].center != 0) { - display->getstringsize(data->format_align[i][data->curr_subline[i]].center, - ¢er_width, &string_height); + display->getstringsize((unsigned char *)data->format_align[i] + [data->curr_subline[i]].center, + ¢er_width, &string_height); } else { center_width = 0; @@ -1409,8 +1411,9 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, center_xpos=(display->width - center_width) / 2; if (data->format_align[i][data->curr_subline[i]].right != 0) { - display->getstringsize(data->format_align[i][data->curr_subline[i]].right, - &right_width, &string_height); + display->getstringsize((unsigned char *)data->format_align[i] + [data->curr_subline[i]].right, + &right_width, &string_height); } else { right_width = 0; @@ -1517,7 +1520,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, if (left_width>display->width) { display->puts_scroll(0, i, - data->format_align[i][data->curr_subline[i]].left); + (unsigned char *)data->format_align[i] + [data->curr_subline[i]].left); } else { /* clear the line first */ display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); @@ -1526,23 +1530,26 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, /* Nasty hack: we output an empty scrolling string, which will reset the scroller for that line */ - display->puts_scroll(0, i, ""); + display->puts_scroll(0, i, (unsigned char *)""); /* print aligned strings */ if (left_width != 0) { display->putsxy(left_xpos, ypos, - data->format_align[i][data->curr_subline[i]].left); + (unsigned char *)data->format_align[i] + [data->curr_subline[i]].left); } if (center_width != 0) { display->putsxy(center_xpos, ypos, - data->format_align[i][data->curr_subline[i]].center); + (unsigned char *)data->format_align[i] + [data->curr_subline[i]].center); } if (right_width != 0) { display->putsxy(right_xpos, ypos, - data->format_align[i][data->curr_subline[i]].right); + (unsigned char *)data->format_align[i] + [data->curr_subline[i]].right); } } #else @@ -1568,23 +1575,26 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, /* Nasty hack: we output an empty scrolling string, which will reset the scroller for that line */ - display->puts_scroll(0, i, ""); + display->puts_scroll(0, i, (unsigned char *)""); /* print aligned strings */ if (left_width != 0) { display->putsxy(left_xpos, ypos, - data->format_align[i][data->curr_subline[i]].left); + (unsigned char *)data->format_align[i] + [data->curr_subline[i]].left); } if (center_width != 0) { display->putsxy(center_xpos, ypos, - data->format_align[i][data->curr_subline[i]].center); + (unsigned char *)data->format_align[i] + [data->curr_subline[i]].center); } if (right_width != 0) { display->putsxy(right_xpos, ypos, - data->format_align[i][data->curr_subline[i]].right); + (unsigned char *)data->format_align[i] + [data->curr_subline[i]].right); } #else update_line = true; diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 551888544f..fffa520b4f 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -186,7 +186,7 @@ static void splash(struct screen * screen, } void gui_splash(struct screen * screen, int ticks, - bool center, const char *fmt, ...) + bool center, const unsigned char *fmt, ...) { va_list ap; va_start( ap, fmt ); @@ -197,7 +197,7 @@ void gui_splash(struct screen * screen, int ticks, sleep(ticks); } -void gui_syncsplash(int ticks, bool center, const char *fmt, ...) +void gui_syncsplash(int ticks, bool center, const unsigned char *fmt, ...) { va_list ap; int i; diff --git a/apps/gui/splash.h b/apps/gui/splash.h index b1aece9dde..9d8def16f8 100644 --- a/apps/gui/splash.h +++ b/apps/gui/splash.h @@ -39,6 +39,6 @@ extern void gui_splash(struct screen * screen, int ticks, * - fmt : what to say *printf style */ extern void gui_syncsplash(int ticks, bool center, - const char *fmt, ...); + const unsigned char *fmt, ...); #endif /* _GUI_ICON_H_ */ diff --git a/apps/gui/textarea.c b/apps/gui/textarea.c index 1ddb70eadf..54aa7e4a6c 100644 --- a/apps/gui/textarea.c +++ b/apps/gui/textarea.c @@ -49,7 +49,7 @@ int gui_textarea_put_message(struct screen * display, int i; gui_textarea_clear(display); for(i=0;inb_lines && i+ystartnb_lines;i++) - display->puts_scroll(0, i+ystart, message->message_lines[i]); + display->puts_scroll(0, i+ystart, (unsigned char *)message->message_lines[i]); gui_textarea_update(display); return(i); } @@ -64,7 +64,8 @@ void gui_textarea_update_nblines(struct screen * display) if(global_settings.buttonbar && display->has_buttonbar) height -= BUTTONBAR_HEIGHT; #endif - display->getstringsize("A", &display->char_width, &display->char_height); + display->getstringsize((unsigned char *)"A", &display->char_width, + &display->char_height); display->nb_lines = height / display->char_height; #else display->char_width = 1; diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 220f1814dc..3345a691ca 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c @@ -55,8 +55,8 @@ bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result) } enum yesno_res gui_syncyesno_run(struct text_message * main_message, - struct text_message * yes_message, - struct text_message * no_message) + struct text_message * yes_message, + struct text_message * no_message) { int i; unsigned button; diff --git a/apps/language.c b/apps/language.c index 14fc7f1742..7a1442517d 100644 --- a/apps/language.c +++ b/apps/language.c @@ -36,7 +36,7 @@ void lang_init(void) for (i = 0; i < LANG_LAST_INDEX_IN_ARRAY; i++) { language_strings[i] = ptr; - ptr += strlen(ptr) + 1; /* advance pointer to next string */ + ptr += strlen((char *)ptr) + 1; /* advance pointer to next string */ } } diff --git a/apps/main_menu.c b/apps/main_menu.c index 8bdb6fec2e..b04a91f55d 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -153,29 +153,29 @@ bool show_info(void) integer = buflen / 1000; decimal = buflen % 1000; #ifdef HAVE_LCD_CHARCELLS - snprintf(s, sizeof(s), str(LANG_BUFFER_STAT_PLAYER), + snprintf(s, sizeof(s), (char *)str(LANG_BUFFER_STAT_PLAYER), integer, decimal); #else - snprintf(s, sizeof(s), str(LANG_BUFFER_STAT_RECORDER), + snprintf(s, sizeof(s), (char *)str(LANG_BUFFER_STAT_RECORDER), integer, decimal); #endif - lcd_puts(0, y++, s); + lcd_puts(0, y++, (unsigned char *)s); #ifdef HAVE_CHARGE_CTRL if (charge_state == 1) - snprintf(s, sizeof(s), str(LANG_BATTERY_CHARGE)); + snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_CHARGE)); else if (charge_state == 2) - snprintf(s, sizeof(s), str(LANG_BATTERY_TOPOFF_CHARGE)); + snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TOPOFF_CHARGE)); else if (charge_state == 3) - snprintf(s, sizeof(s), str(LANG_BATTERY_TRICKLE_CHARGE)); + snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TRICKLE_CHARGE)); else #endif if (battery_level() >= 0) - snprintf(s, sizeof(s), str(LANG_BATTERY_TIME), battery_level(), + snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TIME), battery_level(), battery_time() / 60, battery_time() % 60); else strncpy(s, "(n/a)", sizeof(s)); - lcd_puts(0, y++, s); + lcd_puts(0, y++, (unsigned char *)s); } if (state & 2) { @@ -188,7 +188,7 @@ bool show_info(void) output_dyn_value(s1, sizeof s1, size, kbyte_units, true); snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1); #endif - lcd_puts(0, y++, s); + lcd_puts(0, y++, (unsigned char *)s); #ifdef HAVE_MULTIVOLUME if (size2) { @@ -196,12 +196,12 @@ bool show_info(void) output_dyn_value(s2, sizeof s2, size2, kbyte_units, true); snprintf(s, sizeof s, "%s %s/%s", str(LANG_DISK_NAME_MMC), s1, s2); - lcd_puts(0, y++, s); + lcd_puts(0, y++, (unsigned char *)s); } #else output_dyn_value(s1, sizeof s1, free, kbyte_units, true); snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_FREE_INFO), s1); - lcd_puts(0, y++, s); + lcd_puts(0, y++, (unsigned char *)s); #endif } lcd_update(); diff --git a/apps/menu.c b/apps/menu.c index 42ae2b8890..26df94b5a7 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -252,7 +252,7 @@ void menu_insert(int menu, int position, char *desc, bool (*function) (void)) menus[menu].items[i] = menus[menu].items[i - 1]; /* Update the current item */ - menus[menu].items[position].desc = desc; + menus[menu].items[position].desc = (unsigned char *)desc; menus[menu].items[position].function = function; gui_synclist_add_item(&(menus[menu].synclist)); } @@ -347,7 +347,7 @@ void put_cursorxy(int x, int y, bool on) if (global_settings.invert_cursor) return; - lcd_getstringsize("A", &fw, &fh); + lcd_getstringsize((unsigned char *)"A", &fw, &fh); xpos = x*6; ypos = y*fh + lcd_getymargin(); if ( fh > 8 ) diff --git a/apps/misc.c b/apps/misc.c index c40eac0def..755eba095f 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -137,11 +137,11 @@ char *create_numbered_filename(char *buffer, const char *path, { int curr_num; - if (strncasecmp(entry->d_name, prefix, prefixlen) - || strcasecmp(entry->d_name + prefixlen + numberlen, suffix)) + if (strncasecmp((char *)entry->d_name, prefix, prefixlen) + || strcasecmp((char *)entry->d_name + prefixlen + numberlen, suffix)) continue; - curr_num = atoi(entry->d_name + prefixlen); + curr_num = atoi((char *)entry->d_name + prefixlen); if (curr_num > max_num) max_num = curr_num; } @@ -591,16 +591,16 @@ int show_logo( void ) snprintf(version, sizeof(version), "Ver. %s", appsversion); lcd_setfont(FONT_SYSFIXED); - lcd_getstringsize("A", &font_w, &font_h); + lcd_getstringsize((unsigned char *)"A", &font_w, &font_h); lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2), - LCD_HEIGHT-font_h, version); + LCD_HEIGHT-font_h, (unsigned char *)version); lcd_update(); #ifdef HAVE_REMOTE_LCD lcd_remote_setfont(FONT_SYSFIXED); - lcd_remote_getstringsize("A", &font_w, &font_h); + lcd_remote_getstringsize((unsigned char *)"A", &font_w, &font_h); lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - ((strlen(version)*font_w)/2), - LCD_REMOTE_HEIGHT-font_h, version); + LCD_REMOTE_HEIGHT-font_h, (unsigned char *)version); lcd_remote_update(); #endif diff --git a/apps/onplay.c b/apps/onplay.c index 8c22a58b3e..dac5d4b27f 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -123,11 +123,12 @@ static bool list_viewers(void) result = menu_show(m); menu_exit(m); if (result >= 0) - ret = filetype_load_plugin(menu[result].desc,selected_file); + ret = filetype_load_plugin((char *)menu[result].desc,selected_file); } else { - gui_syncsplash(HZ*2, true, "No viewers found"); + /* FIX: translation! */ + gui_syncsplash(HZ*2, true, (unsigned char *)"No viewers found"); } if (ret == PLUGIN_USB_CONNECTED) @@ -182,12 +183,12 @@ static bool add_to_playlist(int position, bool queue) bool exit = false; lcd_clear_display(); - lcd_puts_scroll(0,0,str(LANG_RECURSE_DIRECTORY_QUESTION)); - lcd_puts_scroll(0,1,selected_file); + lcd_puts_scroll(0, 0, str(LANG_RECURSE_DIRECTORY_QUESTION)); + lcd_puts_scroll(0, 1, (unsigned char *)selected_file); #ifdef HAVE_LCD_BITMAP - lcd_puts(0,3,str(LANG_CONFIRM_WITH_PLAY_RECORDER)); - lcd_puts(0,4,str(LANG_CANCEL_WITH_ANY_RECORDER)); + lcd_puts(0, 3, str(LANG_CONFIRM_WITH_PLAY_RECORDER)); + lcd_puts(0, 4, str(LANG_CANCEL_WITH_ANY_RECORDER)); #endif lcd_update(); @@ -365,8 +366,8 @@ static int remove_dir(char* dirname, int len) if (entry->attribute & ATTR_DIRECTORY) { /* remove a subdirectory */ - if (!strcmp(entry->d_name, ".") || - !strcmp(entry->d_name, "..")) + if (!strcmp((char *)entry->d_name, ".") || + !strcmp((char *)entry->d_name, "..")) continue; /* skip these */ result = remove_dir(dirname, len); /* recursion */ @@ -395,11 +396,11 @@ static int remove_dir(char* dirname, int len) static bool delete_handler(bool is_dir) { char *lines[]={ - str(LANG_REALLY_DELETE), + (char *)str(LANG_REALLY_DELETE), selected_file }; char *yes_lines[]={ - str(LANG_DELETED), + (char *)str(LANG_DELETED), selected_file }; @@ -476,7 +477,8 @@ bool create_dir(void) rc = mkdir(dirname, 0); if (rc < 0) { - gui_syncsplash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED)); + gui_syncsplash(HZ, true, (unsigned char *)"%s %s", + str(LANG_CREATE_DIR), str(LANG_FAILED)); } else { onplay_result = ONPLAY_RELOAD_DIR; } diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 6024756c74..474d09ee5f 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -267,8 +267,8 @@ void pcmbuf_play_stop(void) void pcmbuf_init(long bufsize) { pcmbuf_size = bufsize; - audiobuffer = &audiobuf[(audiobufend - audiobuf) - - pcmbuf_size - PCMBUF_GUARD]; + audiobuffer = (char *)&audiobuf[(audiobufend - audiobuf) - + pcmbuf_size - PCMBUF_GUARD]; guardbuf = &audiobuffer[pcmbuf_size]; pcmbuf_event_handler = NULL; pcmbuf_play_stop(); diff --git a/apps/playback.c b/apps/playback.c index c8fd5d81d6..a61b8128ae 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -222,8 +222,8 @@ static void do_swap(int idx_old, int idx_new) memcpy(iram_p, iram_buf[idx_new], CODEC_IRAM_SIZE); #endif - dram_buf[0] = &filebuf[filebuflen+CODEC_IRAM_SIZE*2]; - dram_buf[1] = &filebuf[filebuflen+CODEC_IRAM_SIZE*2+CODEC_SIZE]; + dram_buf[0] = (unsigned char *)&filebuf[filebuflen+CODEC_IRAM_SIZE*2]; + dram_buf[1] = (unsigned char *)&filebuf[filebuflen+CODEC_IRAM_SIZE*2+CODEC_SIZE]; memcpy(dram_buf[idx_old], codecbuf, CODEC_SIZE); memcpy(codecbuf, dram_buf[idx_new], CODEC_SIZE); } @@ -1924,7 +1924,7 @@ void codec_thread(void) static void reset_buffer(void) { - filebuf = &audiobuf[MALLOC_BUFSIZE]; + filebuf = (char *)&audiobuf[MALLOC_BUFSIZE]; filebuflen = audiobufend - audiobuf - pcmbuf_get_bufsize() - PCMBUF_GUARD - MALLOC_BUFSIZE - GUARD_BUFSIZE; @@ -2287,7 +2287,7 @@ void mp3_play_data(const unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size)) { voice_getmore = get_more; - voicebuf = (unsigned char *)start; + voicebuf = (char *)start; voice_remaining = size; voice_is_playing = true; pcmbuf_reset_mixpos(); @@ -2334,7 +2334,7 @@ void audio_set_crossfade(int enable) /* Re-initialize audio system. */ if (was_playing) - gui_syncsplash(0, true, str(LANG_RESTARTING_PLAYBACK)); + gui_syncsplash(0, true, (char *)str(LANG_RESTARTING_PLAYBACK)); pcmbuf_init(size); pcmbuf_crossfade_enable(enable); reset_buffer(); @@ -2385,7 +2385,7 @@ void audio_init(void) filebufused = 0; filling = false; current_codec = CODEC_IDX_AUDIO; - filebuf = &audiobuf[MALLOC_BUFSIZE]; + filebuf = (char *)&audiobuf[MALLOC_BUFSIZE]; playing = false; audio_codec_loaded = false; voice_is_playing = false; diff --git a/apps/playlist.c b/apps/playlist.c index e0a2b9ba6e..46556bff12 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -173,7 +173,7 @@ static int get_previous_directory(char *dir); static int check_subdir_for_music(char *dir, char *subdir); static int format_track_path(char *dest, char *src, int buf_length, int max, char *dir); -static void display_playlist_count(int count, const char *fmt); +static void display_playlist_count(int count, const unsigned char *fmt); static void display_buffer_full(void); static int flush_pending_control(struct playlist_info* playlist); static int rotate_index(const struct playlist_info* playlist, int index); @@ -274,9 +274,9 @@ static void create_control(struct playlist_info* playlist) { if (check_rockboxdir()) { - gui_syncsplash(HZ*2, true, "%s (%d)", - str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), - playlist->control_fd); + gui_syncsplash(HZ*2, true, (unsigned char *)"%s (%d)", + str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), + playlist->control_fd); } playlist->control_created = false; } @@ -375,7 +375,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist, audio_stop(); talk_buffer_steal(); /* we use the mp3 buffer, need to tell */ - buffer = audiobuf; + buffer = (char *)audiobuf; buflen = (audiobufend - audiobuf); } @@ -388,7 +388,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist, if(nread <= 0) break; - p = buffer; + p = (unsigned char *)buffer; for(count=0; count < nread; count++,p++) { @@ -598,7 +598,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist, bool queue, int *count, bool recurse) { char buf[MAX_PATH+1]; - char *count_str; + unsigned char *count_str; int result = 0; int num_files = 0; int i; @@ -1512,7 +1512,7 @@ static int format_track_path(char *dest, char *src, int buf_length, int max, * Display splash message showing progress of playlist/directory insertion or * save. */ -static void display_playlist_count(int count, const char *fmt) +static void display_playlist_count(int count, const unsigned char *fmt) { lcd_clear_display(); @@ -1525,9 +1525,9 @@ static void display_playlist_count(int count, const char *fmt) gui_syncsplash(0, true, fmt, count, #if CONFIG_KEYPAD == PLAYER_PAD - str(LANG_STOP_ABORT) + str(LANG_STOP_ABORT) #else - str(LANG_OFF_ABORT) + str(LANG_OFF_ABORT) #endif ); } @@ -1537,9 +1537,9 @@ static void display_playlist_count(int count, const char *fmt) */ static void display_buffer_full(void) { - gui_syncsplash(HZ*2, true, "%s %s", - str(LANG_PLAYINDICES_PLAYLIST), - str(LANG_PLAYINDICES_BUFFER)); + gui_syncsplash(HZ*2, true, (unsigned char *)"%s %s", + str(LANG_PLAYINDICES_PLAYLIST), + str(LANG_PLAYINDICES_BUFFER)); } /* @@ -1684,10 +1684,10 @@ int playlist_resume(void) #if CONFIG_CODEC != SWCODEC talk_buffer_steal(); /* we use the mp3 buffer, need to tell */ buflen = (audiobufend - audiobuf); - buffer = audiobuf; + buffer = (char *)audiobuf; #else buflen = (audiobufend - audiobuf - talk_get_bufsize()); - buffer = &audiobuf[talk_get_bufsize()]; + buffer = (char *)&audiobuf[talk_get_bufsize()]; #endif empty_playlist(playlist, true); @@ -2602,7 +2602,7 @@ int playlist_insert_directory(struct playlist_info* playlist, { int count = 0; int result; - char *count_str; + unsigned char *count_str; if (!playlist) playlist = ¤t_playlist; @@ -2649,7 +2649,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename, int max; char *temp_ptr; char *dir; - char *count_str; + unsigned char *count_str; char temp_buf[MAX_PATH+1]; char trackname[MAX_PATH+1]; int count = 0; diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c index c6ccd5a45a..d59661a96c 100644 --- a/apps/playlist_menu.c +++ b/apps/playlist_menu.c @@ -55,7 +55,7 @@ static bool recurse_directory(void) { STR(LANG_RESUME_SETTING_ASK)}, }; - return set_option( str(LANG_RECURSE_DIRECTORY), + return set_option( (char *)str(LANG_RECURSE_DIRECTORY), &global_settings.recursive_dir_insert, INT, names, 3, NULL ); } diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index b41bee3c20..c249142bda 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -514,15 +514,15 @@ static bool viewer_menu(void) /* Show icons in viewer? */ static bool show_icons(void) { - return set_bool(str(LANG_SHOW_ICONS), - &global_settings.playlist_viewer_icons); + return set_bool((char *)str(LANG_SHOW_ICONS), + &global_settings.playlist_viewer_icons); } /* Show indices of tracks? */ static bool show_indices(void) { - return set_bool(str(LANG_SHOW_INDICES), - &global_settings.playlist_viewer_indices); + return set_bool((char *)str(LANG_SHOW_INDICES), + &global_settings.playlist_viewer_indices); } /* How to display a track */ @@ -533,8 +533,9 @@ static bool track_display(void) { STR(LANG_DISPLAY_FULL_PATH) } }; - return set_option(str(LANG_TRACK_DISPLAY), - &global_settings.playlist_viewer_track_display, INT, names, 2, NULL); + return set_option((char *)str(LANG_TRACK_DISPLAY), + &global_settings.playlist_viewer_track_display, INT, names, 2, + NULL); } /* Save playlist to disk */ diff --git a/apps/plugin.h b/apps/plugin.h index f8e84f8cae..92f1d4ea8b 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -201,7 +201,7 @@ struct plugin_api { void (*backlight_on)(void); void (*backlight_off)(void); void (*backlight_set_timeout)(int index); - void (*splash)(int ticks, bool center, const char *fmt, ...); + void (*splash)(int ticks, bool center, const unsigned char *fmt, ...); #ifdef HAVE_REMOTE_LCD /* remote lcd */ diff --git a/apps/screens.c b/apps/screens.c index 41b51cc0ac..6c6c5325be 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -521,23 +521,23 @@ bool quick_screen_quick(int button_enter) struct gui_quickscreen qs; option_select_init_items(&left_option, - str(LANG_SHUFFLE), + (char *)str(LANG_SHUFFLE), bool_to_int(global_settings.playlist_shuffle), left_items, 2); option_select_init_items(&bottom_option, - str(LANG_FILTER), + (char *)str(LANG_FILTER), global_settings.dirfilter, bottom_items, sizeof(bottom_items)/sizeof(struct opt_items)); option_select_init_items(&right_option, - str(LANG_REPEAT), + (char *)str(LANG_REPEAT), global_settings.repeat_mode, right_items, sizeof(right_items)/sizeof(struct opt_items)); gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option, - str(LANG_F2_MODE), &quick_screen_quick_apply); + (char *)str(LANG_F2_MODE), &quick_screen_quick_apply); oldrepeat=global_settings.repeat_mode; res=gui_syncquickscreen_run(&qs, button_enter); if(!res) @@ -619,7 +619,7 @@ bool quick_screen_f3(int button_enter) #if defined(HAVE_CHARGING) || defined(SIMULATOR) void charging_splash(void) { - gui_syncsplash(2*HZ, true, str(LANG_BATTERY_CHARGE)); + gui_syncsplash(2*HZ, true, (char *)str(LANG_BATTERY_CHARGE)); button_clear_queue(); } #endif @@ -1184,8 +1184,8 @@ bool set_rating(void) { lcd_clear_display(); lcd_puts(0, 0, str(LANG_RATING)); - snprintf(rating_text,sizeof(rating_text),"%d",id3->rating); - lcd_puts(0,1,rating_text); + snprintf(rating_text, sizeof(rating_text), "%d", id3->rating); + lcd_puts(0, 1, (unsigned char *)rating_text); lcd_update(); button = button_get(true); 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 ) save_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8); save_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), RTC_BLOCK_SIZE*8); - strncpy(&config_block[0xb8], global_settings.wps_file, MAX_FILENAME); - strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); - strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); + strncpy((char *)&config_block[0xb8], (char *)global_settings.wps_file, + MAX_FILENAME); + strncpy((char *)&config_block[0xcc], (char *)global_settings.lang_file, + MAX_FILENAME); + strncpy((char *)&config_block[0xe0], (char *)global_settings.font_file, + MAX_FILENAME); #ifdef HAVE_REMOTE_LCD - strncpy(&config_block[0xf4], global_settings.rwps_file, MAX_FILENAME); + strncpy((char *)&config_block[0xf4], (char *)global_settings.rwps_file, + MAX_FILENAME); #endif if(save_config_buffer()) @@ -1053,11 +1057,15 @@ void settings_load(int which) if ( global_settings.contrast < MIN_CONTRAST_SETTING ) global_settings.contrast = lcd_default_contrast(); - strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME); - strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); - strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); + strncpy((char *)global_settings.wps_file, (char *)&config_block[0xb8], + MAX_FILENAME); + strncpy((char *)global_settings.lang_file, (char *)&config_block[0xcc], + MAX_FILENAME); + strncpy((char *)global_settings.font_file, (char *)&config_block[0xe0], + MAX_FILENAME); #ifdef HAVE_REMOTE_LCD - strncpy(global_settings.rwps_file, &config_block[0xf4], MAX_FILENAME); + strncpy((char *)global_settings.rwps_file, (char *)&config_block[0xf4], + MAX_FILENAME); #endif } } @@ -1198,25 +1206,25 @@ bool settings_load_config(const char* file) /* check for the string values */ if (!strcasecmp(name, "wps")) { if (wps_data_load(gui_wps[0].data,value,true, false)) - set_file(value, global_settings.wps_file, MAX_FILENAME); + set_file(value, (char *)global_settings.wps_file, MAX_FILENAME); } #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) else if (!strcasecmp(name, "rwps")) { if (wps_data_load(gui_wps[1].data,value,true, false)) - set_file(value, global_settings.rwps_file, MAX_FILENAME); + set_file(value, (char *)global_settings.rwps_file, MAX_FILENAME); } #endif else if (!strcasecmp(name, "lang")) { if (!lang_load(value)) { - set_file(value, global_settings.lang_file, MAX_FILENAME); + set_file(value, (char *)global_settings.lang_file, MAX_FILENAME); talk_init(); /* use voice of same language */ } } #ifdef HAVE_LCD_BITMAP else if (!strcasecmp(name, "font")) { if (font_load(value)) - set_file(value, global_settings.font_file, MAX_FILENAME); + set_file(value, (char *)global_settings.font_file, MAX_FILENAME); } #endif @@ -1367,7 +1375,7 @@ bool settings_save_config(void) close(fd); - gui_syncsplash(HZ, true, "%s %s", str(LANG_SETTINGS_SAVED1), + gui_syncsplash(HZ, true, (unsigned char *)"%s %s", str(LANG_SETTINGS_SAVED1), str(LANG_SETTINGS_SAVED2)); return true; } @@ -1447,9 +1455,9 @@ void settings_reset(void) { bool set_bool(const char* string, bool* variable ) { return set_bool_options(string, variable, - STR(LANG_SET_BOOL_YES), - STR(LANG_SET_BOOL_NO), - NULL); + (char *)STR(LANG_SET_BOOL_YES), + (char *)STR(LANG_SET_BOOL_NO), + NULL); } /* 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, const char* no_str, int no_voice, void (*function)(bool)) { - struct opt_items names[] = { {no_str, no_voice}, {yes_str, yes_voice} }; + struct opt_items names[] = { + {(unsigned char *)no_str, no_voice}, + {(unsigned char *)yes_str, yes_voice} + }; bool result; boolfunction = function; @@ -1492,7 +1503,7 @@ void talk_unit(int unit, int value) } } -bool set_int(const char* string, +bool set_int(const unsigned char* string, const char* unit, int voice_unit, int* variable, @@ -1505,7 +1516,8 @@ bool set_int(const char* string, int button; int oldvalue=*variable; struct gui_select select; - gui_select_init_numeric(&select, string, *variable, min, max, step, unit, formatter); + gui_select_init_numeric(&select, (char *)string, *variable, min, max, step, unit, + formatter); gui_syncselect_draw(&select); talk_unit(voice_unit, *variable); while (!gui_select_is_validated(&select)) diff --git a/apps/settings.h b/apps/settings.h index 9f9cc63602..6c675463f1 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -139,7 +139,7 @@ extern unsigned char vp_dummy[VIRT_SIZE]; #define ID2P(id) (VIRT_PTR + id) /* resolve a pointer which could be a virtualized ID or a literal */ -#define P2STR(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? str(p-VIRT_PTR) : p) +#define P2STR(p) (char *)((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? str(p-VIRT_PTR) : p) /* get the string ID from a virtual pointer, -1 if not virtual */ #define P2ID(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? p-VIRT_PTR : -1) @@ -403,7 +403,8 @@ bool set_bool_options(const char* string, bool* variable, bool set_bool(const char* string, bool* variable ); bool set_option(const char* string, void* variable, enum optiontype type, const struct opt_items* options, int numoptions, void (*function)(int)); -bool set_int(const char* string, const char* unit, int voice_unit, int* variable, +bool set_int(const unsigned char* string, const char* unit, int voice_unit, + int* variable, void (*function)(int), int step, int min, int max, void (*formatter)(char*, int, int, const char*) ); bool set_time_screen(const char* string, struct tm *tm); diff --git a/apps/settings_menu.c b/apps/settings_menu.c index ca352fd8ff..5f902e2ef9 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -88,7 +88,7 @@ static bool car_adapter_mode(void) */ static bool show_icons(void) { - return set_bool( str(LANG_SHOW_ICONS), &global_settings.show_icons ); + return set_bool( (char *)str(LANG_SHOW_ICONS), &global_settings.show_icons ); } #ifdef HAVE_REMOTE_LCD @@ -102,9 +102,9 @@ static bool remote_contrast(void) static bool remote_invert(void) { - bool rc = set_bool_options(str(LANG_INVERT), + bool rc = set_bool_options((char *)str(LANG_INVERT), &global_settings.remote_invert, - STR(LANG_INVERT_LCD_INVERSE), + (char *)STR(LANG_INVERT_LCD_INVERSE), STR(LANG_INVERT_LCD_NORMAL), lcd_remote_set_invert_display); return rc; @@ -112,7 +112,7 @@ static bool remote_invert(void) static bool remote_flip_display(void) { - bool rc = set_bool( str(LANG_FLIP_DISPLAY), + bool rc = set_bool( (char *)str(LANG_FLIP_DISPLAY), &global_settings.remote_flip_display); lcd_remote_set_flip(global_settings.remote_flip_display); @@ -138,35 +138,35 @@ static bool remote_reduce_ticking(void) static const struct opt_items backlight_timeouts[] = { { STR(LANG_OFF) }, { STR(LANG_ON) }, - { "1s ", TALK_ID(1, UNIT_SEC) }, - { "2s ", TALK_ID(2, UNIT_SEC) }, - { "3s ", TALK_ID(3, UNIT_SEC) }, - { "4s ", TALK_ID(4, UNIT_SEC) }, - { "5s ", TALK_ID(5, UNIT_SEC) }, - { "6s ", TALK_ID(6, UNIT_SEC) }, - { "7s ", TALK_ID(7, UNIT_SEC) }, - { "8s ", TALK_ID(8, UNIT_SEC) }, - { "9s ", TALK_ID(9, UNIT_SEC) }, - { "10s", TALK_ID(10, UNIT_SEC) }, - { "15s", TALK_ID(15, UNIT_SEC) }, - { "20s", TALK_ID(20, UNIT_SEC) }, - { "25s", TALK_ID(25, UNIT_SEC) }, - { "30s", TALK_ID(30, UNIT_SEC) }, - { "45s", TALK_ID(45, UNIT_SEC) }, - { "60s", TALK_ID(60, UNIT_SEC) }, - { "90s", TALK_ID(90, UNIT_SEC) } + { (unsigned char *)"1s ", TALK_ID(1, UNIT_SEC) }, + { (unsigned char *)"2s ", TALK_ID(2, UNIT_SEC) }, + { (unsigned char *)"3s ", TALK_ID(3, UNIT_SEC) }, + { (unsigned char *)"4s ", TALK_ID(4, UNIT_SEC) }, + { (unsigned char *)"5s ", TALK_ID(5, UNIT_SEC) }, + { (unsigned char *)"6s ", TALK_ID(6, UNIT_SEC) }, + { (unsigned char *)"7s ", TALK_ID(7, UNIT_SEC) }, + { (unsigned char *)"8s ", TALK_ID(8, UNIT_SEC) }, + { (unsigned char *)"9s ", TALK_ID(9, UNIT_SEC) }, + { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC) }, + { (unsigned char *)"15s", TALK_ID(15, UNIT_SEC) }, + { (unsigned char *)"20s", TALK_ID(20, UNIT_SEC) }, + { (unsigned char *)"25s", TALK_ID(25, UNIT_SEC) }, + { (unsigned char *)"30s", TALK_ID(30, UNIT_SEC) }, + { (unsigned char *)"45s", TALK_ID(45, UNIT_SEC) }, + { (unsigned char *)"60s", TALK_ID(60, UNIT_SEC) }, + { (unsigned char *)"90s", TALK_ID(90, UNIT_SEC) } }; static bool caption_backlight(void) { - return set_bool( str(LANG_CAPTION_BACKLIGHT), + return set_bool( (char *)str(LANG_CAPTION_BACKLIGHT), &global_settings.caption_backlight); } #ifdef HAVE_CHARGING static bool backlight_timer_plugged(void) { - return set_option(str(LANG_BACKLIGHT_ON_WHEN_CHARGING), + return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING), &global_settings.backlight_timeout_plugged, INT, backlight_timeouts, 19, backlight_set_timeout_plugged ); @@ -175,7 +175,7 @@ static bool backlight_timer_plugged(void) static bool backlight_timer(void) { - return set_option(str(LANG_BACKLIGHT), + return set_option((char *)str(LANG_BACKLIGHT), &global_settings.backlight_timeout, INT, backlight_timeouts, 19, backlight_set_timeout ); @@ -186,9 +186,9 @@ static bool backlight_fade_in(void) { static const struct opt_items names[] = { { STR(LANG_OFF) }, - { "500ms", TALK_ID(500, UNIT_MS) }, - { "1s", TALK_ID(1, UNIT_SEC) }, - { "2s", TALK_ID(2, UNIT_SEC) }, + { (unsigned char *)"500ms", TALK_ID(500, UNIT_MS) }, + { (unsigned char *)"1s", TALK_ID(1, UNIT_SEC) }, + { (unsigned char *)"2s", TALK_ID(2, UNIT_SEC) }, }; return set_option(str(LANG_BACKLIGHT_FADE_IN), &global_settings.backlight_fade_in, @@ -199,13 +199,13 @@ static bool backlight_fade_out(void) { static const struct opt_items names[] = { { STR(LANG_OFF) }, - { "500ms", TALK_ID(500, UNIT_MS) }, - { "1s", TALK_ID(1, UNIT_SEC) }, - { "2s", TALK_ID(2, UNIT_SEC) }, - { "3s", TALK_ID(3, UNIT_SEC) }, - { "4s", TALK_ID(4, UNIT_SEC) }, - { "5s", TALK_ID(5, UNIT_SEC) }, - { "10s", TALK_ID(10, UNIT_SEC) }, + { (unsigned char *)"500ms", TALK_ID(500, UNIT_MS) }, + { (unsigned char *)"1s", TALK_ID(1, UNIT_SEC) }, + { (unsigned char *)"2s", TALK_ID(2, UNIT_SEC) }, + { (unsigned char *)"3s", TALK_ID(3, UNIT_SEC) }, + { (unsigned char *)"4s", TALK_ID(4, UNIT_SEC) }, + { (unsigned char *)"5s", TALK_ID(5, UNIT_SEC) }, + { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC) }, }; return set_option(str(LANG_BACKLIGHT_FADE_OUT), &global_settings.backlight_fade_out, @@ -218,7 +218,7 @@ static bool backlight_fade_out(void) static bool remote_backlight_timer(void) { - return set_option(str(LANG_BACKLIGHT), + return set_option((char *)str(LANG_BACKLIGHT), &global_settings.remote_backlight_timeout, INT, backlight_timeouts, 19, remote_backlight_set_timeout ); @@ -227,7 +227,7 @@ static bool remote_backlight_timer(void) #ifdef HAVE_CHARGING static bool remote_backlight_timer_plugged(void) { - return set_option(str(LANG_BACKLIGHT_ON_WHEN_CHARGING), + return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING), &global_settings.remote_backlight_timeout_plugged, INT, backlight_timeouts, 19, remote_backlight_set_timeout_plugged ); @@ -236,8 +236,8 @@ static bool remote_backlight_timer_plugged(void) static bool remote_caption_backlight(void) { - return set_bool( str(LANG_CAPTION_BACKLIGHT), - &global_settings.remote_caption_backlight); + return set_bool((char *)str(LANG_CAPTION_BACKLIGHT), + &global_settings.remote_caption_backlight); } #endif /* HAVE_REMOTE_LCD */ @@ -256,12 +256,12 @@ static bool contrast(void) */ static bool invert(void) { - bool rc = set_bool_options(str(LANG_INVERT), - &global_settings.invert, - STR(LANG_INVERT_LCD_INVERSE), - STR(LANG_INVERT_LCD_NORMAL), - lcd_set_invert_display); - return rc; + bool rc = set_bool_options(str(LANG_INVERT), + &global_settings.invert, + (char *)STR(LANG_INVERT_LCD_INVERSE), + STR(LANG_INVERT_LCD_NORMAL), + lcd_set_invert_display); + return rc; } /** @@ -1428,12 +1428,15 @@ static bool bookmark_settings_menu(void) } static bool reset_settings(void) { - char *lines[]={str(LANG_RESET_ASK_RECORDER)}; - char *yes_lines[]={str(LANG_RESET_DONE_SETTING), str(LANG_RESET_DONE_CLEAR)}; - char *no_lines[]={yes_lines[0], str(LANG_RESET_DONE_CANCEL)}; - struct text_message message={lines, 1}; - struct text_message yes_message={yes_lines, 2}; - struct text_message no_message={no_lines, 2}; + unsigned char *lines[]={str(LANG_RESET_ASK_RECORDER)}; + unsigned char *yes_lines[]={ + str(LANG_RESET_DONE_SETTING), + str(LANG_RESET_DONE_CLEAR) + }; + unsigned char *no_lines[]={yes_lines[0], str(LANG_RESET_DONE_CANCEL)}; + struct text_message message={(char **)lines, 1}; + struct text_message yes_message={(char **)yes_lines, 2}; + struct text_message no_message={(char **)no_lines, 2}; switch(gui_syncyesno_run(&message, &yes_message, &no_message)) { diff --git a/apps/sleeptimer.c b/apps/sleeptimer.c index 982cbe621a..e9b0924388 100644 --- a/apps/sleeptimer.c +++ b/apps/sleeptimer.c @@ -126,7 +126,7 @@ bool sleeptimer_screen(void) minutes = (seconds - (hours * 3600)) / 60; snprintf(buf, 32, "%d:%02d", hours, minutes); - lcd_puts(0, 1, buf); + lcd_puts(0, 1, (unsigned char *)buf); if (sayit && global_settings.talk_menu) { diff --git a/apps/sound_menu.c b/apps/sound_menu.c index af1a2fdfee..f97cdde2ab 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c @@ -56,7 +56,7 @@ void dec_sound_formatter(char *buffer, int buffer_size, int val, const char * un snprintf(buffer, buffer_size, "%d.%d %s", integer, dec, unit); } -bool set_sound(const char* string, +bool set_sound(const unsigned char * string, int* variable, int setting) { diff --git a/apps/talk.c b/apps/talk.c index ec92578ee6..07ee93bc16 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -115,7 +115,7 @@ static int open_voicefile(void) if ( global_settings.lang_file[0] && global_settings.lang_file[0] != 0xff ) { /* try to open the voice file of the selected language */ - p_lang = global_settings.lang_file; + p_lang = (char *)global_settings.lang_file; } snprintf(buf, sizeof(buf), ROCKBOX_DIR LANG_DIR "/%s.voice", p_lang); diff --git a/apps/tree.c b/apps/tree.c index 1a419c74d2..15624d7618 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -184,12 +184,12 @@ void tree_get_fileicon(int selected_item, void * data, ICON * icon) struct tree_context * local_tc=(struct tree_context *)data; bool id3db = *(local_tc->dirfilter) == SHOW_ID3DB; if (id3db) { - *icon = db_get_icon(&tc); + *icon = (ICON)db_get_icon(&tc); } else { struct entry* dc = local_tc->dircache; struct entry* e = &dc[selected_item]; - *icon = filetype_get_icon(e->attr); + *icon = (ICON)filetype_get_icon(e->attr); } } @@ -423,7 +423,8 @@ static void start_resume(bool just_powered_on) start_wps = true; } else return; - } else if (! just_powered_on) { + } + else if (! just_powered_on) { gui_syncsplash(HZ*2, true, str(LANG_NOTHING_TO_RESUME)); } } @@ -1014,8 +1015,8 @@ static bool add_dir(char* dirname, int len, int fd) int dirlen = strlen(dirname); bool result; - if (!strcmp(entry->d_name, ".") || - !strcmp(entry->d_name, "..")) + if (!strcmp((char *)entry->d_name, ".") || + !strcmp((char *)entry->d_name, "..")) continue; if (dirname[1]) @@ -1031,9 +1032,9 @@ static bool add_dir(char* dirname, int len, int fd) } } else { - int x = strlen(entry->d_name); + int x = strlen((char *)entry->d_name); unsigned int i; - char *cp = strrchr(entry->d_name,'.'); + char *cp = strrchr((char *)entry->d_name,'.'); if (cp) { cp++; @@ -1056,7 +1057,7 @@ static bool add_dir(char* dirname, int len, int fd) FOR_NB_SCREENS(i) { gui_textarea_clear(&screens[i]); - screens[i].puts(0,4,buf); + screens[i].puts(0, 4, (unsigned char *)buf); } #else x = 10; @@ -1098,8 +1099,8 @@ bool create_playlist(void) FOR_NB_SCREENS(i) { gui_textarea_clear(&screens[i]); - screens[i].puts(0,0,str(LANG_CREATING)); - screens[i].puts_scroll(0,1,filename); + screens[i].puts(0, 0, str(LANG_CREATING)); + screens[i].puts_scroll(0, 1, (unsigned char *)filename); #if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) gui_textarea_update(&screens[i]); #endif -- cgit v1.2.3