aboutsummaryrefslogtreecommitdiffstats
path: root/test/dump_text_file.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/dump_text_file.cxx40
1 files changed, 6 insertions, 34 deletions
diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx
index bb84f5cce..764d3f24b 100644
--- a/test/dump_text_file.cxx
+++ b/test/dump_text_file.cxx
@@ -39,16 +39,6 @@
#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);
-}
-
-static void
dump_text_file(TextInputStream &is)
{
std::string line;
@@ -59,23 +49,6 @@ dump_text_file(TextInputStream &is)
static int
dump_input_stream(InputStream &is)
{
- Error error;
-
- is.Lock();
-
- /* wait until the stream becomes ready */
-
- is.WaitReady();
-
- if (!is.Check(error)) {
- LogError(error);
- is.Unlock();
- return EXIT_FAILURE;
- }
-
- /* read data and tags from the stream */
-
- is.Unlock();
{
TextInputStream tis(is);
dump_text_file(tis);
@@ -83,6 +56,7 @@ dump_input_stream(InputStream &is)
is.Lock();
+ Error error;
if (!is.Check(error)) {
LogError(error);
is.Unlock();
@@ -99,8 +73,8 @@ int main(int argc, char **argv)
int ret;
if (argc != 2) {
- g_printerr("Usage: run_input URI\n");
- return 1;
+ fprintf(stderr, "Usage: run_input URI\n");
+ return EXIT_FAILURE;
}
/* initialize GLib */
@@ -109,8 +83,6 @@ int main(int argc, char **argv)
g_thread_init(NULL);
#endif
- g_log_set_default_handler(my_log_func, NULL);
-
/* initialize MPD */
config_global_init();
@@ -133,7 +105,7 @@ int main(int argc, char **argv)
Mutex mutex;
Cond cond;
- InputStream *is = InputStream::Open(argv[1], mutex, cond, error);
+ InputStream *is = InputStream::OpenReady(argv[1], mutex, cond, error);
if (is != NULL) {
ret = dump_input_stream(*is);
is->Close();
@@ -141,8 +113,8 @@ int main(int argc, char **argv)
if (error.IsDefined())
LogError(error);
else
- g_printerr("input_stream::Open() failed\n");
- ret = 2;
+ fprintf(stderr, "input_stream::Open() failed\n");
+ ret = EXIT_FAILURE;
}
/* deinitialize everything */