From b318d7db7b2e3155c180cf2a43f990f9a523a574 Mon Sep 17 00:00:00 2001 From: Leonardo Di Giovanna Date: Tue, 16 Sep 2025 14:08:50 +0200 Subject: [PATCH] refactor: fix some compiler warnings Signed-off-by: Leonardo Di Giovanna --- driver/bpf/fillers.h | 2 +- test/libsinsp_e2e/subprocess.cpp | 14 +++++++------- test/libsinsp_e2e/subprocess.h | 4 ++-- userspace/libsinsp/test/plugins.ut.cpp | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/driver/bpf/fillers.h b/driver/bpf/fillers.h index 781810e2a4..6229df4c02 100644 --- a/driver/bpf/fillers.h +++ b/driver/bpf/fillers.h @@ -2338,7 +2338,7 @@ FILLER(proc_startupdate, true) { } argv = (char **)val; - res = bpf_accumulate_argv_or_env(data, argv, &args_len); + res = bpf_accumulate_argv_or_env(data, argv, (long *)&args_len); if(res != PPM_SUCCESS) args_len = 0; } else { diff --git a/test/libsinsp_e2e/subprocess.cpp b/test/libsinsp_e2e/subprocess.cpp index 73dda94848..51072af1e1 100644 --- a/test/libsinsp_e2e/subprocess.cpp +++ b/test/libsinsp_e2e/subprocess.cpp @@ -30,14 +30,14 @@ limitations under the License. #include #include -subprocess::subprocess(std::string command, - std::vector arguments, - bool start_now, - int retry_attempts): - m_pid(-1), - m_retry_attemps(retry_attempts), +subprocess::subprocess(const std::string& command, + const std::vector& arguments, + const bool start_now, + const int retry_attempts): m_command(command), - m_args(arguments) { + m_args(arguments), + m_pid(-1), + m_retry_attemps(retry_attempts) { if(start_now) { start(); } diff --git a/test/libsinsp_e2e/subprocess.h b/test/libsinsp_e2e/subprocess.h index 1bb845fd26..ca74f0df93 100644 --- a/test/libsinsp_e2e/subprocess.h +++ b/test/libsinsp_e2e/subprocess.h @@ -31,8 +31,8 @@ limitations under the License. class subprocess { public: - subprocess(std::string command, - std::vector arguments, + subprocess(const std::string& command, + const std::vector& arguments, bool start_now = true, int retry_attempts = 3); ~subprocess(); diff --git a/userspace/libsinsp/test/plugins.ut.cpp b/userspace/libsinsp/test/plugins.ut.cpp index 78d46a556e..a0dfc30e62 100644 --- a/userspace/libsinsp/test/plugins.ut.cpp +++ b/userspace/libsinsp/test/plugins.ut.cpp @@ -383,11 +383,11 @@ TEST_F(sinsp_with_test_input, plugin_custom_source) { ASSERT_EQ(length, 11); const auto raw_evt = reinterpret_cast(evt->get_scap_evt()); - for(int i = 0; i < evt->get_scap_evt()->len; i++) { - printf("%02x ", (unsigned char)raw_evt[i]); + for(uint32_t i = 0; i < evt->get_scap_evt()->len; i++) { + printf("%02x ", static_cast(raw_evt[i])); } printf("\n"); - for(int i = 0; i < evt->get_scap_evt()->len; i++) { + for(uint32_t i = 0; i < evt->get_scap_evt()->len; i++) { char c = ' '; if(i >= offset && i < offset + length) { c = '^';