Commit 662bed6a authored by Max Kellermann's avatar Max Kellermann

db/proxy: use class TagBuilder

parent ae5e0cb0
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "Song.hxx" #include "Song.hxx"
#include "gcc.h" #include "gcc.h"
#include "ConfigData.hxx" #include "ConfigData.hxx"
#include "tag/Tag.hxx" #include "tag/TagBuilder.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
...@@ -248,7 +248,7 @@ Visit(struct mpd_connection *connection, ...@@ -248,7 +248,7 @@ Visit(struct mpd_connection *connection,
} }
static void static void
Copy(Tag &tag, enum tag_type d_tag, Copy(TagBuilder &tag, enum tag_type d_tag,
const struct mpd_song *song, enum mpd_tag_type s_tag) const struct mpd_song *song, enum mpd_tag_type s_tag)
{ {
...@@ -270,15 +270,13 @@ Convert(const struct mpd_song *song) ...@@ -270,15 +270,13 @@ Convert(const struct mpd_song *song)
s->start_ms = mpd_song_get_start(song) * 1000; s->start_ms = mpd_song_get_start(song) * 1000;
s->end_ms = mpd_song_get_end(song) * 1000; s->end_ms = mpd_song_get_end(song) * 1000;
Tag *tag = new Tag(); TagBuilder tag;
tag->time = mpd_song_get_duration(song); tag.SetTime(mpd_song_get_duration(song));
tag->BeginAdd();
for (const auto *i = &tag_table[0]; i->d != TAG_NUM_OF_ITEM_TYPES; ++i) for (const auto *i = &tag_table[0]; i->d != TAG_NUM_OF_ITEM_TYPES; ++i)
Copy(*tag, i->d, song, i->s); Copy(tag, i->d, song, i->s);
tag->EndAdd();
s->tag = tag; s->tag = tag.Commit();
return s; return s;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment