From 29030b54c98b0aee65fbc10ebf7ba36bed98c02c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Aug 2013 18:02:44 +0200 Subject: util/Error: new error passing library Replaces GLib's GError. --- src/TagId3.cxx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/TagId3.cxx') 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 #include @@ -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; } -- cgit v1.2.3