mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 03:55:29 +00:00
clean up warnings in peglib.h sprintf on Visual Studio (#243)
This commit is contained in:
parent
978a8dc274
commit
b64b53aeef
@ -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()
|
||||
|
4
peglib.h
4
peglib.h
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user