From d70bdbe6759ff47b76802aaa02ff8a0cdac20512 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Wed, 2 Nov 2011 13:33:39 -0400 Subject: Check .empty() instead of .size() == 0 Found with cppcheck. --- src/FbTk/Menu.cc | 4 ++-- util/fbrun/FbRun.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 671d32a..a66b6c0 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -378,7 +378,7 @@ void Menu::enterSubmenu() { if (submenu == 0) return; - if (submenu->menuitems.size() == 0) + if (submenu->menuitems.empty()) return; drawSubmenu(m_active_index); @@ -773,7 +773,7 @@ void Menu::drawSubmenu(unsigned int index) { int Menu::drawItem(FbDrawable &drawable, unsigned int index, bool highlight, bool exclusive_drawable) { - if (index >= menuitems.size() || menuitems.size() == 0 || + if (index >= menuitems.size() || menuitems.empty() || m_rows_per_column == 0) return 0; diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index 1dd813a..9ed3186 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.cc @@ -346,7 +346,7 @@ void FbRun::lockPosition(bool size_too) { } void FbRun::prevHistoryItem() { - if (m_history.size() == 0 || m_current_history_item == 0) { + if (m_history.empty() || m_current_history_item == 0) { XBell(m_display, 0); } else { m_current_history_item--; @@ -370,7 +370,7 @@ void FbRun::nextHistoryItem() { } void FbRun::firstHistoryItem() { - if (m_history.size() == 0 || m_current_history_item == 0) { + if (m_history.empty() || m_current_history_item == 0) { XBell(m_display, 0); } else { m_current_history_item = 0; @@ -380,7 +380,7 @@ void FbRun::firstHistoryItem() { void FbRun::lastHistoryItem() { // actually one past the end - if (m_history.size() == 0) { + if (m_history.empty()) { XBell(m_display, 0); } else { m_current_history_item = m_history.size(); -- cgit v0.11.2