From 1ad89cfe95a7b17fd96bcd4355d227ad61222cd8 Mon Sep 17 00:00:00 2001 From: miipekk Date: Mon, 7 Jan 2008 15:10:49 +0000 Subject: [PATCH] FS#8423 - Fixes quirks in routine used to remove obsolote entries from tagcache. This might fix FS#8414 and should fix FS#8384. Thanks to Lee Kang Hyuk. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16016 a1c6a512-1295-4272-9138-f99709370657 --- apps/tagcache.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/tagcache.c b/apps/tagcache.c index 05e224543..2b4f1a218 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -3464,11 +3464,14 @@ static bool delete_entry(long idx_id) } myidx.flag |= FLAG_DELETED; -#ifdef HAVE_TC_RAMCACHE - if (tc_stat.ramcache) - hdr->indices[idx_id].flag |= FLAG_DELETED; -#endif - + lseek(masterfd, -sizeof(struct index_entry), SEEK_CUR); + if (ecwrite(masterfd, &myidx, 1, index_entry_ec, tc_stat.econ) + != sizeof(struct index_entry)) + { + logf("delete_entry(): write_error #1"); + goto cleanup; + } + /* Now check which tags are no longer in use (if any) */ for (tag = 0; tag < TAG_COUNT; tag++) in_use[tag] = 0; @@ -3573,7 +3576,7 @@ static bool delete_entry(long idx_id) /* Delete from ram. */ if (tc_stat.ramcache && tag != tag_filename) { - struct tagfile_entry *tagentry = get_tag(&myidx, tag); + struct tagfile_entry *tagentry = (struct tagfile_entry *)&hdr->tags[tag][oldseek]; tagentry->tag_data[0] = '\0'; } #endif @@ -3609,7 +3612,7 @@ static bool delete_entry(long idx_id) if (ecwrite(masterfd, &myidx, 1, index_entry_ec, tc_stat.econ) != sizeof(struct index_entry)) { - logf("delete_entry(): write_error"); + logf("delete_entry(): write_error #2"); goto cleanup; } -- 2.11.4.GIT