1
0
Fork 0
mirror of https://github.com/otakuto/crazydiskinfo.git synced 2025-08-08 15:13:35 +00:00

Format strings: use %s when printing strings

Otherwise the string itself could be interpreted as a format string.

Suggested-by: g++
This commit is contained in:
Paul Wise 2021-11-25 12:46:36 +08:00
parent 320c159409
commit 30ee4cde52
No known key found for this signature in database
GPG key ID: 3116BA5E9FFA69A3

View file

@ -214,7 +214,7 @@ void drawVersion(WINDOW * window)
auto title = " " + TITLE + "-" + VERSION + " ";
wattrset(window, COLOR_PAIR(TITLE_COLOR));
mvwprintw(window, 0, (width - title.length()) / 2, title.c_str());
mvwprintw(window, 0, (width - title.length()) / 2, "%s", title.c_str());
wattroff(window, COLOR_PAIR(TITLE_COLOR));
wnoutrefresh(window);
@ -247,7 +247,7 @@ void drawDeviceBar(WINDOW * window, std::vector<SMART> const & smartList, int se
if (i == select)
{
wattrset(window, COLOR_PAIR(HEALTH_COLOR) | A_BOLD);
mvwprintw(window, 2, x, smartList[i].deviceName.c_str());
mvwprintw(window, 2, x, "%s", smartList[i].deviceName.c_str());
wattroff(window, COLOR_PAIR(HEALTH_COLOR) | A_BOLD);
wattrset(window, COLOR_PAIR(HEALTH_COLOR));
@ -256,7 +256,7 @@ void drawDeviceBar(WINDOW * window, std::vector<SMART> const & smartList, int se
}
else
{
mvwprintw(window, 2, x, smartList[i].deviceName.c_str());
mvwprintw(window, 2, x, "%s", smartList[i].deviceName.c_str());
mvwhline(window, 3, x, ' ', smartList[i].deviceName.length());
}
x += smartList[i].deviceName.length() + 1;