aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist/SoundCloudPlaylistPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-10 18:02:44 +0200
committerMax Kellermann <max@duempel.org>2013-09-04 18:14:22 +0200
commit29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch)
tree79766830b55ebca38ddbce84d8d548227eedb69e /src/playlist/SoundCloudPlaylistPlugin.cxx
parentc9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff)
downloadmpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz
mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz
mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to 'src/playlist/SoundCloudPlaylistPlugin.cxx')
-rw-r--r--src/playlist/SoundCloudPlaylistPlugin.cxx25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/playlist/SoundCloudPlaylistPlugin.cxx b/src/playlist/SoundCloudPlaylistPlugin.cxx
index b60635049..b6be4fd30 100644
--- a/src/playlist/SoundCloudPlaylistPlugin.cxx
+++ b/src/playlist/SoundCloudPlaylistPlugin.cxx
@@ -24,6 +24,7 @@
#include "InputLegacy.hxx"
#include "Song.hxx"
#include "Tag.hxx"
+#include "util/Error.hxx"
#include <glib.h>
#include <yajl/yajl_parse.h>
@@ -244,18 +245,15 @@ static int
soundcloud_parse_json(const char *url, yajl_handle hand,
Mutex &mutex, Cond &cond)
{
- struct input_stream *input_stream;
- GError *error = NULL;
char buffer[4096];
unsigned char *ubuffer = (unsigned char *)buffer;
- size_t nbytes;
- input_stream = input_stream_open(url, mutex, cond, &error);
+ Error error;
+ input_stream *input_stream = input_stream_open(url, mutex, cond,
+ error);
if (input_stream == NULL) {
- if (error != NULL) {
- g_warning("%s", error->message);
- g_error_free(error);
- }
+ if (error.IsDefined())
+ g_warning("%s", error.GetMessage());
return -1;
}
@@ -266,12 +264,13 @@ soundcloud_parse_json(const char *url, yajl_handle hand,
int done = 0;
while (!done) {
- nbytes = input_stream_read(input_stream, buffer, sizeof(buffer), &error);
+ const size_t nbytes =
+ input_stream_read(input_stream, buffer, sizeof(buffer),
+ error);
if (nbytes == 0) {
- if (error != NULL) {
- g_warning("%s", error->message);
- g_error_free(error);
- }
+ if (error.IsDefined())
+ g_warning("%s", error.GetMessage());
+
if (input_stream_eof(input_stream)) {
done = true;
} else {