Fix presubmit build errors
This change combines the following existing fixes:
- fix ArrowKeyNavigationMenu member initialization order (change 55425)
- use %zu for printing size_t (change 56510)
- fix comparison of different signedness (change 56509)
Change-Id: I4538a7a7fad028c0eaef4cb77f4a877487b61c7a
Signed-off-by: Sui Chen <suichen6@gmail.com>
diff --git a/main.cpp b/main.cpp
index 5293f9b..a61b493 100644
--- a/main.cpp
+++ b/main.cpp
@@ -51,34 +51,34 @@
void ActivateWindowA()
{
- g_views[0]->visible_=true;
- g_views[0]->maximize_=true;
- g_views[1]->visible_=false;
- g_views[2]->visible_=false;
+ g_views[0]->visible_ = true;
+ g_views[0]->maximize_ = true;
+ g_views[1]->visible_ = false;
+ g_views[2]->visible_ = false;
}
void ActivateWindowB()
{
- g_views[1]->visible_=true;
- g_views[1]->maximize_=true;
- g_views[0]->visible_=false;
- g_views[2]->visible_=false;
+ g_views[1]->visible_ = true;
+ g_views[1]->maximize_ = true;
+ g_views[0]->visible_ = false;
+ g_views[2]->visible_ = false;
}
void ActivateWindowC()
{
- g_views[2]->visible_=true;
- g_views[2]->maximize_=true;
- g_views[0]->visible_=false;
- g_views[1]->visible_=false;
+ g_views[2]->visible_ = true;
+ g_views[2]->maximize_ = true;
+ g_views[0]->visible_ = false;
+ g_views[1]->visible_ = false;
}
void ActivateAllWindows()
{
g_views[0]->maximize_ = false;
- g_views[1]->maximize_=false;
- g_views[2]->maximize_=false;
- g_views[0]->visible_=true;
- g_views[1]->visible_=true;
- g_views[2]->visible_= true;
+ g_views[1]->maximize_ = false;
+ g_views[2]->maximize_ = false;
+ g_views[0]->visible_ = true;
+ g_views[1]->visible_ = true;
+ g_views[2]->visible_ = true;
}
void InitColorPairs()
@@ -89,7 +89,8 @@
// Returns number of lines drawn
int DrawTextWithWidthLimit(WINDOW* win, std::string txt, int y, int x,
- int width, const std::string& delimiters)
+ int width,
+ [[maybe_unused]] const std::string& delimiters)
{
int ret = 0;
std::string curr_word, curr_line;
@@ -128,8 +129,9 @@
for (DBusTopWindow* v : g_views)
{
v->OnResize(maxx, maxy);
- if(v->maximize_){
- v->rect={0,0,maxx,maxy-MARGIN_BOTTOM};
+ if (v->maximize_)
+ {
+ v->rect = {0, 0, maxx, maxy - MARGIN_BOTTOM};
v->UpdateWindowSizeAndPosition();
}
}
@@ -224,7 +226,7 @@
{
switch (c)
{
- case '\e': // 27 in dec, 0x1B in hex, escape key
+ case 0x1B: // 27 in dec, 0x1B in hex, escape key
{
getch();
c = getch();
@@ -242,7 +244,7 @@
case 'D':
curr_view->OnKeyDown("left");
break;
- case '\e':
+ case 0x1B:
curr_view->OnKeyDown("escape");
break;
}
@@ -350,7 +352,7 @@
}
}
-int main(int argc, char** argv)
+int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
{
int r = AcquireBus(&g_bus);
if (r <= 0)