support -Werror=format-security

Fedora now enables this option by default, resulting
in the following build failure:

Logging.h: In instantiation of
'void pzstd::Logger::operator()(int, const char*, Args ...)
Pzstd.cpp:413:48:   required from here
Logging.h:46:17: error: format not a string literal and no format arguments
[-Werror=format-security]
     std::fprintf(out_, fmt, args...);
     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Pádraig Brady 2017-03-05 19:36:56 -08:00
parent 5d801278dc
commit 38a3428b37
3 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@
cppflags = -DXXH_NAMESPACE=ZSTD_ -DZSTD_LEGACY_SUPPORT=1 cppflags = -DXXH_NAMESPACE=ZSTD_ -DZSTD_LEGACY_SUPPORT=1
cflags = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wpointer-arith cflags = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wpointer-arith
cxxppflags = -DXXH_NAMESPACE=ZSTD_ -DZSTD_LEGACY_SUPPORT=1 cxxppflags = -DXXH_NAMESPACE=ZSTD_ -DZSTD_LEGACY_SUPPORT=1
cxxflags = -std=c++11 -Wno-format-security -Wno-deprecated-declarations cxxflags = -std=c++11 -Wno-deprecated-declarations
gtest_dep = //contrib/pzstd:gtest gtest_dep = //contrib/pzstd:gtest
[httpserver] [httpserver]

View File

@ -410,7 +410,7 @@ std::uint64_t asyncCompressChunks(
}); });
// Pass the output queue to the writer thread. // Pass the output queue to the writer thread.
chunks.push(std::move(out)); chunks.push(std::move(out));
state.log(VERBOSE, "Starting a new frame\n"); state.log(VERBOSE, "%s\n", "Starting a new frame");
// Fill the input queue for the compression job we just started // Fill the input queue for the compression job we just started
status = readData(*in, ZSTD_CStreamInSize(), step, fd, &bytesRead); status = readData(*in, ZSTD_CStreamInSize(), step, fd, &bytesRead);
} }
@ -547,8 +547,8 @@ std::uint64_t asyncDecompressFrames(
if (frameSize == 0) { if (frameSize == 0) {
// We hit a non SkippableFrame ==> not compressed by pzstd or corrupted // We hit a non SkippableFrame ==> not compressed by pzstd or corrupted
// Pass the rest of the source to this decompression task // Pass the rest of the source to this decompression task
state.log(VERBOSE, state.log(VERBOSE, "%s\n",
"Input not in pzstd format, falling back to serial decompression\n"); "Input not in pzstd format, falling back to serial decompression");
while (status == FileStatus::Continue && !state.errorHolder.hasError()) { while (status == FileStatus::Continue && !state.errorHolder.hasError()) {
status = readData(*in, chunkSize, chunkSize, fd, &totalBytesRead); status = readData(*in, chunkSize, chunkSize, fd, &totalBytesRead);
} }

View File

@ -41,7 +41,7 @@ class SharedState {
auto parameters = options.determineParameters(); auto parameters = options.determineParameters();
cStreamPool.reset(new ResourcePool<ZSTD_CStream>{ cStreamPool.reset(new ResourcePool<ZSTD_CStream>{
[this, parameters]() -> ZSTD_CStream* { [this, parameters]() -> ZSTD_CStream* {
this->log(VERBOSE, "Creating new ZSTD_CStream\n"); this->log(VERBOSE, "%s\n", "Creating new ZSTD_CStream");
auto zcs = ZSTD_createCStream(); auto zcs = ZSTD_createCStream();
if (zcs) { if (zcs) {
auto err = ZSTD_initCStream_advanced( auto err = ZSTD_initCStream_advanced(
@ -59,7 +59,7 @@ class SharedState {
} else { } else {
dStreamPool.reset(new ResourcePool<ZSTD_DStream>{ dStreamPool.reset(new ResourcePool<ZSTD_DStream>{
[this]() -> ZSTD_DStream* { [this]() -> ZSTD_DStream* {
this->log(VERBOSE, "Creating new ZSTD_DStream\n"); this->log(VERBOSE, "%s\n", "Creating new ZSTD_DStream");
auto zds = ZSTD_createDStream(); auto zds = ZSTD_createDStream();
if (zds) { if (zds) {
auto err = ZSTD_initDStream(zds); auto err = ZSTD_initDStream(zds);