aboutsummaryrefslogtreecommitdiffstats
path: root/src/TagId3.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/TagId3.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/TagId3.cxx')
-rw-r--r--src/TagId3.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/TagId3.cxx b/src/TagId3.cxx
index 6b2174fe5..3f7605f5e 100644
--- a/src/TagId3.cxx
+++ b/src/TagId3.cxx
@@ -22,6 +22,7 @@
#include "TagHandler.hxx"
#include "TagTable.hxx"
#include "Tag.hxx"
+#include "util/Error.hxx"
extern "C" {
#include "riff.h"
@@ -29,7 +30,6 @@ extern "C" {
}
#include "conf.h"
-#include "io_error.h"
#include <glib.h>
#include <id3tag.h>
@@ -545,13 +545,11 @@ tag_id3_riff_aiff_load(FILE *file)
}
struct id3_tag *
-tag_id3_load(const char *path_fs, GError **error_r)
+tag_id3_load(const char *path_fs, Error &error)
{
FILE *file = fopen(path_fs, "rb");
if (file == nullptr) {
- g_set_error(error_r, errno_quark(), errno,
- "Failed to open file %s: %s",
- path_fs, g_strerror(errno));
+ error.FormatErrno("Failed to open file %s", path_fs);
return nullptr;
}
@@ -570,13 +568,11 @@ bool
tag_id3_scan(const char *path_fs,
const struct tag_handler *handler, void *handler_ctx)
{
- GError *error = nullptr;
- struct id3_tag *tag = tag_id3_load(path_fs, &error);
+ Error error;
+ struct id3_tag *tag = tag_id3_load(path_fs, error);
if (tag == nullptr) {
- if (error != nullptr) {
- g_warning("%s", error->message);
- g_error_free(error);
- }
+ if (error.IsDefined())
+ g_warning("%s", error.GetMessage());
return false;
}