aboutsummaryrefslogtreecommitdiffstats
path: root/src/TagSave.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/TagSave.cxx')
-rw-r--r--src/TagSave.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/TagSave.cxx b/src/TagSave.cxx
index b20d986c2..107aca7db 100644
--- a/src/TagSave.cxx
+++ b/src/TagSave.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,19 +20,19 @@
#include "config.h"
#include "TagSave.hxx"
#include "tag/Tag.hxx"
-#include "Song.hxx"
+#include "fs/io/BufferedOutputStream.hxx"
+
+#define SONG_TIME "Time: "
void
-tag_save(FILE *file, const Tag &tag)
+tag_save(BufferedOutputStream &os, const Tag &tag)
{
- if (tag.time >= 0)
- fprintf(file, SONG_TIME "%i\n", tag.time);
+ if (!tag.duration.IsNegative())
+ os.Format(SONG_TIME "%f\n", tag.duration.ToDoubleS());
if (tag.has_playlist)
- fprintf(file, "Playlist: yes\n");
+ os.Format("Playlist: yes\n");
- for (unsigned i = 0; i < tag.num_items; i++)
- fprintf(file, "%s: %s\n",
- tag_item_names[tag.items[i]->type],
- tag.items[i]->value);
+ for (const auto &i : tag)
+ os.Format("%s: %s\n", tag_item_names[i.type], i.value);
}