summaryrefslogtreecommitdiff
path: root/apps/tagcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r--apps/tagcache.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 4a542fb702..3d0ab7fbd3 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -107,24 +107,40 @@ static long tempbuf_size; /* Buffer size (TEMPBUF_SIZE). */
107static long tempbuf_left; /* Buffer space left. */ 107static long tempbuf_left; /* Buffer space left. */
108static long tempbuf_pos; 108static long tempbuf_pos;
109 109
110#ifdef CPU_SH 110#define SORTED_TAGS_COUNT 8
111#define TAGCACHE_IS_UNIQUE(tag) (tagcache_is_unique_tag(tag)) 111#ifdef CPU_SH /* SH lacks a variable shift instruction */
112#define TAGCACHE_IS_SORTED(tag) (tagcache_is_sorted_tag(tag)) 112/* Numeric tags (we can use these tags with conditional clauses). */
113const char tagcache_numeric_tags[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
114 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
115 1, 1, 1, 1, 1 };
116
117/* Uniqued tags (we can use these tags with filters and conditional clauses). */
118static const char tagcache_unique_tags[] = { 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0,
119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
120 0, 0, 0, 0, 0 };
121
122/* Tags we want to get sorted (loaded to the tempbuf). */
123static const char tagcache_sorted_tags[] = { 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0,
124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
125 0, 0, 0, 0, 0 };
126
127#define TAGCACHE_IS_UNIQUE(tag) ((bool)tagcache_unique_tags[tag])
128#define TAGCACHE_IS_SORTED(tag) ((bool)tagcache_sorted_tags[tag])
129
113#else 130#else
114#define TAGCACHE_IS_UNIQUE(tag) ((1LU << tag) & TAGCACHE_UNIQUE_TAGS) 131#define TAGCACHE_IS_UNIQUE(tag) ((1LU << tag) & TAGCACHE_UNIQUE_TAGS)
115#define TAGCACHE_IS_SORTED(tag) ((1LU << tag) & TAGCACHE_SORTED_TAGS) 132#define TAGCACHE_IS_SORTED(tag) ((1LU << tag) & TAGCACHE_SORTED_TAGS)
116#endif
117 133
118/* Tags we want to get sorted (loaded to the tempbuf). */ 134/* Tags we want to get sorted (loaded to the tempbuf). */
119#define TAGCACHE_SORTED_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ 135#define TAGCACHE_SORTED_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \
120 (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ 136 (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \
121 (1LU << tag_albumartist) | (1LU << tag_grouping) | (1LU << tag_title)) 137 (1LU << tag_albumartist) | (1LU << tag_grouping) | (1LU << tag_title))
122#define SORTED_TAGS_COUNT 8
123 138
124/* Uniqued tags (we can use these tags with filters and conditional clauses). */ 139/* Uniqued tags (we can use these tags with filters and conditional clauses). */
125#define TAGCACHE_UNIQUE_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ 140#define TAGCACHE_UNIQUE_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \
126 (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ 141 (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \
127 (1LU << tag_albumartist) | (1LU << tag_grouping)) 142 (1LU << tag_albumartist) | (1LU << tag_grouping))
143#endif
128 144
129/* String presentation of the tags defined in tagcache.h. Must be in correct order! */ 145/* String presentation of the tags defined in tagcache.h. Must be in correct order! */
130static const char *tags_str[] = { "artist", "album", "genre", "title", 146static const char *tags_str[] = { "artist", "album", "genre", "title",
@@ -268,23 +284,6 @@ const char* tagcache_tag_to_str(int tag)
268 return tags_str[tag]; 284 return tags_str[tag];
269} 285}
270 286
271#ifdef CPU_SH
272bool tagcache_is_numeric_tag(int type)
273{
274 return (1LU << type) & TAGCACHE_NUMERIC_TAGS;
275}
276
277static bool tagcache_is_unique_tag(int type)
278{
279 return (1LU << type) & TAGCACHE_UNIQUE_TAGS;
280}
281
282static bool tagcache_is_sorted_tag(int type)
283{
284 return (1LU << type) & TAGCACHE_UNIQUE_TAGS;
285}
286#endif
287
288#ifdef HAVE_DIRCACHE 287#ifdef HAVE_DIRCACHE
289/** 288/**
290 * Returns true if specified flag is still present, i.e., dircache 289 * Returns true if specified flag is still present, i.e., dircache