aboutsummaryrefslogtreecommitdiffstats
path: root/test/visit_archive.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/visit_archive.cxx41
1 files changed, 15 insertions, 26 deletions
diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx
index 6e66c4696..1ff3ba484 100644
--- a/test/visit_archive.cxx
+++ b/test/visit_archive.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,31 +20,23 @@
#include "config.h"
#include "stdbin.h"
#include "tag/Tag.hxx"
-#include "ConfigGlobal.hxx"
-#include "IOThread.hxx"
-#include "InputInit.hxx"
-#include "ArchiveList.hxx"
-#include "ArchivePlugin.hxx"
-#include "ArchiveFile.hxx"
-#include "ArchiveVisitor.hxx"
+#include "config/ConfigGlobal.hxx"
+#include "ScopeIOThread.hxx"
+#include "input/Init.hxx"
+#include "archive/ArchiveList.hxx"
+#include "archive/ArchivePlugin.hxx"
+#include "archive/ArchiveFile.hxx"
+#include "archive/ArchiveVisitor.hxx"
#include "fs/Path.hxx"
#include "util/Error.hxx"
+#ifdef HAVE_GLIB
#include <glib.h>
+#endif
#include <unistd.h>
#include <stdlib.h>
-static void
-my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
- const gchar *message, gcc_unused gpointer user_data)
-{
- if (log_domain != NULL)
- g_printerr("%s: %s\n", log_domain, message);
- else
- g_printerr("%s\n", message);
-}
-
class MyArchiveVisitor final : public ArchiveVisitor {
public:
virtual void VisitArchiveEntry(const char *path_utf8) override {
@@ -67,18 +59,17 @@ main(int argc, char **argv)
/* initialize GLib */
+#ifdef HAVE_GLIB
#if !GLIB_CHECK_VERSION(2,32,0)
g_thread_init(NULL);
#endif
-
- g_log_set_default_handler(my_log_func, NULL);
+#endif
/* initialize MPD */
config_global_init();
- io_thread_init();
- io_thread_start();
+ const ScopeIOThread io_thread;
archive_plugin_init_all();
@@ -89,7 +80,7 @@ main(int argc, char **argv)
/* open the archive and dump it */
- const archive_plugin *plugin = archive_plugin_from_name(plugin_name);
+ const ArchivePlugin *plugin = archive_plugin_from_name(plugin_name);
if (plugin == nullptr) {
fprintf(stderr, "No such plugin: %s\n", plugin_name);
return EXIT_FAILURE;
@@ -97,7 +88,7 @@ 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, error);
if (file != nullptr) {
MyArchiveVisitor visitor;
file->Visit(visitor);
@@ -113,8 +104,6 @@ main(int argc, char **argv)
archive_plugin_deinit_all();
- io_thread_deinit();
-
config_global_finish();
return result;