diff options
author | Max Kellermann <max@duempel.org> | 2014-07-30 20:58:14 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-07-30 22:17:01 +0200 |
commit | 9fb351a139a56fc7b1ece549894f8fc31fa887cd (patch) | |
tree | 7c9ce42a1262af587f1b9fede2b24ff39cef93fc /src/SongSave.cxx | |
parent | 0d0ccacdf3e154b1cc27a0840fce80ac13f9641c (diff) | |
download | mpd-9fb351a139a56fc7b1ece549894f8fc31fa887cd.tar.gz mpd-9fb351a139a56fc7b1ece549894f8fc31fa887cd.tar.xz mpd-9fb351a139a56fc7b1ece549894f8fc31fa887cd.zip |
*Save, *State: use the OutputStream API instead of FILE*
Diffstat (limited to '')
-rw-r--r-- | src/SongSave.cxx | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/SongSave.cxx b/src/SongSave.cxx index d6c1dbdd7..02a7861e5 100644 --- a/src/SongSave.cxx +++ b/src/SongSave.cxx @@ -23,6 +23,7 @@ #include "DetachedSong.hxx" #include "TagSave.hxx" #include "fs/TextFile.hxx" +#include "fs/output/BufferedOutputStream.hxx" #include "tag/Tag.hxx" #include "tag/TagBuilder.hxx" #include "util/StringUtil.hxx" @@ -38,38 +39,38 @@ static constexpr Domain song_save_domain("song_save"); static void -range_save(FILE *file, unsigned start_ms, unsigned end_ms) +range_save(BufferedOutputStream &os, unsigned start_ms, unsigned end_ms) { if (end_ms > 0) - fprintf(file, "Range: %u-%u\n", start_ms, end_ms); + os.Format("Range: %u-%u\n", start_ms, end_ms); else if (start_ms > 0) - fprintf(file, "Range: %u-\n", start_ms); + os.Format("Range: %u-\n", start_ms); } void -song_save(FILE *fp, const Song &song) +song_save(BufferedOutputStream &os, const Song &song) { - fprintf(fp, SONG_BEGIN "%s\n", song.uri); + os.Format(SONG_BEGIN "%s\n", song.uri); - range_save(fp, song.start_ms, song.end_ms); + range_save(os, song.start_ms, song.end_ms); - tag_save(fp, song.tag); + tag_save(os, song.tag); - fprintf(fp, SONG_MTIME ": %li\n", (long)song.mtime); - fprintf(fp, SONG_END "\n"); + os.Format(SONG_MTIME ": %li\n", (long)song.mtime); + os.Format(SONG_END "\n"); } void -song_save(FILE *fp, const DetachedSong &song) +song_save(BufferedOutputStream &os, const DetachedSong &song) { - fprintf(fp, SONG_BEGIN "%s\n", song.GetURI()); + os.Format(SONG_BEGIN "%s\n", song.GetURI()); - range_save(fp, song.GetStartMS(), song.GetEndMS()); + range_save(os, song.GetStartMS(), song.GetEndMS()); - tag_save(fp, song.GetTag()); + tag_save(os, song.GetTag()); - fprintf(fp, SONG_MTIME ": %li\n", (long)song.GetLastModified()); - fprintf(fp, SONG_END "\n"); + os.Format(SONG_MTIME ": %li\n", (long)song.GetLastModified()); + os.Format(SONG_END "\n"); } DetachedSong * |