aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderThread.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/DecoderThread.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/DecoderThread.cxx')
-rw-r--r--src/DecoderThread.cxx30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx
index 8c196cdae..5a44f0453 100644
--- a/src/DecoderThread.cxx
+++ b/src/DecoderThread.cxx
@@ -32,6 +32,7 @@
#include "InputStream.hxx"
#include "DecoderList.hxx"
#include "util/UriUtil.hxx"
+#include "util/Error.hxx"
#include "ApeReplayGain.hxx"
#include <glib.h>
@@ -72,15 +73,12 @@ decoder_command_finished_locked(struct decoder_control *dc)
static struct input_stream *
decoder_input_stream_open(struct decoder_control *dc, const char *uri)
{
- GError *error = NULL;
- struct input_stream *is;
+ Error error;
- is = input_stream_open(uri, dc->mutex, dc->cond, &error);
+ input_stream *is = input_stream_open(uri, dc->mutex, dc->cond, error);
if (is == NULL) {
- if (error != NULL) {
- g_warning("%s", error->message);
- g_error_free(error);
- }
+ if (error.IsDefined())
+ g_warning("%s", error.GetMessage());
return NULL;
}
@@ -98,12 +96,10 @@ decoder_input_stream_open(struct decoder_control *dc, const char *uri)
input_stream_update(is);
}
- if (!input_stream_check(is, &error)) {
+ if (!input_stream_check(is, error)) {
dc->Unlock();
- g_warning("%s", error->message);
- g_error_free(error);
-
+ g_warning("%s", error.GetMessage());
return NULL;
}
@@ -132,7 +128,10 @@ decoder_stream_decode(const struct decoder_plugin *plugin,
return true;
/* rewind the stream, so each plugin gets a fresh start */
- input_stream_seek(input_stream, 0, SEEK_SET, NULL);
+ {
+ Error error;
+ input_stream_seek(input_stream, 0, SEEK_SET, error);
+ }
decoder->dc->Unlock();
@@ -411,8 +410,8 @@ decoder_run_song(struct decoder_control *dc,
if (allocated != NULL)
error_uri = allocated;
- dc->error = g_error_new(decoder_quark(), 0,
- "Failed to decode %s", error_uri);
+ dc->error.Format(decoder_domain,
+ "Failed to decode %s", error_uri);
g_free(allocated);
}
@@ -436,8 +435,7 @@ decoder_run(struct decoder_control *dc)
if (uri == NULL) {
dc->state = DECODE_STATE_ERROR;
- dc->error = g_error_new(decoder_quark(), 0,
- "Failed to map song");
+ dc->error.Set(decoder_domain, "Failed to map song");
decoder_command_finished_locked(dc);
return;