aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-09 22:14:47 +0100
committerMax Kellermann <max@duempel.org>2014-12-09 22:14:47 +0100
commit7b60e3916c77560123229511abbe87b2910c035d (patch)
treea4b71428167b7606a404ab14cc0b99cd9c72ad19 /src/lib
parentc486c5bf5b4ec2e76be5a42faf96468d6bbf44d2 (diff)
downloadmpd-7b60e3916c77560123229511abbe87b2910c035d.tar.gz
mpd-7b60e3916c77560123229511abbe87b2910c035d.tar.xz
mpd-7b60e3916c77560123229511abbe87b2910c035d.zip
DespotifyUtils: make string buffers temporary
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/despotify/DespotifyUtils.cxx29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/lib/despotify/DespotifyUtils.cxx b/src/lib/despotify/DespotifyUtils.cxx
index 51ded7578..aae16000c 100644
--- a/src/lib/despotify/DespotifyUtils.cxx
+++ b/src/lib/despotify/DespotifyUtils.cxx
@@ -88,23 +88,30 @@ mpd_despotify_tag_from_track(const ds_track &track)
TagBuilder tag;
- char tracknum[20];
- snprintf(tracknum, sizeof(tracknum), "%d", track.tracknumber);
+ {
+ char tracknum[20];
+ snprintf(tracknum, sizeof(tracknum), "%d", track.tracknumber);
+ tag.AddItem(TAG_TRACK, tracknum);
+ }
- char date[20];
- snprintf(date, sizeof(date), "%d", track.year);
+ {
+ char date[20];
+ snprintf(date, sizeof(date), "%d", track.year);
+ tag.AddItem(TAG_DATE, date);
+ }
- char comment[80];
- snprintf(comment, sizeof(comment), "Bitrate %d Kbps, %sgeo restricted",
- track.file_bitrate / 1000,
- track.geo_restricted ? "" : "not ");
+ {
+ char comment[80];
+ snprintf(comment, sizeof(comment),
+ "Bitrate %d Kbps, %sgeo restricted",
+ track.file_bitrate / 1000,
+ track.geo_restricted ? "" : "not ");
+ tag.AddItem(TAG_COMMENT, comment);
+ }
tag.AddItem(TAG_TITLE, track.title);
tag.AddItem(TAG_ARTIST, track.artist->name);
- tag.AddItem(TAG_TRACK, tracknum);
tag.AddItem(TAG_ALBUM, track.album);
- tag.AddItem(TAG_DATE, date);
- tag.AddItem(TAG_COMMENT, comment);
tag.SetDuration(SignedSongTime::FromMS(track.length));
return tag.Commit();