aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/FlacIOHandle.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/decoder/FlacIOHandle.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/decoder/FlacIOHandle.cxx')
-rw-r--r--src/decoder/FlacIOHandle.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/decoder/FlacIOHandle.cxx b/src/decoder/FlacIOHandle.cxx
index 16a07a9d1..cf877414b 100644
--- a/src/decoder/FlacIOHandle.cxx
+++ b/src/decoder/FlacIOHandle.cxx
@@ -19,7 +19,7 @@
#include "config.h"
#include "FlacIOHandle.hxx"
-#include "io_error.h"
+#include "util/Error.hxx"
#include "gcc.h"
#include <errno.h>
@@ -35,21 +35,20 @@ FlacIORead(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle)
/* libFLAC is very picky about short reads, and expects the IO
callback to fill the whole buffer (undocumented!) */
- GError *error = nullptr;
+ Error error;
while (p < end) {
- size_t nbytes = input_stream_lock_read(is, p, end - p, &error);
+ size_t nbytes = input_stream_lock_read(is, p, end - p, error);
if (nbytes == 0) {
- if (error == nullptr)
+ if (!error.IsDefined())
/* end of file */
break;
- if (error->domain == errno_quark())
- errno = error->code;
+ if (error.IsDomain(errno_domain))
+ errno = error.GetCode();
else
/* just some random non-zero
errno value */
errno = EINVAL;
- g_error_free(error);
return 0;
}
@@ -67,7 +66,8 @@ FlacIOSeek(FLAC__IOHandle handle, FLAC__int64 offset, int whence)
{
input_stream *is = (input_stream *)handle;
- return input_stream_lock_seek(is, offset, whence, nullptr) ? 0 : -1;
+ Error error;
+ return input_stream_lock_seek(is, offset, whence, error) ? 0 : -1;
}
static FLAC__int64