diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/run_input.cxx | 20 |
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; |