summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestRunTest.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-10-27 13:23:02 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-10-27 13:23:17 (GMT)
commit9bb7982a15e51b0336e58d4cafc20529ec50550d (patch)
tree5cc5b6744ac6f8da254487002a5a9a7cd832ba80 /Source/CTest/cmCTestRunTest.cxx
parentede11598ba16841c7652160ba8dd755c259bc122 (diff)
parentb7e9cd05cd07605d01a50522f65347aa23d2647e (diff)
downloadCMake-9bb7982a15e51b0336e58d4cafc20529ec50550d.zip
CMake-9bb7982a15e51b0336e58d4cafc20529ec50550d.tar.gz
CMake-9bb7982a15e51b0336e58d4cafc20529ec50550d.tar.bz2
Merge topic 'purge-sprintf'
b7e9cd05cd Replace the only non-standard _snprintf with snprintf 5ba6e8ac59 Source: Replace most calls to sprintf with snprintf Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6649
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r--Source/CTest/cmCTestRunTest.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 2d1562a..f76fc3e 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -229,7 +229,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED;
char buf[1024];
- sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime().count());
+ snprintf(buf, sizeof(buf), "%6.2f sec",
+ this->TestProcess->GetTotalTime().count());
outputStream << buf << "\n";
bool passedOrSkipped = passed || skipped;
@@ -294,9 +295,10 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
ttime -= minutes;
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(ttime);
char buffer[100];
- sprintf(buffer, "%02d:%02d:%02d", static_cast<unsigned>(hours.count()),
- static_cast<unsigned>(minutes.count()),
- static_cast<unsigned>(seconds.count()));
+ snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d",
+ static_cast<unsigned>(hours.count()),
+ static_cast<unsigned>(minutes.count()),
+ static_cast<unsigned>(seconds.count()));
*this->TestHandler->LogFile
<< "----------------------------------------------------------"
<< std::endl;