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-08 19:50:07 +0200
commite15d7a5104978cd8399501636aec0df9c1a4823c (patch)
tree7687f86225f3725f505c6ee1d3f59e21d041c40b /wear_ui.cpp
parentMerge "wear_ui: Remove PrintOnScreenOnly() and PrintV()." (diff)
downloadandroid_bootable_recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.tar
android_bootable_recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.tar.gz
android_bootable_recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.tar.bz2
android_bootable_recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.tar.lz
android_bootable_recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.tar.xz
android_bootable_recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.tar.zst
android_bootable_recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.zip
Diffstat (limited to 'wear_ui.cpp')
-rw-r--r--wear_ui.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 670050a0b..edc39cfb4 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -127,11 +127,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;
}
@@ -199,17 +199,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;