clean up warnings in peglib.h sprintf on Visual Studio (#243)

This commit is contained in:
Bob Tolbert 2022-08-20 11:17:31 -06:00 committed by GitHub
parent 978a8dc274
commit b64b53aeef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /utf-8")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /utf-8 /D_CRT_SECURE_NO_DEPRECATE")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()

View File

@ -4738,7 +4738,7 @@ inline void enable_profiling(parser &parser, std::ostream &os) {
<< std::endl;
auto grand_total = total_success + total_fail;
sprintf(buff, "%4s %10lu %5s %10lu %10lu %s", "", grand_total,
sprintf(buff, "%4s %10zu %5s %10zu %10zu %s", "", grand_total,
"", total_success, total_fail, "Total counters");
os << buff << std::endl;
@ -4752,7 +4752,7 @@ inline void enable_profiling(parser &parser, std::ostream &os) {
for (auto &[name, success, fail] : stats.items) {
auto total = success + fail;
auto ratio = total * 100.0 / stats.total;
sprintf(buff, "%4zu %10lu %5.2f %10lu %10lu %s", id, total,
sprintf(buff, "%4zu %10zu %5.2f %10zu %10zu %s", id, total,
ratio, success, fail, name.c_str());
os << buff << std::endl;
id++;