summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hohmuth <sideral@rockbox.org>2011-08-04 12:13:12 +0000
committerMichael Hohmuth <sideral@rockbox.org>2011-08-04 12:13:12 +0000
commit6196925915f28d3a5fac2f00c2e83d4fb8714ab5 (patch)
tree3aad9918308739a88757ad790ac5bf27a487f052
parent92a578c6a758e8619b2056da93c79e3455c6a77a (diff)
downloadrockbox-6196925915f28d3a5fac2f00c2e83d4fb8714ab5.tar.gz
rockbox-6196925915f28d3a5fac2f00c2e83d4fb8714ab5.zip
Database: Fix array-bounds calculation when applying a format using
%strip to partially loaded (chunked) database results. git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_9@30251 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagtree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 1fb05b494c..4003087133 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -1244,6 +1244,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
dptr->name = str(LANG_TAGNAVI_ALL_TRACKS);
dptr++;
current_entry_count++;
+ special_entry_count++;
}
if (offset <= 1)
{
@@ -1252,12 +1253,12 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
dptr->extraseek = -1;
dptr++;
current_entry_count++;
+ special_entry_count++;
}
- special_entry_count+=2;
+
+ total_count += 2;
}
- total_count += special_entry_count;
-
while (tagcache_get_next(&tcs))
{
if (total_count++ < offset)
@@ -1386,7 +1387,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
if (strip)
{
dptr = c->dircache;
- for (i = 0; i < total_count; i++, dptr++)
+ for (i = special_entry_count; i < current_entry_count; i++, dptr++)
{
int len = strlen(dptr->name);