diff options
author | Max Kellermann <max@duempel.org> | 2013-08-10 18:02:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-04 18:14:22 +0200 |
commit | 29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch) | |
tree | 79766830b55ebca38ddbce84d8d548227eedb69e /test/visit_archive.cxx | |
parent | c9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff) |
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to 'test/visit_archive.cxx')
-rw-r--r-- | test/visit_archive.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx index 047ef4d6d..b059f16f9 100644 --- a/test/visit_archive.cxx +++ b/test/visit_archive.cxx @@ -28,6 +28,7 @@ #include "ArchiveFile.hxx" #include "ArchiveVisitor.hxx" #include "fs/Path.hxx" +#include "util/Error.hxx" #include <glib.h> @@ -54,7 +55,7 @@ class MyArchiveVisitor final : public ArchiveVisitor { int main(int argc, char **argv) { - GError *error = nullptr; + Error error; if (argc != 3) { fprintf(stderr, "Usage: visit_archive PLUGIN PATH\n"); @@ -81,9 +82,8 @@ main(int argc, char **argv) archive_plugin_init_all(); - if (!input_stream_global_init(&error)) { - g_warning("%s", error->message); - g_error_free(error); + if (!input_stream_global_init(error)) { + fprintf(stderr, "%s", error.GetMessage()); return 2; } @@ -97,14 +97,13 @@ main(int argc, char **argv) int result = EXIT_SUCCESS; - ArchiveFile *file = archive_file_open(plugin, path.c_str(), &error); + ArchiveFile *file = archive_file_open(plugin, path.c_str(), error); if (file != nullptr) { MyArchiveVisitor visitor; file->Visit(visitor); file->Close(); } else { - fprintf(stderr, "%s\n", error->message); - g_error_free(error); + fprintf(stderr, "%s", error.GetMessage()); result = EXIT_FAILURE; } |