aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/MmsInputPlugin.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/input/MmsInputPlugin.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 '')
-rw-r--r--src/input/MmsInputPlugin.cxx21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/input/MmsInputPlugin.cxx b/src/input/MmsInputPlugin.cxx
index 80d479613..02810bb22 100644
--- a/src/input/MmsInputPlugin.cxx
+++ b/src/input/MmsInputPlugin.cxx
@@ -22,6 +22,8 @@
#include "InputInternal.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
+#include "util/Error.hxx"
+#include "util/Domain.hxx"
#include <glib.h>
#include <libmms/mmsx.h>
@@ -56,16 +58,12 @@ struct MmsInputStream {
}
};
-static inline GQuark
-mms_quark(void)
-{
- return g_quark_from_static_string("mms");
-}
+static constexpr Domain mms_domain("mms");
static struct input_stream *
input_mms_open(const char *url,
Mutex &mutex, Cond &cond,
- GError **error_r)
+ Error &error)
{
if (!g_str_has_prefix(url, "mms://") &&
!g_str_has_prefix(url, "mmsh://") &&
@@ -75,7 +73,7 @@ input_mms_open(const char *url,
const auto mms = mmsx_connect(nullptr, nullptr, url, 128 * 1024);
if (mms == nullptr) {
- g_set_error(error_r, mms_quark(), 0, "mmsx_connect() failed");
+ error.Set(mms_domain, "mmsx_connect() failed");
return nullptr;
}
@@ -85,18 +83,15 @@ input_mms_open(const char *url,
static size_t
input_mms_read(struct input_stream *is, void *ptr, size_t size,
- GError **error_r)
+ Error &error)
{
MmsInputStream *m = (MmsInputStream *)is;
int ret;
ret = mmsx_read(nullptr, m->mms, (char *)ptr, size);
if (ret <= 0) {
- if (ret < 0) {
- g_set_error(error_r, mms_quark(), errno,
- "mmsx_read() failed: %s",
- g_strerror(errno));
- }
+ if (ret < 0)
+ error.SetErrno("mmsx_read() failed");
m->eof = true;
return false;