summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-02-27 11:01:24 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2022-02-27 11:01:24 -0500
commit1bcb1e39ee421c8e00fd84f0f278329e261560f1 (patch)
tree948a09457315823d1a8385a268c869ad69da6f40
parent6b360d8b0401bf3337b1b4f70e0bf630abdc421b (diff)
downloadrockbox-1bcb1e39ee421c8e00fd84f0f278329e261560f1.tar.gz
rockbox-1bcb1e39ee421c8e00fd84f0f278329e261560f1.zip
tagcache, coverity cleanup, Add TAGS_ALL_COUNT
Change-Id: Ia880c921a00b603aa4ba81b0c0670ed00491e41a
-rw-r--r--apps/tagcache.c6
-rw-r--r--apps/tagcache.h6
2 files changed, 7 insertions, 5 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 9719e4e651..248e57237d 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -443,7 +443,7 @@ static int open_master_fd(struct master_header *hdr, bool write)
443 443
444 /* Check the header. */ 444 /* Check the header. */
445 rc = read(fd, hdr, sizeof(struct master_header)); 445 rc = read(fd, hdr, sizeof(struct master_header));
446 if (hdr->tch.magic == TAGCACHE_MAGIC && rc == sizeof(struct master_header)) 446 if (rc == sizeof(struct master_header) && hdr->tch.magic == TAGCACHE_MAGIC)
447 { 447 {
448 /* Success. */ 448 /* Success. */
449 return fd; 449 return fd;
@@ -453,7 +453,7 @@ static int open_master_fd(struct master_header *hdr, bool write)
453 lseek(fd, 0, SEEK_SET); 453 lseek(fd, 0, SEEK_SET);
454 454
455 rc = ecread(fd, hdr, 1, master_header_ec, true); 455 rc = ecread(fd, hdr, 1, master_header_ec, true);
456 if (hdr->tch.magic != TAGCACHE_MAGIC || rc != sizeof(struct master_header)) 456 if (rc != sizeof(struct master_header) || hdr->tch.magic != TAGCACHE_MAGIC)
457 { 457 {
458 logf("header error"); 458 logf("header error");
459 tc_stat.ready = false; 459 tc_stat.ready = false;
@@ -3935,13 +3935,13 @@ static void fix_ramcache(void* old_addr, void* new_addr)
3935 3935
3936static int move_cb(int handle, void* current, void* new) 3936static int move_cb(int handle, void* current, void* new)
3937{ 3937{
3938 (void)handle;
3938 if (tcramcache.move_lock > 0) 3939 if (tcramcache.move_lock > 0)
3939 return BUFLIB_CB_CANNOT_MOVE; 3940 return BUFLIB_CB_CANNOT_MOVE;
3940 3941
3941 fix_ramcache(current, new); 3942 fix_ramcache(current, new);
3942 tcramcache.hdr = new; 3943 tcramcache.hdr = new;
3943 return BUFLIB_CB_OK; 3944 return BUFLIB_CB_OK;
3944 (void)handle;
3945} 3945}
3946 3946
3947static struct buflib_callbacks ops = { 3947static struct buflib_callbacks ops = {
diff --git a/apps/tagcache.h b/apps/tagcache.h
index b64571de40..52a9283e35 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -38,9 +38,11 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
38 /* Real tags end here, count them. */ 38 /* Real tags end here, count them. */
39 TAG_COUNT, 39 TAG_COUNT,
40 /* Virtual tags */ 40 /* Virtual tags */
41 tag_virt_basename, tag_virt_length_min, tag_virt_length_sec, 41 tag_virt_basename=TAG_COUNT,
42 tag_virt_length_min, tag_virt_length_sec,
42 tag_virt_playtime_min, tag_virt_playtime_sec, 43 tag_virt_playtime_min, tag_virt_playtime_sec,
43 tag_virt_entryage, tag_virt_autoscore }; 44 tag_virt_entryage, tag_virt_autoscore,
45 TAG_COUNT_ALL};
44 46
45/* Maximum length of a single tag. */ 47/* Maximum length of a single tag. */
46#define TAG_MAXLEN (MAX_PATH*2) 48#define TAG_MAXLEN (MAX_PATH*2)