diff options
author | Matthew Gregan <[email protected]> | 2019-07-06 13:20:22 +1200 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2019-07-12 10:04:52 +1200 |
commit | 41112cefeb021ab5c78407332101758b80e4096c (patch) | |
tree | 7d718ff4e57f9d12b1f350be293b73e65ab4d41a /tools | |
parent | 0d1d9d84fb3e827615903a79d2411a49789f0de3 (diff) | |
download | cubeb-41112cefeb021ab5c78407332101758b80e4096c.tar.gz cubeb-41112cefeb021ab5c78407332101758b80e4096c.zip |
cubeb-test: Fix -Wimplicit-int-conversion warning and handle EOF correctly.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/cubeb-test.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/cubeb-test.cpp b/tools/cubeb-test.cpp index 7c35a03..55deaca 100644 --- a/tools/cubeb-test.cpp +++ b/tools/cubeb-test.cpp @@ -282,11 +282,14 @@ void print_help() { fprintf(stderr, "%s\n", msg); } -bool choose_action(const cubeb_client& cl, operation_data * op, char c) { +bool choose_action(const cubeb_client& cl, operation_data * op, int c) { + // Consume "enter" and "space" while (c == 10 || c == 32) { - // Consume "enter and "space" c = getchar(); } + if (c == EOF) { + c = 'q'; + } if (c == 'q') { if (op->pm == PLAYBACK || op->pm == RECORD || op->pm == DUPLEX) { @@ -362,7 +365,7 @@ bool choose_action(const cubeb_client& cl, operation_data * op, char c) { fprintf(stderr, "unregister_device_collection_changed failed\n"); } } else { - fprintf(stderr, "Error: %c is not a valid entry\n", c); + fprintf(stderr, "Error: '%c' is not a valid entry\n", c); } return true; // Loop up |