tagcache, coverity cleanup, Add TAGS_ALL_COUNT

Change-Id: Ia880c921a00b603aa4ba81b0c0670ed00491e41a
This commit is contained in:
William Wilgus 2022-02-27 11:01:24 -05:00
parent 6b360d8b04
commit 1bcb1e39ee
2 changed files with 7 additions and 5 deletions

View file

@ -443,7 +443,7 @@ static int open_master_fd(struct master_header *hdr, bool write)
/* Check the header. */ /* Check the header. */
rc = read(fd, hdr, sizeof(struct master_header)); rc = read(fd, hdr, sizeof(struct master_header));
if (hdr->tch.magic == TAGCACHE_MAGIC && rc == sizeof(struct master_header)) if (rc == sizeof(struct master_header) && hdr->tch.magic == TAGCACHE_MAGIC)
{ {
/* Success. */ /* Success. */
return fd; return fd;
@ -453,7 +453,7 @@ static int open_master_fd(struct master_header *hdr, bool write)
lseek(fd, 0, SEEK_SET); lseek(fd, 0, SEEK_SET);
rc = ecread(fd, hdr, 1, master_header_ec, true); rc = ecread(fd, hdr, 1, master_header_ec, true);
if (hdr->tch.magic != TAGCACHE_MAGIC || rc != sizeof(struct master_header)) if (rc != sizeof(struct master_header) || hdr->tch.magic != TAGCACHE_MAGIC)
{ {
logf("header error"); logf("header error");
tc_stat.ready = false; tc_stat.ready = false;
@ -3935,13 +3935,13 @@ static void fix_ramcache(void* old_addr, void* new_addr)
static int move_cb(int handle, void* current, void* new) static int move_cb(int handle, void* current, void* new)
{ {
(void)handle;
if (tcramcache.move_lock > 0) if (tcramcache.move_lock > 0)
return BUFLIB_CB_CANNOT_MOVE; return BUFLIB_CB_CANNOT_MOVE;
fix_ramcache(current, new); fix_ramcache(current, new);
tcramcache.hdr = new; tcramcache.hdr = new;
return BUFLIB_CB_OK; return BUFLIB_CB_OK;
(void)handle;
} }
static struct buflib_callbacks ops = { static struct buflib_callbacks ops = {

View file

@ -38,9 +38,11 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
/* Real tags end here, count them. */ /* Real tags end here, count them. */
TAG_COUNT, TAG_COUNT,
/* Virtual tags */ /* Virtual tags */
tag_virt_basename, tag_virt_length_min, tag_virt_length_sec, tag_virt_basename=TAG_COUNT,
tag_virt_length_min, tag_virt_length_sec,
tag_virt_playtime_min, tag_virt_playtime_sec, tag_virt_playtime_min, tag_virt_playtime_sec,
tag_virt_entryage, tag_virt_autoscore }; tag_virt_entryage, tag_virt_autoscore,
TAG_COUNT_ALL};
/* Maximum length of a single tag. */ /* Maximum length of a single tag. */
#define TAG_MAXLEN (MAX_PATH*2) #define TAG_MAXLEN (MAX_PATH*2)