[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 */
|
/* max viewer plugins */
|
||||||
#define MAX_VIEWERS 56
|
#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 */
|
/* a table for the known file types */
|
||||||
static const struct filetype inbuilt_filetypes[] = {
|
static const struct filetype inbuilt_filetypes[] = {
|
||||||
{ "mp3", FILE_ATTR_AUDIO },
|
{ "mp3", FILE_ATTR_AUDIO },
|
||||||
|
@ -187,12 +191,6 @@ static const struct fileattr_icon_voice inbuilt_attr_icons_voices[] = {
|
||||||
#endif
|
#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)
|
long tree_get_filetype_voiceclip(int attr)
|
||||||
{
|
{
|
||||||
if (global_settings.talk_filetype)
|
if (global_settings.talk_filetype)
|
||||||
|
@ -306,8 +304,6 @@ static int find_extension(const char* extension)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_builtin_types(void);
|
|
||||||
static void read_config(int fd);
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
/* Colors file format is similar to icons:
|
/* Colors file format is similar to icons:
|
||||||
* ext:hex_color
|
* ext:hex_color
|
||||||
|
@ -401,7 +397,7 @@ void read_viewer_theme_file(void)
|
||||||
custom_icons_loaded = true;
|
custom_icons_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_viewers_config(void)
|
static void read_viewers_config_init(void)
|
||||||
{
|
{
|
||||||
int fd = open(VIEWERS_CONFIG, O_RDONLY);
|
int fd = open(VIEWERS_CONFIG, O_RDONLY);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
|
@ -417,14 +413,14 @@ static void read_viewers_config(void)
|
||||||
if(strdup_handle <= 0)
|
if(strdup_handle <= 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
read_config(fd);
|
read_config_init(fd);
|
||||||
core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx);
|
core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void filetype_init(void)
|
void filetype_init(void)
|
||||||
{
|
{
|
||||||
/* set the directory item first */
|
/* set the directory item first */
|
||||||
filetypes[0].extension = NULL;
|
filetypes[0].extension = NULL;
|
||||||
|
@ -435,8 +431,8 @@ void filetype_init(void)
|
||||||
viewer_count = 0;
|
viewer_count = 0;
|
||||||
filetype_count = 1;
|
filetype_count = 1;
|
||||||
|
|
||||||
read_builtin_types();
|
read_builtin_types_init();
|
||||||
read_viewers_config();
|
read_viewers_config_init();
|
||||||
read_viewer_theme_file();
|
read_viewer_theme_file();
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
read_color_theme_file();
|
read_color_theme_file();
|
||||||
|
@ -459,7 +455,7 @@ static void rm_whitespaces(char* str)
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_builtin_types(void)
|
static void read_builtin_types_init(void)
|
||||||
{
|
{
|
||||||
int tree_attr;
|
int tree_attr;
|
||||||
size_t count = ARRAY_SIZE(inbuilt_filetypes);
|
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 line[64], *s, *e;
|
||||||
char *extension, *plugin;
|
char *extension, *plugin;
|
||||||
|
|
|
@ -55,12 +55,12 @@ struct filetype {
|
||||||
int tree_attr;
|
int tree_attr;
|
||||||
};
|
};
|
||||||
|
|
||||||
void tree_get_filetypes(const struct filetype**, int*) INIT_ATTR;
|
long tree_get_filetype_voiceclip(int attr);
|
||||||
long tree_get_filetype_voiceclip(int attr) INIT_ATTR;
|
|
||||||
|
|
||||||
/* 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);
|
||||||
|
|
|
@ -77,9 +77,6 @@
|
||||||
|
|
||||||
#include "root_menu.h"
|
#include "root_menu.h"
|
||||||
|
|
||||||
static const struct filetype *filetypes;
|
|
||||||
static int filetypes_count;
|
|
||||||
|
|
||||||
static struct gui_synclist tree_lists;
|
static struct gui_synclist tree_lists;
|
||||||
|
|
||||||
/* I put it here because other files doesn't use it yet,
|
/* 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->entries_handle = core_alloc_ex("tree entries",
|
||||||
cache->max_entries*(sizeof(struct entry)),
|
cache->max_entries*(sizeof(struct entry)),
|
||||||
&ops);
|
&ops);
|
||||||
tree_get_filetypes(&filetypes, &filetypes_count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bookmark_play(char *resume_file, int index, unsigned long elapsed,
|
bool bookmark_play(char *resume_file, int index, unsigned long elapsed,
|
||||||
|
|
Loading…
Reference in a new issue