From be8ceae6e6c2836233dd8acedd829b18943f820a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 17 Oct 2013 01:01:15 +0200 Subject: Song: GetURI() returns std::string --- src/DecoderThread.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/DecoderThread.cxx') diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx index aacbb1fb7..4d0d008ca 100644 --- a/src/DecoderThread.cxx +++ b/src/DecoderThread.cxx @@ -422,16 +422,13 @@ decoder_run(struct decoder_control *dc) dc->ClearError(); const Song *song = dc->song; - char *uri; - assert(song != NULL); - if (song->IsFile()) - uri = g_strdup(map_song_fs(song).c_str()); - else - uri = song->GetURI(); + const std::string uri = song->IsFile() + ? std::string(map_song_fs(song).c_str()) + : song->GetURI(); - if (uri == NULL) { + if (uri.empty()) { dc->state = DecoderState::ERROR; dc->error.Set(decoder_domain, "Failed to map song"); @@ -439,8 +436,7 @@ decoder_run(struct decoder_control *dc) return; } - decoder_run_song(dc, song, uri); - g_free(uri); + decoder_run_song(dc, song, uri.c_str()); } -- cgit v1.2.3