From 9a7fd80d2dd706343f24c91b0756771aca8504a5 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 10 Sep 2015 13:33:58 -0700 Subject: recovery: Remove redirect_stdio() when calling ShowFile(). When calling ScreenRecoveryUI::ShowFile(), the only thing that gets inadequately logged is the progress bar. Replace the call to ScreenRecoveryUI::Print() with ScreenRecoveryUI::PrintOnScreenOnly() for the progress bar, so we can avoid calling redirect_stdio(). Change-Id: I4d7c5d5b39bebe0d5880a99d7a72cee4f0b8f325 --- recovery.cpp | 3 --- screen_ui.cpp | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/recovery.cpp b/recovery.cpp index c683bae1d..379137a64 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -745,10 +745,7 @@ static void choose_recovery_file(Device* device) { int chosen_item = get_menu_selection(headers, entries, 1, 0, device); if (strcmp(entries[chosen_item], "Back") == 0) break; - // TODO: do we need to redirect? ShowFile could just avoid writing to stdio. - redirect_stdio("/dev/null"); ui->ShowFile(entries[chosen_item]); - redirect_stdio(TEMPORARY_LOG_FILE); } for (size_t i = 0; i < (sizeof(entries) / sizeof(*entries)); i++) { diff --git a/screen_ui.cpp b/screen_ui.cpp index ddf85c19e..f2fda2fb5 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -581,7 +581,7 @@ void ScreenRecoveryUI::ShowFile(FILE* fp) { bool show_prompt = false; while (true) { if (show_prompt) { - Print("--(%d%% of %d bytes)--", + PrintOnScreenOnly("--(%d%% of %d bytes)--", static_cast(100 * (double(ftell(fp)) / double(sb.st_size))), static_cast(sb.st_size)); Redraw(); -- cgit v1.2.3