diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2007-05-27 11:40:55 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2007-05-27 11:40:55 +0000 |
| commit | 4cee8d9354092735ff79aa199b5aaddc355d978e (patch) | |
| tree | 7ad4360cc583a916f77b32ea1ae4f46bd9866df7 | |
| parent | 43c299eaa114fc5f721ef48767fab73c051798a5 (diff) | |
| download | rockbox-4cee8d9354092735ff79aa199b5aaddc355d978e.zip rockbox-4cee8d9354092735ff79aa199b5aaddc355d978e.tar.gz rockbox-4cee8d9354092735ff79aa199b5aaddc355d978e.tar.bz2 rockbox-4cee8d9354092735ff79aa199b5aaddc355d978e.tar.xz | |
Prevent destroying dircache pointers in tagcache DB while updating runtime stats.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13498 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/tagcache.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 08e89eb..d82149a 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -547,9 +547,24 @@ static bool write_index(int masterfd, int idxid, struct index_entry *idx) } #ifdef HAVE_TC_RAMCACHE + /* Only update numeric data. Writing the whole index to RAM by memcpy + * destroys dircache pointers! + */ if (tc_stat.ramcache) { - memcpy(&hdr->indices[idxid], idx, sizeof(struct index_entry)); + int tag; + struct index_entry *idx_ram = &hdr->indices[idxid]; + + for (tag = 0; tag < TAG_COUNT; tag++) + { + if (tagcache_is_numeric_tag(tag)) + { + idx_ram->tag_seek[tag] = idx->tag_seek[tag]; + } + } + + /* Don't touch the dircache flag. */ + idx_ram->flag = idx->flag | (idx_ram->flag & FLAG_DIRCACHE); } #endif |