1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Rob Purchase 2010-05-31 21:07:25 +00:00
parent a6c1b54d46
commit 550ca6464a

View file

@ -46,6 +46,12 @@ static int max_line = 0;
static int log_fd = -1; static int log_fd = -1;
static char logfilename[MAX_PATH]; 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) static bool log_init(bool use_logfile)
{ {
int h; int h;
@ -57,6 +63,7 @@ static bool log_init(bool use_logfile)
rb->lcd_update(); rb->lcd_update();
if (use_logfile) { if (use_logfile) {
log_close();
rb->create_numbered_filename(logfilename, "/", "test_codec_log_", ".txt", rb->create_numbered_filename(logfilename, "/", "test_codec_log_", ".txt",
2 IF_CNFN_NUM_(, NULL)); 2 IF_CNFN_NUM_(, NULL));
log_fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC, 0666); 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 struct wavinfo_t
{ {
int fd; int fd;
@ -860,6 +861,7 @@ show_menu:
} }
while (rb->button_get(true) != TESTCODEC_EXITBUTTON); while (rb->button_get(true) != TESTCODEC_EXITBUTTON);
} }
rb->button_clear_queue();
goto show_menu; goto show_menu;
exit: exit: