ccmake: Pass format string to 'printw' (#15738)
printw takes a format string as first argument, so don't pass variable strings to it directly.
This commit is contained in:
parent
6dad4c25b0
commit
6c442e5a89
@ -80,12 +80,13 @@ void cmCursesLongMessageForm::UpdateStatusBar()
|
|||||||
sprintf(version+sideSpace, "%s", vertmp);
|
sprintf(version+sideSpace, "%s", vertmp);
|
||||||
version[width] = '\0';
|
version[width] = '\0';
|
||||||
|
|
||||||
|
char fmt_s[] = "%s";
|
||||||
curses_move(y-4,0);
|
curses_move(y-4,0);
|
||||||
attron(A_STANDOUT);
|
attron(A_STANDOUT);
|
||||||
printw(bar);
|
printw(fmt_s, bar);
|
||||||
attroff(A_STANDOUT);
|
attroff(A_STANDOUT);
|
||||||
curses_move(y-3,0);
|
curses_move(y-3,0);
|
||||||
printw(version);
|
printw(fmt_s, version);
|
||||||
pos_form_cursor(this->Form);
|
pos_form_cursor(this->Form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,8 +102,9 @@ void cmCursesLongMessageForm::PrintKeys()
|
|||||||
char firstLine[512];
|
char firstLine[512];
|
||||||
sprintf(firstLine, "Press [e] to exit help");
|
sprintf(firstLine, "Press [e] to exit help");
|
||||||
|
|
||||||
|
char fmt_s[] = "%s";
|
||||||
curses_move(y-2,0);
|
curses_move(y-2,0);
|
||||||
printw(firstLine);
|
printw(fmt_s, firstLine);
|
||||||
pos_form_cursor(this->Form);
|
pos_form_cursor(this->Form);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -451,24 +451,25 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
|
|||||||
}
|
}
|
||||||
|
|
||||||
curses_move(y-4,0);
|
curses_move(y-4,0);
|
||||||
|
char fmt_s[] = "%s";
|
||||||
char fmt[512] = "Press [enter] to edit option";
|
char fmt[512] = "Press [enter] to edit option";
|
||||||
if ( process )
|
if ( process )
|
||||||
{
|
{
|
||||||
strcpy(fmt, " ");
|
strcpy(fmt, " ");
|
||||||
}
|
}
|
||||||
printw(fmt);
|
printw(fmt_s, fmt);
|
||||||
curses_move(y-3,0);
|
curses_move(y-3,0);
|
||||||
printw(firstLine);
|
printw(fmt_s, firstLine);
|
||||||
curses_move(y-2,0);
|
curses_move(y-2,0);
|
||||||
printw(secondLine);
|
printw(fmt_s, secondLine);
|
||||||
curses_move(y-1,0);
|
curses_move(y-1,0);
|
||||||
printw(thirdLine);
|
printw(fmt_s, thirdLine);
|
||||||
|
|
||||||
if (cw)
|
if (cw)
|
||||||
{
|
{
|
||||||
sprintf(firstLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages);
|
sprintf(firstLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages);
|
||||||
curses_move(0,65-static_cast<unsigned int>(strlen(firstLine))-1);
|
curses_move(0,65-static_cast<unsigned int>(strlen(firstLine))-1);
|
||||||
printw(firstLine);
|
printw(fmt_s, firstLine);
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -612,13 +613,13 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
|
|||||||
version[width] = '\0';
|
version[width] = '\0';
|
||||||
|
|
||||||
// Now print both lines
|
// Now print both lines
|
||||||
|
char fmt_s[] = "%s";
|
||||||
curses_move(y-5,0);
|
curses_move(y-5,0);
|
||||||
attron(A_STANDOUT);
|
attron(A_STANDOUT);
|
||||||
char format[] = "%s";
|
printw(fmt_s, bar);
|
||||||
printw(format, bar);
|
|
||||||
attroff(A_STANDOUT);
|
attroff(A_STANDOUT);
|
||||||
curses_move(y-4,0);
|
curses_move(y-4,0);
|
||||||
printw(version);
|
printw(fmt_s, version);
|
||||||
pos_form_cursor(this->Form);
|
pos_form_cursor(this->Form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,6 +221,7 @@ bool cmCursesStringWidget::PrintKeys()
|
|||||||
}
|
}
|
||||||
if (this->InEdit)
|
if (this->InEdit)
|
||||||
{
|
{
|
||||||
|
char fmt_s[] = "%s";
|
||||||
char firstLine[512];
|
char firstLine[512];
|
||||||
// Clean the toolbar
|
// Clean the toolbar
|
||||||
for(int i=0; i<512; i++)
|
for(int i=0; i<512; i++)
|
||||||
@ -229,17 +230,16 @@ bool cmCursesStringWidget::PrintKeys()
|
|||||||
}
|
}
|
||||||
firstLine[511] = '\0';
|
firstLine[511] = '\0';
|
||||||
curses_move(y-4,0);
|
curses_move(y-4,0);
|
||||||
printw(firstLine);
|
printw(fmt_s, firstLine);
|
||||||
curses_move(y-3,0);
|
curses_move(y-3,0);
|
||||||
printw(firstLine);
|
printw(fmt_s, firstLine);
|
||||||
curses_move(y-2,0);
|
curses_move(y-2,0);
|
||||||
printw(firstLine);
|
printw(fmt_s, firstLine);
|
||||||
curses_move(y-1,0);
|
curses_move(y-1,0);
|
||||||
printw(firstLine);
|
printw(fmt_s, firstLine);
|
||||||
|
|
||||||
sprintf(firstLine, "Editing option, press [enter] to leave edit.");
|
|
||||||
curses_move(y-3,0);
|
curses_move(y-3,0);
|
||||||
printw(firstLine);
|
printw(fmt_s, "Editing option, press [enter] to leave edit.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user