[Bug Fix] filetypes.c move voice data out of INIT_ATTR
tree_get_filetype_voiceclip is called after init it shouldn't be marked as INIT_ATTR add _init to the functions & data that are used at init only to be a bit more clear Change-Id: I8eb1914560b782c2c0fdd7649e761f94e382d5cb
This commit is contained in:
parent
8ff2c81bde
commit
c6c1d62489
3 changed files with 13 additions and 21 deletions
|
@ -46,6 +46,10 @@
|
|||
/* max viewer plugins */
|
||||
#define MAX_VIEWERS 56
|
||||
|
||||
static void read_builtin_types_init(void) INIT_ATTR;
|
||||
static void read_viewers_config_init(void) INIT_ATTR;
|
||||
static void read_config_init(int fd) INIT_ATTR;
|
||||
|
||||
/* a table for the known file types */
|
||||
static const struct filetype inbuilt_filetypes[] = {
|
||||
{ "mp3", FILE_ATTR_AUDIO },
|
||||
|
@ -187,12 +191,6 @@ static const struct fileattr_icon_voice inbuilt_attr_icons_voices[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
void tree_get_filetypes(const struct filetype** types, int* count)
|
||||
{
|
||||
*types = inbuilt_filetypes;
|
||||
*count = sizeof(inbuilt_filetypes) / sizeof(*inbuilt_filetypes);
|
||||
}
|
||||
|
||||
long tree_get_filetype_voiceclip(int attr)
|
||||
{
|
||||
if (global_settings.talk_filetype)
|
||||
|
@ -306,8 +304,6 @@ static int find_extension(const char* extension)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void read_builtin_types(void);
|
||||
static void read_config(int fd);
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
/* Colors file format is similar to icons:
|
||||
* ext:hex_color
|
||||
|
@ -401,7 +397,7 @@ void read_viewer_theme_file(void)
|
|||
custom_icons_loaded = true;
|
||||
}
|
||||
|
||||
static void read_viewers_config(void)
|
||||
static void read_viewers_config_init(void)
|
||||
{
|
||||
int fd = open(VIEWERS_CONFIG, O_RDONLY);
|
||||
if(fd < 0)
|
||||
|
@ -417,7 +413,7 @@ static void read_viewers_config(void)
|
|||
if(strdup_handle <= 0)
|
||||
goto out;
|
||||
|
||||
read_config(fd);
|
||||
read_config_init(fd);
|
||||
core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx);
|
||||
|
||||
out:
|
||||
|
@ -435,8 +431,8 @@ void filetype_init(void)
|
|||
viewer_count = 0;
|
||||
filetype_count = 1;
|
||||
|
||||
read_builtin_types();
|
||||
read_viewers_config();
|
||||
read_builtin_types_init();
|
||||
read_viewers_config_init();
|
||||
read_viewer_theme_file();
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
read_color_theme_file();
|
||||
|
@ -459,7 +455,7 @@ static void rm_whitespaces(char* str)
|
|||
*s = '\0';
|
||||
}
|
||||
|
||||
static void read_builtin_types(void)
|
||||
static void read_builtin_types_init(void)
|
||||
{
|
||||
int tree_attr;
|
||||
size_t count = ARRAY_SIZE(inbuilt_filetypes);
|
||||
|
@ -487,7 +483,7 @@ static void read_builtin_types(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void read_config(int fd)
|
||||
static void read_config_init(int fd)
|
||||
{
|
||||
char line[64], *s, *e;
|
||||
char *extension, *plugin;
|
||||
|
|
|
@ -55,12 +55,12 @@ struct filetype {
|
|||
int tree_attr;
|
||||
};
|
||||
|
||||
void tree_get_filetypes(const struct filetype**, int*) INIT_ATTR;
|
||||
long tree_get_filetype_voiceclip(int attr) INIT_ATTR;
|
||||
long tree_get_filetype_voiceclip(int attr);
|
||||
|
||||
/* init the filetypes structs.
|
||||
uses audio buffer for storage, so call early in init... */
|
||||
void filetype_init(void) INIT_ATTR;
|
||||
|
||||
void read_viewer_theme_file(void);
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
void read_color_theme_file(void);
|
||||
|
|
|
@ -77,9 +77,6 @@
|
|||
|
||||
#include "root_menu.h"
|
||||
|
||||
static const struct filetype *filetypes;
|
||||
static int filetypes_count;
|
||||
|
||||
static struct gui_synclist tree_lists;
|
||||
|
||||
/* I put it here because other files doesn't use it yet,
|
||||
|
@ -1090,7 +1087,6 @@ void tree_mem_init(void)
|
|||
cache->entries_handle = core_alloc_ex("tree entries",
|
||||
cache->max_entries*(sizeof(struct entry)),
|
||||
&ops);
|
||||
tree_get_filetypes(&filetypes, &filetypes_count);
|
||||
}
|
||||
|
||||
bool bookmark_play(char *resume_file, int index, unsigned long elapsed,
|
||||
|
|
Loading…
Reference in a new issue