diff options
Diffstat (limited to '')
-rw-r--r-- | test/dump_text_file.cxx | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index bb84f5cce..37bd63a04 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.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 @@ -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 */ |