diff options
author | Denis Krjuchkov <denis@crazydev.net> | 2013-05-12 20:02:27 +0600 |
---|---|---|
committer | Denis Krjuchkov <denis@crazydev.net> | 2013-05-12 20:02:27 +0600 |
commit | e9e55b08127dc45b4c6045e1f42e34115086a521 (patch) | |
tree | c79558219a5605584dc6c81cc1dea348afdf3d75 /test/dump_text_file.cxx | |
parent | 49a3845135142ada6d581d5a6f4a5192aaed49be (diff) | |
download | mpd-e9e55b08127dc45b4c6045e1f42e34115086a521.tar.gz mpd-e9e55b08127dc45b4c6045e1f42e34115086a521.tar.xz mpd-e9e55b08127dc45b4c6045e1f42e34115086a521.zip |
text_input_stream: convert to class
Diffstat (limited to 'test/dump_text_file.cxx')
-rw-r--r-- | test/dump_text_file.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index 19502c7fd..40b3a878f 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.cxx @@ -23,10 +23,7 @@ #include "InputStream.hxx" #include "conf.h" #include "stdbin.h" - -extern "C" { -#include "text_input_stream.h" -} +#include "TextInputStream.hxx" #ifdef ENABLE_ARCHIVE #include "ArchiveList.hxx" @@ -49,11 +46,11 @@ my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, } static void -dump_text_file(struct text_input_stream *is) +dump_text_file(TextInputStream &is) { - const char *line; - while ((line = text_input_stream_read(is)) != NULL) - printf("'%s'\n", line); + std::string line; + while (is.ReadLine(line)) + printf("'%s'\n", line.c_str()); } static int @@ -77,11 +74,10 @@ dump_input_stream(struct input_stream *is) /* read data and tags from the stream */ input_stream_unlock(is); - - struct text_input_stream *tis = text_input_stream_new(is); - dump_text_file(tis); - text_input_stream_free(tis); - + { + TextInputStream tis(is); + dump_text_file(tis); + } input_stream_lock(is); if (!input_stream_check(is, &error)) { |