aboutsummaryrefslogtreecommitdiffstats
path: root/src/SongUpdate.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-07-30 20:11:57 +0200
committerMax Kellermann <max@duempel.org>2013-07-30 20:19:53 +0200
commit06f898cc1240a29b293de0e97ad95a4fdc971254 (patch)
tree001a6d3db039cdc03323f3bfddc13b94bde31ce4 /src/SongUpdate.cxx
parent6a9ab8bc0e2f5d34803513bb2d94d041a607a58c (diff)
downloadmpd-06f898cc1240a29b293de0e97ad95a4fdc971254.tar.gz
mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.tar.xz
mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.zip
tag: convert to C++
Diffstat (limited to 'src/SongUpdate.cxx')
-rw-r--r--src/SongUpdate.cxx23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx
index 13d08fecc..9c4d44227 100644
--- a/src/SongUpdate.cxx
+++ b/src/SongUpdate.cxx
@@ -24,7 +24,7 @@
#include "Mapper.hxx"
#include "fs/Path.hxx"
#include "fs/FileSystem.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include "input_stream.h"
#include "DecoderPlugin.hxx"
#include "DecoderList.hxx"
@@ -100,10 +100,8 @@ Song::UpdateFile()
if (path_fs.IsNull())
return false;
- if (tag != NULL) {
- tag_free(tag);
- tag = NULL;
- }
+ delete tag;
+ tag = nullptr;
if (!StatFile(path_fs, st) || !S_ISREG(st.st_mode)) {
return false;
@@ -116,12 +114,12 @@ Song::UpdateFile()
do {
/* load file tag */
- tag = tag_new();
+ tag = new Tag();
if (decoder_plugin_scan_file(plugin, path_fs.c_str(),
&full_tag_handler, tag))
break;
- tag_free(tag);
+ delete tag;
tag = nullptr;
/* fall back to stream tag */
@@ -136,13 +134,13 @@ Song::UpdateFile()
/* now try the stream_tag() method */
if (is != NULL) {
- tag = tag_new();
+ tag = new Tag();
if (decoder_plugin_scan_stream(plugin, is,
&full_tag_handler,
tag))
break;
- tag_free(tag);
+ delete tag;
tag = nullptr;
input_stream_lock_seek(is, 0, SEEK_SET, NULL);
@@ -155,7 +153,7 @@ Song::UpdateFile()
if (is != NULL)
input_stream_close(is);
- if (tag != nullptr && tag_is_empty(tag))
+ if (tag != nullptr && tag->IsEmpty())
tag_scan_fallback(path_fs.c_str(), &full_tag_handler, tag);
return tag != nullptr;
@@ -179,13 +177,12 @@ Song::UpdateFileInArchive()
if (plugin == NULL)
return false;
- if (tag != nullptr)
- tag_free(tag);
+ delete tag;
//accept every file that has music suffix
//because we don't support tag reading through
//input streams
- tag = tag_new();
+ tag = new Tag();
return true;
}