aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-24 11:53:30 +0200
committerMax Kellermann <max@duempel.org>2015-08-24 11:53:30 +0200
commitf0b58c6f2463da0b7f509a53d8054d5472504094 (patch)
treefb07d2c89c3ca6d32212a368f8eb9dea02861d88
parentf3661b19c08ecfce952ab6db25cf27f346cb3b7f (diff)
downloadmpd-f0b58c6f2463da0b7f509a53d8054d5472504094.tar.gz
mpd-f0b58c6f2463da0b7f509a53d8054d5472504094.tar.xz
mpd-f0b58c6f2463da0b7f509a53d8054d5472504094.zip
db/UniqueTags, tag/Set, ...: use typedef tag_mask_t
-rw-r--r--src/command/DatabaseCommands.cxx6
-rw-r--r--src/db/DatabasePrint.cxx2
-rw-r--r--src/db/DatabasePrint.hxx5
-rw-r--r--src/db/Interface.hxx4
-rw-r--r--src/db/UniqueTags.cxx4
-rw-r--r--src/db/UniqueTags.hxx5
-rw-r--r--src/db/plugins/LazyDatabase.cxx2
-rw-r--r--src/db/plugins/LazyDatabase.hxx2
-rw-r--r--src/db/plugins/ProxyDatabasePlugin.cxx4
-rw-r--r--src/db/plugins/simple/SimpleDatabasePlugin.cxx2
-rw-r--r--src/db/plugins/simple/SimpleDatabasePlugin.hxx2
-rw-r--r--src/db/plugins/upnp/UpnpDatabasePlugin.cxx4
-rw-r--r--src/tag/Set.cxx12
-rw-r--r--src/tag/Set.hxx8
14 files changed, 30 insertions, 32 deletions
diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx
index dce086162..4fbae95ec 100644
--- a/src/command/DatabaseCommands.cxx
+++ b/src/command/DatabaseCommands.cxx
@@ -217,7 +217,7 @@ handle_list(Client &client, Request args, Response &r)
}
SongFilter *filter = nullptr;
- uint32_t group_mask = 0;
+ tag_mask_t group_mask = 0;
if (args.size == 1) {
/* for compatibility with < 0.12.0 */
@@ -241,7 +241,7 @@ handle_list(Client &client, Request args, Response &r)
return CommandResult::ERROR;
}
- group_mask |= 1u << unsigned(gt);
+ group_mask |= tag_mask_t(1) << unsigned(gt);
args.pop_back();
args.pop_back();
@@ -257,7 +257,7 @@ handle_list(Client &client, Request args, Response &r)
}
if (tagType < TAG_NUM_OF_ITEM_TYPES &&
- group_mask & (1u << tagType)) {
+ group_mask & (tag_mask_t(1) << tagType)) {
delete filter;
r.Error(ACK_ERROR_ARG, "Conflicting group");
return CommandResult::ERROR;
diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx
index 3378df23b..e5e7a84f3 100644
--- a/src/db/DatabasePrint.cxx
+++ b/src/db/DatabasePrint.cxx
@@ -223,7 +223,7 @@ PrintUniqueTag(Response &r, TagType tag_type,
bool
PrintUniqueTags(Response &r, Partition &partition,
- unsigned type, uint32_t group_mask,
+ unsigned type, tag_mask_t group_mask,
const SongFilter *filter,
Error &error)
{
diff --git a/src/db/DatabasePrint.hxx b/src/db/DatabasePrint.hxx
index cf98d31df..d48dabaa2 100644
--- a/src/db/DatabasePrint.hxx
+++ b/src/db/DatabasePrint.hxx
@@ -20,10 +20,9 @@
#ifndef MPD_DB_PRINT_H
#define MPD_DB_PRINT_H
+#include "tag/Mask.hxx"
#include "Compiler.h"
-#include <stdint.h>
-
class SongFilter;
struct DatabaseSelection;
struct Partition;
@@ -49,7 +48,7 @@ db_selection_print(Response &r, Partition &partition,
bool
PrintUniqueTags(Response &r, Partition &partition,
- unsigned type, uint32_t group_mask,
+ unsigned type, tag_mask_t group_mask,
const SongFilter *filter,
Error &error);
diff --git a/src/db/Interface.hxx b/src/db/Interface.hxx
index b951a9c22..7b43efe24 100644
--- a/src/db/Interface.hxx
+++ b/src/db/Interface.hxx
@@ -22,10 +22,10 @@
#include "Visitor.hxx"
#include "tag/TagType.h"
+#include "tag/Mask.hxx"
#include "Compiler.h"
#include <time.h>
-#include <stdint.h>
struct DatabasePlugin;
struct DatabaseStats;
@@ -107,7 +107,7 @@ public:
* Visit all unique tag values.
*/
virtual bool VisitUniqueTags(const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const = 0;
diff --git a/src/db/UniqueTags.cxx b/src/db/UniqueTags.cxx
index 4c01fdf69..a0c85cb85 100644
--- a/src/db/UniqueTags.cxx
+++ b/src/db/UniqueTags.cxx
@@ -27,7 +27,7 @@
#include <assert.h>
static bool
-CollectTags(TagSet &set, TagType tag_type, uint32_t group_mask,
+CollectTags(TagSet &set, TagType tag_type, tag_mask_t group_mask,
const LightSong &song)
{
assert(song.tag != nullptr);
@@ -39,7 +39,7 @@ CollectTags(TagSet &set, TagType tag_type, uint32_t group_mask,
bool
VisitUniqueTags(const Database &db, const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error)
{
diff --git a/src/db/UniqueTags.hxx b/src/db/UniqueTags.hxx
index b44afe464..b241970f9 100644
--- a/src/db/UniqueTags.hxx
+++ b/src/db/UniqueTags.hxx
@@ -22,8 +22,7 @@
#include "Visitor.hxx"
#include "tag/TagType.h"
-
-#include <stdint.h>
+#include "tag/Mask.hxx"
class Error;
class Database;
@@ -31,7 +30,7 @@ struct DatabaseSelection;
bool
VisitUniqueTags(const Database &db, const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error);
diff --git a/src/db/plugins/LazyDatabase.cxx b/src/db/plugins/LazyDatabase.cxx
index 8c4901735..9d57301a9 100644
--- a/src/db/plugins/LazyDatabase.cxx
+++ b/src/db/plugins/LazyDatabase.cxx
@@ -85,7 +85,7 @@ LazyDatabase::Visit(const DatabaseSelection &selection,
bool
LazyDatabase::VisitUniqueTags(const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const
{
diff --git a/src/db/plugins/LazyDatabase.hxx b/src/db/plugins/LazyDatabase.hxx
index 88bbcf170..6955aefe8 100644
--- a/src/db/plugins/LazyDatabase.hxx
+++ b/src/db/plugins/LazyDatabase.hxx
@@ -52,7 +52,7 @@ public:
Error &error) const override;
virtual bool VisitUniqueTags(const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const override;
diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx
index 78ad7f603..8beb2fb55 100644
--- a/src/db/plugins/ProxyDatabasePlugin.cxx
+++ b/src/db/plugins/ProxyDatabasePlugin.cxx
@@ -113,7 +113,7 @@ public:
Error &error) const override;
virtual bool VisitUniqueTags(const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const override;
@@ -757,7 +757,7 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
bool
ProxyDatabase::VisitUniqueTags(const DatabaseSelection &selection,
TagType tag_type,
- gcc_unused uint32_t group_mask,
+ gcc_unused tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const
{
diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx
index 27965c0eb..1e9817417 100644
--- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx
+++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx
@@ -348,7 +348,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
bool
SimpleDatabase::VisitUniqueTags(const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const
{
diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.hxx b/src/db/plugins/simple/SimpleDatabasePlugin.hxx
index fc720ecf8..7a28099d9 100644
--- a/src/db/plugins/simple/SimpleDatabasePlugin.hxx
+++ b/src/db/plugins/simple/SimpleDatabasePlugin.hxx
@@ -121,7 +121,7 @@ public:
Error &error) const override;
virtual bool VisitUniqueTags(const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const override;
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
index 035c310f9..26844a978 100644
--- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
@@ -94,7 +94,7 @@ public:
Error &error) const override;
virtual bool VisitUniqueTags(const DatabaseSelection &selection,
- TagType tag_type, uint32_t group_mask,
+ TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const override;
@@ -723,7 +723,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
bool
UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
- TagType tag, gcc_unused uint32_t group_mask,
+ TagType tag, gcc_unused tag_mask_t group_mask,
VisitTag visit_tag,
Error &error) const
{
diff --git a/src/tag/Set.cxx b/src/tag/Set.cxx
index 30e4efe2d..6499321e6 100644
--- a/src/tag/Set.cxx
+++ b/src/tag/Set.cxx
@@ -58,16 +58,16 @@ CopyTagItem(TagBuilder &dest, const Tag &src, TagType type)
* Copy all tag items of the types in the mask.
*/
static void
-CopyTagMask(TagBuilder &dest, const Tag &src, uint32_t mask)
+CopyTagMask(TagBuilder &dest, const Tag &src, tag_mask_t mask)
{
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i)
- if ((mask & (1u << i)) != 0)
+ if ((mask & (tag_mask_t(1) << i)) != 0)
CopyTagItem(dest, src, TagType(i));
}
void
TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
- uint32_t group_mask)
+ tag_mask_t group_mask)
{
TagBuilder builder;
if (value == nullptr)
@@ -85,7 +85,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
bool
TagSet::CheckUnique(TagType dest_type,
const Tag &tag, TagType src_type,
- uint32_t group_mask)
+ tag_mask_t group_mask)
{
bool found = false;
@@ -101,12 +101,12 @@ TagSet::CheckUnique(TagType dest_type,
void
TagSet::InsertUnique(const Tag &tag,
- TagType type, uint32_t group_mask)
+ TagType type, tag_mask_t group_mask)
{
static_assert(sizeof(group_mask) * 8 >= TAG_NUM_OF_ITEM_TYPES,
"Mask is too small");
- assert((group_mask & (1u << unsigned(type))) == 0);
+ assert((group_mask & (tag_mask_t(1) << unsigned(type))) == 0);
if (!CheckUnique(type, tag, type, group_mask) &&
(type != TAG_ALBUM_ARTIST ||
diff --git a/src/tag/Set.hxx b/src/tag/Set.hxx
index aab994008..587b25a3a 100644
--- a/src/tag/Set.hxx
+++ b/src/tag/Set.hxx
@@ -22,11 +22,11 @@
#include "Compiler.h"
#include "Tag.hxx"
+#include "Mask.hxx"
#include <set>
#include <string.h>
-#include <stdint.h>
/**
* Helper class for #TagSet which compares two #Tag objects.
@@ -59,15 +59,15 @@ struct TagLess {
class TagSet : public std::set<Tag, TagLess> {
public:
void InsertUnique(const Tag &tag,
- TagType type, uint32_t group_mask);
+ TagType type, tag_mask_t group_mask);
private:
void InsertUnique(const Tag &src, TagType type, const char *value,
- uint32_t group_mask);
+ tag_mask_t group_mask);
bool CheckUnique(TagType dest_type,
const Tag &tag, TagType src_type,
- uint32_t group_mask);
+ tag_mask_t group_mask);
};
#endif