summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-12-10 14:36:39 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-12-13 22:35:24 -0500
commitc6c1d62489b81c3568aa7d57a01c543a1c3f1f4a (patch)
treefe4234e7085c1a5130246a4d35a80e74003abf5e
parent8ff2c81bde5078ea55e1865ec980fe09bc3d5f09 (diff)
downloadrockbox-c6c1d62489.tar.gz
rockbox-c6c1d62489.zip
[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
-rw-r--r--apps/filetypes.c26
-rw-r--r--apps/filetypes.h4
-rw-r--r--apps/tree.c4
3 files changed, 13 insertions, 21 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index ec9bd1a7ae..03f3cfa994 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -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,14 +413,14 @@ 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:
close(fd);
}
-void filetype_init(void)
+void filetype_init(void)
{
/* set the directory item first */
filetypes[0].extension = NULL;
@@ -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;
diff --git a/apps/filetypes.h b/apps/filetypes.h
index 9013f81b02..5aae772a9c 100644
--- a/apps/filetypes.h
+++ b/apps/filetypes.h
@@ -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);
diff --git a/apps/tree.c b/apps/tree.c
index 3684e395a1..4df2c4e327 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -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,