Sprinkle around some static and const.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31153 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nils Wallménius 2011-12-05 19:23:46 +00:00
parent 906905aa43
commit a0377bd500
5 changed files with 17 additions and 15 deletions

View file

@ -573,7 +573,7 @@ int filetype_list_viewers(const char* current_file)
return simplelist_show_list(&info); 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; int i;
char plugin_name[MAX_PATH]; char plugin_name[MAX_PATH];

View file

@ -58,7 +58,7 @@ void tree_get_filetypes(const struct filetype**, int*);
/* init the filetypes structs. /* init the filetypes structs.
uses audio buffer for storage, so call early in init... */ 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); void read_viewer_theme_file(void);
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
void read_color_theme_file(void); void read_color_theme_file(void);
@ -80,7 +80,7 @@ bool filetype_supported(int attr);
int filetype_list_viewers(const char* current_file); int filetype_list_viewers(const char* current_file);
/* start a plugin with file as the argument (called from onplay.c) */ /* 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 #endif

View file

@ -66,7 +66,7 @@
#include "shortcuts.h" #include "shortcuts.h"
static int context; static int context;
static char* selected_file = NULL; static const char* selected_file = NULL;
static int selected_file_attr = 0; static int selected_file_attr = 0;
static int onplay_result = ONPLAY_OK; static int onplay_result = ONPLAY_OK;
static char clipboard_selection[MAX_PATH]; static char clipboard_selection[MAX_PATH];

View file

@ -42,10 +42,9 @@
#include "onplay.h" #include "onplay.h"
#define MAX_SHORTCUT_NAME 32 #define MAX_SHORTCUT_NAME 32
#define SHORTCUTS_FILENAME ROCKBOX_DIR "/shortcuts.txt" #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_SETTING] = "setting",
[SHORTCUT_FILE] = "file", [SHORTCUT_FILE] = "file",
[SHORTCUT_DEBUGITEM] = "debug", [SHORTCUT_DEBUGITEM] = "debug",
@ -53,7 +52,6 @@ char *type_strings[SHORTCUT_TYPE_COUNT] = {
[SHORTCUT_PLAYLISTMENU] = "playlist menu", [SHORTCUT_PLAYLISTMENU] = "playlist menu",
[SHORTCUT_SEPARATOR] = "separator", [SHORTCUT_SEPARATOR] = "separator",
}; };
struct shortcut { struct shortcut {
enum shortcut_type type; enum shortcut_type type;
@ -124,7 +122,7 @@ static struct shortcut* get_shortcut(int index)
return &h->shortcuts[handle_index]; return &h->shortcuts[handle_index];
} }
bool verify_shortcut(struct shortcut* sc) static bool verify_shortcut(struct shortcut* sc)
{ {
switch (sc->type) switch (sc->type)
{ {
@ -152,7 +150,8 @@ static void init_shortcut(struct shortcut* sc)
sc->name[0] = '\0'; sc->name[0] = '\0';
sc->u.path[0] = '\0'; sc->u.path[0] = '\0';
sc->icon = Icon_NOICON; sc->icon = Icon_NOICON;
} }
static int first_idx_to_writeback = -1; static int first_idx_to_writeback = -1;
void shortcuts_ata_idle_callback(void* data) void shortcuts_ata_idle_callback(void* data)
{ {
@ -192,7 +191,8 @@ void shortcuts_ata_idle_callback(void* data)
} }
first_idx_to_writeback = -1; 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++); struct shortcut* sc = get_shortcut(shortcut_count++);
if (!sc) if (!sc)
@ -275,6 +275,7 @@ int readline_cb(int n, char *buf, void *parameters)
} }
return 0; return 0;
} }
void shortcuts_init(void) void shortcuts_init(void)
{ {
int fd; int fd;
@ -296,8 +297,8 @@ void shortcuts_init(void)
shortcut_count++; shortcut_count++;
} }
const char * shortcut_menu_get_name(int selected_item, void * data, static const char * shortcut_menu_get_name(int selected_item, void * data,
char * buffer, size_t buffer_len) char * buffer, size_t buffer_len)
{ {
(void)data; (void)data;
(void)buffer; (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; 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; (void)lists;
if (action == ACTION_STD_OK) if (action == ACTION_STD_OK)
return ACTION_STD_CANCEL; return ACTION_STD_CANCEL;
return action; 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; (void)data;
struct shortcut *sc = get_shortcut(selected_item); struct shortcut *sc = get_shortcut(selected_item);

View file

@ -36,7 +36,7 @@ enum shortcut_type {
SHORTCUT_TYPE_COUNT 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); void shortcuts_init(void);
int do_shortcut_menu(void*ignored); int do_shortcut_menu(void*ignored);