From a0377bd500bc3185f840a67b4ee82ddaf7eaa5ab Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Mon, 5 Dec 2011 19:23:46 +0000 Subject: Sprinkle around some static and const. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31153 a1c6a512-1295-4272-9138-f99709370657 --- apps/filetypes.c | 2 +- apps/filetypes.h | 4 ++-- apps/onplay.c | 2 +- apps/shortcuts.c | 22 ++++++++++++---------- apps/shortcuts.h | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) (limited to 'apps') diff --git a/apps/filetypes.c b/apps/filetypes.c index 1f19d25e5a..49196d40ed 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -573,7 +573,7 @@ int filetype_list_viewers(const char* current_file) return simplelist_show_list(&info); } -int filetype_load_plugin(const char* plugin, char* file) +int filetype_load_plugin(const char* plugin, const char* file) { int i; char plugin_name[MAX_PATH]; diff --git a/apps/filetypes.h b/apps/filetypes.h index bde0a3f15f..dd8993e262 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h @@ -58,7 +58,7 @@ void tree_get_filetypes(const struct filetype**, int*); /* init the filetypes structs. uses audio buffer for storage, so call early in init... */ -void filetype_init(void) INIT_ATTR; +void filetype_init(void) INIT_ATTR; void read_viewer_theme_file(void); #ifdef HAVE_LCD_COLOR void read_color_theme_file(void); @@ -80,7 +80,7 @@ bool filetype_supported(int attr); int filetype_list_viewers(const char* current_file); /* start a plugin with file as the argument (called from onplay.c) */ -int filetype_load_plugin(const char* plugin, char* file); +int filetype_load_plugin(const char* plugin, const char* file); #endif diff --git a/apps/onplay.c b/apps/onplay.c index 629de93886..143745d366 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -66,7 +66,7 @@ #include "shortcuts.h" static int context; -static char* selected_file = NULL; +static const char* selected_file = NULL; static int selected_file_attr = 0; static int onplay_result = ONPLAY_OK; static char clipboard_selection[MAX_PATH]; diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 8ded75c1f2..3943a6a56a 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c @@ -42,10 +42,9 @@ #include "onplay.h" - #define MAX_SHORTCUT_NAME 32 #define SHORTCUTS_FILENAME ROCKBOX_DIR "/shortcuts.txt" -char *type_strings[SHORTCUT_TYPE_COUNT] = { +static char * const type_strings[SHORTCUT_TYPE_COUNT] = { [SHORTCUT_SETTING] = "setting", [SHORTCUT_FILE] = "file", [SHORTCUT_DEBUGITEM] = "debug", @@ -53,7 +52,6 @@ char *type_strings[SHORTCUT_TYPE_COUNT] = { [SHORTCUT_PLAYLISTMENU] = "playlist menu", [SHORTCUT_SEPARATOR] = "separator", }; - struct shortcut { enum shortcut_type type; @@ -124,7 +122,7 @@ static struct shortcut* get_shortcut(int index) return &h->shortcuts[handle_index]; } -bool verify_shortcut(struct shortcut* sc) +static bool verify_shortcut(struct shortcut* sc) { switch (sc->type) { @@ -152,7 +150,8 @@ static void init_shortcut(struct shortcut* sc) sc->name[0] = '\0'; sc->u.path[0] = '\0'; sc->icon = Icon_NOICON; -} +} + static int first_idx_to_writeback = -1; void shortcuts_ata_idle_callback(void* data) { @@ -192,7 +191,8 @@ void shortcuts_ata_idle_callback(void* data) } first_idx_to_writeback = -1; } -void shortcuts_add(enum shortcut_type type, char* value) + +void shortcuts_add(enum shortcut_type type, const char* value) { struct shortcut* sc = get_shortcut(shortcut_count++); if (!sc) @@ -275,6 +275,7 @@ int readline_cb(int n, char *buf, void *parameters) } return 0; } + void shortcuts_init(void) { int fd; @@ -296,8 +297,8 @@ void shortcuts_init(void) shortcut_count++; } -const char * shortcut_menu_get_name(int selected_item, void * data, - char * buffer, size_t buffer_len) +static const char * shortcut_menu_get_name(int selected_item, void * data, + char * buffer, size_t buffer_len) { (void)data; (void)buffer; @@ -312,14 +313,15 @@ const char * shortcut_menu_get_name(int selected_item, void * data, return sc->name[0] ? sc->name : sc->u.path; } -int shortcut_menu_get_action(int action, struct gui_synclist *lists) +static int shortcut_menu_get_action(int action, struct gui_synclist *lists) { (void)lists; if (action == ACTION_STD_OK) return ACTION_STD_CANCEL; return action; } -enum themable_icons shortcut_menu_get_icon(int selected_item, void * data) + +static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data) { (void)data; struct shortcut *sc = get_shortcut(selected_item); diff --git a/apps/shortcuts.h b/apps/shortcuts.h index b794a3a2f4..d36b2a90fb 100644 --- a/apps/shortcuts.h +++ b/apps/shortcuts.h @@ -36,7 +36,7 @@ enum shortcut_type { SHORTCUT_TYPE_COUNT }; -void shortcuts_add(enum shortcut_type type, char* value); +void shortcuts_add(enum shortcut_type type, const char* value); void shortcuts_init(void); int do_shortcut_menu(void*ignored); -- cgit