aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-11-26 20:19:17 +0100
committerMax Kellermann <max@duempel.org>2014-11-26 20:19:17 +0100
commit737a56a0302b1030e1071c7be9add7bdca955e32 (patch)
tree93d9b6d625fa1b0ce9e8bf8d13fbc829be5178d1 /test
parent12b6959ea201fea925c4376f961b8d54738292e2 (diff)
parent67cba251c8826409c82fb2ab75072dc4fca2b4dc (diff)
downloadmpd-737a56a0302b1030e1071c7be9add7bdca955e32.tar.gz
mpd-737a56a0302b1030e1071c7be9add7bdca955e32.tar.xz
mpd-737a56a0302b1030e1071c7be9add7bdca955e32.zip
Merge tag 'v0.19.5'
Diffstat (limited to 'test')
-rw-r--r--test/run_input.cxx20
1 files changed, 8 insertions, 12 deletions
diff --git a/test/run_input.cxx b/test/run_input.cxx
index de5bd9632..6864a5d64 100644
--- a/test/run_input.cxx
+++ b/test/run_input.cxx
@@ -54,11 +54,6 @@ tag_save(FILE *file, const Tag &tag)
static int
dump_input_stream(InputStream *is)
{
- Error error;
- char buffer[4096];
- size_t num_read;
- ssize_t num_written;
-
is->Lock();
/* print meta data */
@@ -76,7 +71,9 @@ dump_input_stream(InputStream *is)
delete tag;
}
- num_read = is->Read(buffer, sizeof(buffer), error);
+ Error error;
+ char buffer[4096];
+ size_t num_read = is->Read(buffer, sizeof(buffer), error);
if (num_read == 0) {
if (error.IsDefined())
LogError(error);
@@ -84,11 +81,12 @@ dump_input_stream(InputStream *is)
break;
}
- num_written = write(1, buffer, num_read);
+ ssize_t num_written = write(1, buffer, num_read);
if (num_written <= 0)
break;
}
+ Error error;
if (!is->Check(error)) {
LogError(error);
is->Unlock();
@@ -102,10 +100,6 @@ dump_input_stream(InputStream *is)
int main(int argc, char **argv)
{
- Error error;
- InputStream *is;
- int ret;
-
if (argc != 2) {
fprintf(stderr, "Usage: run_input URI\n");
return EXIT_FAILURE;
@@ -129,6 +123,7 @@ int main(int argc, char **argv)
archive_plugin_init_all();
#endif
+ Error error;
if (!input_stream_global_init(error)) {
LogError(error);
return 2;
@@ -139,7 +134,8 @@ int main(int argc, char **argv)
Mutex mutex;
Cond cond;
- is = InputStream::OpenReady(argv[1], mutex, cond, error);
+ InputStream *is = InputStream::OpenReady(argv[1], mutex, cond, error);
+ int ret;
if (is != NULL) {
ret = dump_input_stream(is);
delete is;