diff options
author | Sean McBride <sean@rogue-research.com> | 2021-10-21 16:35:57 (GMT) |
---|---|---|
committer | Sean McBride <sean@rogue-research.com> | 2021-10-25 22:23:13 (GMT) |
commit | 5ba6e8ac59333aa574d5963332e3ef0f4c4d3514 (patch) | |
tree | d796f695e10d5ec20508cb04f4c8b3c2a6c0d742 /Source/CursesDialog/cmCursesMainForm.cxx | |
parent | 0ce50dd78f68b697e1ab29d52d733b87c5bfb67d (diff) | |
download | CMake-5ba6e8ac59333aa574d5963332e3ef0f4c4d3514.zip CMake-5ba6e8ac59333aa574d5963332e3ef0f4c4d3514.tar.gz CMake-5ba6e8ac59333aa574d5963332e3ef0f4c4d3514.tar.bz2 |
Source: Replace most calls to sprintf with snprintf
Diffstat (limited to 'Source/CursesDialog/cmCursesMainForm.cxx')
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index b28c5b7..0012a25 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -322,22 +322,22 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) memset(thirdLine, ' ', 68); } else { if (this->OkToGenerate) { - sprintf(firstLine, - " [l] Show log output [c] Configure" - " [g] Generate "); + snprintf(firstLine, sizeof(firstLine), + " [l] Show log output [c] Configure" + " [g] Generate "); } else { - sprintf(firstLine, - " [l] Show log output [c] Configure" - " "); + snprintf(firstLine, sizeof(firstLine), + " [l] Show log output [c] Configure" + " "); } { const char* toggleKeyInstruction = " [t] Toggle advanced mode (currently %s)"; - sprintf(thirdLine, toggleKeyInstruction, - this->AdvancedMode ? "on" : "off"); + snprintf(thirdLine, sizeof(thirdLine), toggleKeyInstruction, + this->AdvancedMode ? "on" : "off"); } - sprintf(secondLine, - " [h] Help [q] Quit without generating"); + snprintf(secondLine, sizeof(secondLine), + " [h] Help [q] Quit without generating"); } curses_move(y - 4, 0); @@ -356,7 +356,8 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) if (cw) { char pageLine[512] = ""; - sprintf(pageLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages); + snprintf(pageLine, sizeof(pageLine), "Page %d of %d", cw->GetPage(), + this->NumberOfPages); curses_move(0, 65 - static_cast<unsigned int>(strlen(pageLine)) - 1); printw(fmt_s, pageLine); } @@ -739,7 +740,8 @@ void cmCursesMainForm::HandleInput() if ((!currentWidget || !widgetHandled) && !this->SearchMode) { // If the current widget does not want to handle input, // we handle it. - sprintf(debugMessage, "Main form handling input, key: %d", key); + snprintf(debugMessage, sizeof(debugMessage), + "Main form handling input, key: %d", key); cmCursesForm::LogMessage(debugMessage); // quit if (key == 'q') { |