diff --git a/apps/filetree.c b/apps/filetree.c index 29335fdcbe..4f14e48104 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -552,7 +552,7 @@ int ft_enter(struct tree_context* c) default: { - char* plugin; + const char* plugin; if (global_settings.party_mode) { gui_syncsplash(HZ, ID2P(LANG_PARTY_MODE)); diff --git a/apps/filetypes.c b/apps/filetypes.c index 722456b8f4..ead2295f70 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -518,5 +518,5 @@ int filetype_load_plugin(const char* plugin, char* file) return PLUGIN_ERROR; snprintf(plugin_name, MAX_PATH, "%s/%s.%s", PLUGIN_DIR, filetypes[i].plugin, ROCK_EXTENSION); - return plugin_load(plugin_name,file); + return plugin_load(plugin_name, file); } diff --git a/apps/filetypes.h b/apps/filetypes.h index 52e60eab1f..66553e5b24 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h @@ -60,7 +60,7 @@ void read_color_theme_file(void); /* Return the attribute (FILE_ATTR_*) of the file */ int filetype_get_attr(const char* file); #ifdef HAVE_LCD_COLOR -int filetype_get_color(const char * name, int attr); +int filetype_get_color(const char* name, int attr); #endif int filetype_get_icon(int attr); /* return the plugin filename associated with the file */ diff --git a/apps/gui/backdrop.c b/apps/gui/backdrop.c index 0d023602be..67f96a31f2 100644 --- a/apps/gui/backdrop.c +++ b/apps/gui/backdrop.c @@ -42,7 +42,7 @@ static bool main_backdrop_valid = false; static bool wps_backdrop_valid = false; /* load a backdrop into a buffer */ -static bool load_backdrop(char* filename, fb_data* backdrop_buffer) +static bool load_backdrop(const char* filename, fb_data* backdrop_buffer) { struct bitmap bm; int ret; @@ -62,13 +62,13 @@ static bool load_backdrop(char* filename, fb_data* backdrop_buffer) } } -bool load_main_backdrop(char* filename) +bool load_main_backdrop(const char* filename) { main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); return main_backdrop_valid; } -bool load_wps_backdrop(char* filename) +bool load_wps_backdrop(const char* filename) { wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]); return wps_backdrop_valid; @@ -104,7 +104,7 @@ void show_wps_backdrop(void) #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 -static bool load_remote_backdrop(char* filename, fb_remote_data* backdrop_buffer) +static bool load_remote_backdrop(const char* filename, fb_remote_data* backdrop_buffer) { struct bitmap bm; int ret; diff --git a/apps/gui/backdrop.h b/apps/gui/backdrop.h index c930a87433..a05cb633f6 100644 --- a/apps/gui/backdrop.h +++ b/apps/gui/backdrop.h @@ -25,8 +25,8 @@ #include "lcd.h" #include "bmp.h" -bool load_main_backdrop(char* filename); -bool load_wps_backdrop(char* filename); +bool load_main_backdrop(const char* filename); +bool load_wps_backdrop(const char* filename); void unload_main_backdrop(void); void unload_wps_backdrop(void); @@ -37,7 +37,7 @@ void show_wps_backdrop(void); #endif /* LCD_DEPTH > 1 */ #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 -bool load_remote_wps_backdrop(char* filename); +bool load_remote_wps_backdrop(const char* filename); void unload_remote_wps_backdrop(void); void show_remote_wps_backdrop(void); void show_remote_main_backdrop(void); /* only clears the wps backdrop */ diff --git a/apps/playlist.c b/apps/playlist.c index c3072ddfd2..30fd0f11e9 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -179,7 +179,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion); 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); + const char *dir); static void display_playlist_count(int count, const unsigned char *fmt, bool final); static void display_buffer_full(void); @@ -317,24 +317,26 @@ static void empty_playlist(struct playlist_info* playlist, bool resume) static void new_playlist(struct playlist_info* playlist, const char *dir, const char *file) { + const char *fileused = file; + const char *dirused = dir; empty_playlist(playlist, false); - if (!file) + if (!fileused) { - file = ""; + fileused = ""; - if (dir && playlist->current) /* !current cannot be in_ram */ + if (dirused && playlist->current) /* !current cannot be in_ram */ playlist->in_ram = true; else - dir = ""; /* empty playlist */ + dirused = ""; /* empty playlist */ } - update_playlist_filename(playlist, dir, file); + update_playlist_filename(playlist, dirused, fileused); if (playlist->control_fd >= 0) { update_control(playlist, PLAYLIST_COMMAND_PLAYLIST, - PLAYLIST_CONTROL_FILE_VERSION, -1, dir, file, NULL); + PLAYLIST_CONTROL_FILE_VERSION, -1, dirused, fileused, NULL); sync_control(playlist, false); } } @@ -1676,7 +1678,7 @@ static int check_subdir_for_music(char *dir, char *subdir) * Returns absolute path of track */ static int format_track_path(char *dest, char *src, int buf_length, int max, - char *dir) + const char *dir) { int i = 0; int j; @@ -2953,13 +2955,13 @@ int playlist_insert_directory(struct playlist_info* playlist, /* * Insert all tracks from specified playlist into dynamic playlist. */ -int playlist_insert_playlist(struct playlist_info* playlist, char *filename, +int playlist_insert_playlist(struct playlist_info* playlist, const char *filename, int position, bool queue) { int fd; int max; char *temp_ptr; - char *dir; + const char *dir; unsigned char *count_str; char temp_buf[MAX_PATH+1]; char trackname[MAX_PATH+1]; diff --git a/apps/playlist.h b/apps/playlist.h index 006ae591c4..d6523bcdcf 100644 --- a/apps/playlist.h +++ b/apps/playlist.h @@ -142,7 +142,7 @@ int playlist_insert_track(struct playlist_info* playlist, const char *filename, int playlist_insert_directory(struct playlist_info* playlist, const char *dirname, int position, bool queue, bool recurse); -int playlist_insert_playlist(struct playlist_info* playlist, char *filename, +int playlist_insert_playlist(struct playlist_info* playlist, const char *filename, int position, bool queue); void playlist_skip_entry(struct playlist_info *playlist, int steps); int playlist_delete(struct playlist_info* playlist, int index); diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 17db24984b..ac86f48109 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c @@ -323,7 +323,7 @@ static int add_track_to_playlist(char* filename, void* context) /* Add "sel" file into specified "playlist". How to insert depends on type of file */ -static int add_to_playlist(const char* playlist, char* sel, int sel_attr) +static int add_to_playlist(const char* playlist, const char* sel, int sel_attr) { int fd; int result = -1; @@ -419,7 +419,7 @@ bool catalog_view_playlists(void) return true; } -bool catalog_add_to_a_playlist(char* sel, int sel_attr, +bool catalog_add_to_a_playlist(const char* sel, int sel_attr, bool new_playlist, char *m3u8name) { char playlist[MAX_PATH]; diff --git a/apps/playlist_catalog.h b/apps/playlist_catalog.h index 92cfa15ed9..adf757c398 100644 --- a/apps/playlist_catalog.h +++ b/apps/playlist_catalog.h @@ -35,7 +35,7 @@ bool catalog_view_playlists(void); * m3u8name : filename to save the playlist to, NULL to show the keyboard * ret : true if the file was successfully added */ -bool catalog_add_to_a_playlist(char* sel, int sel_attr, +bool catalog_add_to_a_playlist(const char* sel, int sel_attr, bool new_playlist, char* m3u8name); #endif diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 8ad3d263de..b910ca449b 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -116,7 +116,7 @@ static struct playlist_entry * playlist_buffer_get_track(struct playlist_buffer int index); static bool playlist_viewer_init(struct playlist_viewer * viewer, - char* filename, bool reload); + const char* filename, bool reload); static void format_name(char* dest, const char* src); static void format_line(const struct playlist_entry* track, char* str, @@ -271,7 +271,7 @@ static struct playlist_entry * playlist_buffer_get_track(struct playlist_buffer /* Initialize the playlist viewer. */ static bool playlist_viewer_init(struct playlist_viewer * viewer, - char* filename, bool reload) + const char* filename, bool reload) { char* buffer; size_t buffer_size; @@ -304,7 +304,8 @@ static bool playlist_viewer_init(struct playlist_viewer * viewer, else { /* Viewing playlist on disk */ - char *dir, *file, *temp_ptr; + const char *dir, *file; + char *temp_ptr; char *index_buffer = NULL; ssize_t index_buffer_size = 0; @@ -591,7 +592,7 @@ static int playlist_callback_icons(int selected_item, void *data) /* Main viewer function. Filename identifies playlist to be viewed. If NULL, view current playlist. */ -bool playlist_viewer_ex(char* filename) +bool playlist_viewer_ex(const char* filename) { bool ret = false; /* return value */ bool exit=false; /* exit viewer */ diff --git a/apps/playlist_viewer.h b/apps/playlist_viewer.h index 27f2e354c5..0caa23b6db 100644 --- a/apps/playlist_viewer.h +++ b/apps/playlist_viewer.h @@ -22,7 +22,7 @@ #define _PLAYLIST_VIEWER_H_ bool playlist_viewer(void); -bool playlist_viewer_ex(char* filename); +bool playlist_viewer_ex(const char* filename); bool search_playlist(void); #endif