From 662c86234fbdc3990ea37b83e2a0e30b895c8e65 Mon Sep 17 00:00:00 2001 From: falsycat Date: Fri, 9 Sep 2022 11:59:30 +0900 Subject: [PATCH] enable compiler warnings --- CMakeLists.txt | 20 ++------------------ conv/bidx_stego.cc | 4 ++-- conv/common.hh | 1 - conv/dcode_fcode.cc | 8 ++++---- conv/fcode_dcode.cc | 6 +++--- conv/fcprob_fcode.cc | 2 +- conv/stego_fprob.cc | 4 ++-- 7 files changed, 14 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94106c7..734d8e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,25 +7,9 @@ option(BLOCKY_STATIC OFF) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(BLOCKY_C_FLAGS - $<$,$,$>: - -Wall -Werror -pedantic-errors -Wextra -Wconversion -Wsign-conversion> - $<$,$>: - -Wno-overloaded-virtual> - $<$: - /W4 /WX> -) -set(BLOCKY_CXX_FLAGS - $<$,$,$>: - -Wall -Werror -pedantic-errors -Wextra -Wconversion -Wsign-conversion> - $<$,$>: - -Wno-overloaded-virtual> - $<$: - /W4 /WX> -) - add_subdirectory(thirdparty) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${BLKY_CXX_FLAGS} -I ${PROJECT_SOURCE_DIR}") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -pedantic-errors -Wextra") add_subdirectory(conv) add_subdirectory(gen) diff --git a/conv/bidx_stego.cc b/conv/bidx_stego.cc index 6bef6c3..b434186 100644 --- a/conv/bidx_stego.cc +++ b/conv/bidx_stego.cc @@ -14,7 +14,7 @@ #include -#include "conv/common.hh" +#include "common.hh" namespace param { @@ -139,7 +139,7 @@ static void Exec() { }, &srcst, srcsz); // find video track - int ti; + size_t ti; for (ti = 0; ti < dem.track_count; ++ti) { const auto& t = dem.track[ti]; if (t.handler_type == MP4D_HANDLER_TYPE_VIDE) { diff --git a/conv/common.hh b/conv/common.hh index cce68bf..40a28d4 100644 --- a/conv/common.hh +++ b/conv/common.hh @@ -67,7 +67,6 @@ struct Frame { U.resize(hw*hh); V.resize(hw*hh); for (int32_t y = 0; y < hh; ++y) { - const auto offset = y*uvstride; const auto srcu = yuv[1] + y*uvstride; const auto srcv = yuv[2] + y*uvstride; const auto dstu = U.data() + y*hw; diff --git a/conv/dcode_fcode.cc b/conv/dcode_fcode.cc index a522382..35eff0a 100644 --- a/conv/dcode_fcode.cc +++ b/conv/dcode_fcode.cc @@ -21,10 +21,10 @@ ValueFlag smap { parser, "path", "step map file path", {"smap"}, }; -ValueFlag first { +ValueFlag first { parser, "0", "first fcode", {"first"}, 0 }; -ValueFlag fcnum { +ValueFlag fcnum { parser, "50", "number of fcode alphabet", {"fc-num"}, 50 }; @@ -45,10 +45,10 @@ static void Exec() { Enforce(br.size() == bn, "all node should have the same number of branch"); } - size_t fcode = args::get(param::first); + uint32_t fcode = args::get(param::first); std::cout << fcode << '\n'; - for (size_t dcode, t = 0; std::cin >> dcode; ++t) { + for (uint32_t dcode, t = 0; std::cin >> dcode; ++t) { Enforce(dcode < bn, "dcode must be lower than number of branch"); Enforce(fcnum*(t+1) <= smap.size(), "smap row shortage"); fcode = smap[t*fcnum + fcode][dcode]; diff --git a/conv/fcode_dcode.cc b/conv/fcode_dcode.cc index fb25bb2..86aa3cd 100644 --- a/conv/fcode_dcode.cc +++ b/conv/fcode_dcode.cc @@ -21,7 +21,7 @@ ValueFlag smap { parser, "path", "step map file path", {"smap"}, }; -ValueFlag fcnum { +ValueFlag fcnum { parser, "50", "number of fcode alphabet", {"fc-num"}, 50 }; @@ -42,9 +42,9 @@ static void Exec() { Enforce(br.size() == bn, "all node should have the same number of branch"); } - size_t fcode_p, dcode; + size_t fcode_p; std::cin >> fcode_p; - for (size_t fcode, t = 0; std::cin >> fcode; ++t) { + for (uint32_t fcode, t = 0; std::cin >> fcode; ++t) { Enforce(fcode < fcnum, "fcode overflow"); Enforce(fcnum*(t+1) <= smap.size(), "smap row shortage"); diff --git a/conv/fcprob_fcode.cc b/conv/fcprob_fcode.cc index 924b59b..49c839a 100644 --- a/conv/fcprob_fcode.cc +++ b/conv/fcprob_fcode.cc @@ -11,7 +11,7 @@ #include -#include "conv/common.hh" +#include "common.hh" namespace param { diff --git a/conv/stego_fprob.cc b/conv/stego_fprob.cc index 6cff87a..413e736 100644 --- a/conv/stego_fprob.cc +++ b/conv/stego_fprob.cc @@ -13,7 +13,7 @@ #include -#include "conv/common.hh" +#include "common.hh" namespace param { @@ -230,7 +230,7 @@ static void Exec() { }, &vst, vsz); // find video track - int ti; + size_t ti; for (ti = 0; ti < dem.track_count; ++ti) { const auto& tra = dem.track[ti]; if (tra.handler_type == MP4D_HANDLER_TYPE_VIDE) {