From 550ca6464ac80361ebbb11ca3ed25aab4996bd06 Mon Sep 17 00:00:00 2001 From: Rob Purchase Date: Mon, 31 May 2010 21:07:25 +0000 Subject: test_codec: close the log file before attempting to open a new one, and clear the button queue before displaying the menu a second time. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26437 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/test_codec.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 1ecf225529..ed59825e2a 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -46,6 +46,12 @@ static int max_line = 0; static int log_fd = -1; static char logfilename[MAX_PATH]; +static void log_close(void) +{ + if (log_fd >= 0) + rb->close(log_fd); +} + static bool log_init(bool use_logfile) { int h; @@ -57,6 +63,7 @@ static bool log_init(bool use_logfile) rb->lcd_update(); if (use_logfile) { + log_close(); rb->create_numbered_filename(logfilename, "/", "test_codec_log_", ".txt", 2 IF_CNFN_NUM_(, NULL)); log_fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC, 0666); @@ -79,12 +86,6 @@ static void log_text(char *text, bool advance) } } -static void log_close(void) -{ - if (log_fd >= 0) - rb->close(log_fd); -} - struct wavinfo_t { int fd; @@ -860,6 +861,7 @@ show_menu: } while (rb->button_get(true) != TESTCODEC_EXITBUTTON); } + rb->button_clear_queue(); goto show_menu; exit: -- cgit v1.2.3