summaryrefslogtreecommitdiffstats
path: root/wear_ui.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-09-07 22:38:51 +0200
committerTao Bao <tbao@google.com>2017-09-09 00:28:04 +0200
commit17fa5c7cab503015bde05fbe0455f8a6a3344396 (patch)
tree567e0908c310f7b8e3e75ea18a9250445807f525 /wear_ui.cpp
parentImport translations. DO NOT MERGE (diff)
downloadandroid_bootable_recovery-17fa5c7cab503015bde05fbe0455f8a6a3344396.tar
android_bootable_recovery-17fa5c7cab503015bde05fbe0455f8a6a3344396.tar.gz
android_bootable_recovery-17fa5c7cab503015bde05fbe0455f8a6a3344396.tar.bz2
android_bootable_recovery-17fa5c7cab503015bde05fbe0455f8a6a3344396.tar.lz
android_bootable_recovery-17fa5c7cab503015bde05fbe0455f8a6a3344396.tar.xz
android_bootable_recovery-17fa5c7cab503015bde05fbe0455f8a6a3344396.tar.zst
android_bootable_recovery-17fa5c7cab503015bde05fbe0455f8a6a3344396.zip
Diffstat (limited to '')
-rw-r--r--wear_ui.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 169ef20e1..624116c0c 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -154,11 +154,11 @@ void WearRecoveryUI::draw_screen_locked() {
// white text of selected item
SetColor(MENU_SEL_FG);
if (menu_[i][0]) {
- gr_text(gr_sys_font(), x + 4, y, menu_[i], 1);
+ gr_text(gr_sys_font(), x + 4, y, menu_[i].c_str(), 1);
}
SetColor(MENU);
} else if (menu_[i][0]) {
- gr_text(gr_sys_font(), x + 4, y, menu_[i], 0);
+ gr_text(gr_sys_font(), x + 4, y, menu_[i].c_str(), 0);
}
y += char_height_ + 4;
}
@@ -255,17 +255,16 @@ void WearRecoveryUI::StartMenu(const char* const* headers, const char* const* it
pthread_mutex_lock(&updateMutex);
if (text_rows_ > 0 && text_cols_ > 0) {
menu_headers_ = headers;
- size_t i = 0;
+ menu_.clear();
// "i < text_rows_" is removed from the loop termination condition,
// which is different from the one in ScreenRecoveryUI::StartMenu().
// Because WearRecoveryUI supports scrollable menu, it's fine to have
// more entries than text_rows_. The menu may be truncated otherwise.
// Bug: 23752519
- for (; items[i] != nullptr; i++) {
- strncpy(menu_[i], items[i], text_cols_ - 1);
- menu_[i][text_cols_ - 1] = '\0';
+ for (size_t i = 0; items[i] != nullptr; i++) {
+ menu_.emplace_back(std::string(items[i], strnlen(items[i], text_cols_ - 1)));
}
- menu_items = i;
+ menu_items = static_cast<int>(menu_.size());
show_menu = true;
menu_sel = initial_selection;
menu_start = 0;