summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-10-25 15:14:15 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-10-25 15:14:15 +0000
commit649fc77aea5fbf62f6a1600ea6ba545eae4109d6 (patch)
tree7de9ef0f8288211f2b08fb20d34e095efe5fd5d4
parentd13038d70446152c68b0bf83868d2ec9a5ea136c (diff)
downloadrockbox-649fc77aea5fbf62f6a1600ea6ba545eae4109d6.tar.gz
rockbox-649fc77aea5fbf62f6a1600ea6ba545eae4109d6.tar.bz2
rockbox-649fc77aea5fbf62f6a1600ea6ba545eae4109d6.zip
Don't fail with very long lines.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11342 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagcache.h2
-rw-r--r--apps/tagtree.c21
2 files changed, 16 insertions, 7 deletions
diff --git a/apps/tagcache.h b/apps/tagcache.h
index 26c500ef88..f1819855db 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -58,7 +58,7 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
#define TAGCACHE_STRICT_ALIGN 1
#define TAGCACHE_MAX_FILTERS 4
-#define TAGCACHE_MAX_CLAUSES 16
+#define TAGCACHE_MAX_CLAUSES 32
/* Tag database files. */
#define TAGCACHE_FILE_TEMP ROCKBOX_DIR "/tagcache_tmp.tcd"
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 4f16801708..e1cb9e65bc 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -407,6 +407,12 @@ static int add_format(const char *buf)
while (1)
{
+ if (clause_count >= TAGCACHE_MAX_CLAUSES)
+ {
+ logf("too many clauses");
+ break;
+ }
+
formats[format_count]->clause[clause_count] =
buffer_alloc(sizeof(struct tagcache_search_clause));
@@ -690,6 +696,8 @@ int parse_line(int n, const char *buf, void *parameters)
(void)parameters;
+ logf("parse:%d/%s", n, buf);
+
/* First line, do initialisation. */
if (n == 0)
{
@@ -735,7 +743,7 @@ int parse_line(int n, const char *buf, void *parameters)
if (get_token_str(data, sizeof(data)) < 0)
{
logf("%include empty");
- return false;
+ return 0;
}
if (!parse_menu(data))
@@ -748,7 +756,7 @@ int parse_line(int n, const char *buf, void *parameters)
if (menu_count >= TAGMENU_MAX_MENUS)
{
logf("max menucount reached");
- return false;
+ return 0;
}
menus[menu_count] = buffer_alloc(sizeof(struct root_menu));
@@ -757,13 +765,14 @@ int parse_line(int n, const char *buf, void *parameters)
if (get_token_str(menu->id, sizeof(menu->id)) < 0)
{
logf("%menu_start id empty");
- return false;
+ return 0;
}
if (get_token_str(menu->title, sizeof(menu->title)) < 0)
{
logf("%menu_start title empty");
- return false;
+ return 0;
}
+ logf("menu: %s", menu->title);
menu->itemcount = 0;
read_menu = true;
break;
@@ -776,7 +785,7 @@ int parse_line(int n, const char *buf, void *parameters)
if (get_token_str(data, sizeof(data)) < 0)
{
logf("%root_menu empty");
- return false;
+ return 0;
}
for (i = 0; i < menu_count; i++)
@@ -818,7 +827,7 @@ int parse_line(int n, const char *buf, void *parameters)
static bool parse_menu(const char *filename)
{
int fd;
- char buf[256];
+ char buf[1024];
if (menu_count >= TAGMENU_MAX_MENUS)
{