dbus-top: use mvwaddstr when no arguments are needed
Currently, some of the code uses mvwprintw to print a string without
using a format string, this causes the following errors:
error: format not a string literal and no format arguments
[-Werror=format-security]
The fix is to use mvwaddstr when no arguments are needed.
Signed-off-by: Sui Chen <suichen@google.com>
Change-Id: Ib17ad7a7795cb7bf77161f8730139f38216b7aba
diff --git a/dbus-top/views.cpp b/dbus-top/views.cpp
index 0e6f8b0..fdbf85d 100644
--- a/dbus-top/views.cpp
+++ b/dbus-top/views.cpp
@@ -420,7 +420,7 @@
s.push_back(' ');
}
}
- mvwprintw(win, y, x, s.c_str());
+ mvwaddstr(win, y, x, s.c_str());
wattrset(win, 0);
}
else
@@ -492,7 +492,7 @@
}
else
{
- mvwprintw(win, y, x, "Sensor details not found");
+ mvwaddstr(win, y, x, "Sensor details not found");
}
}
DrawBorderIfNeeded();
@@ -853,29 +853,29 @@
{
mvwaddch(win, y1 - 3, x, '-');
}
- mvwprintw(win, y1 - 3, arrow_x - 8, "Press [Enter] to show/hide");
- mvwprintw(win, y1 - 2, caption_x - 5,
+ mvwaddstr(win, y1 - 3, arrow_x - 8, "Press [Enter] to show/hide");
+ mvwaddstr(win, y1 - 2, caption_x - 5,
"DBus fields for aggregating and sorting results:");
if (curr_menu_state_ == LeftSide)
{
- mvwprintw(win, y1 - 1, x1 - 4, "--[ Available Fields ]--");
- mvwprintw(win, y1 - 1, x2 - 4, "--- Active Fields ---");
+ mvwaddstr(win, y1 - 1, x1 - 4, "--[ Available Fields ]--");
+ mvwaddstr(win, y1 - 1, x2 - 4, "--- Active Fields ---");
}
else
{
- mvwprintw(win, y1 - 1, x1 - 4, "--- Available Fields ---");
- mvwprintw(win, y1 - 1, x2 - 4, "--[ Active Fields ]--");
+ mvwaddstr(win, y1 - 1, x1 - 4, "--- Available Fields ---");
+ mvwaddstr(win, y1 - 1, x2 - 4, "--[ Active Fields ]--");
}
if (curr_menu_state_ == LeftSide)
{
- mvwprintw(win, arrow_y, arrow_x, "-->");
- mvwprintw(win, caption_y, caption_x,
+ mvwaddstr(win, arrow_y, arrow_x, "-->");
+ mvwaddstr(win, caption_y, caption_x,
"Press [Space] to move to the right");
}
else
{
- mvwprintw(win, arrow_y, arrow_x, "<--");
- mvwprintw(win, caption_y, caption_x,
+ mvwaddstr(win, arrow_y, arrow_x, "<--");
+ mvwaddstr(win, caption_y, caption_x,
"Press [Space] to move to the left");
}
}