From 962db1ad555a0af634469f6ad7bb55b55c7c08a8 Mon Sep 17 00:00:00 2001 From: Matthew Koscumb <49213788+mkoscumb@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:46:33 -0800 Subject: [PATCH] Fix -Wsign-compare warnings in 1DS C++ SDK. (#1321) --- lib/jni/LogManager_jni.cpp | 11 ++++++----- tests/common/SocketTools.hpp | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/jni/LogManager_jni.cpp b/lib/jni/LogManager_jni.cpp index f832e1421..078973d2a 100644 --- a/lib/jni/LogManager_jni.cpp +++ b/lib/jni/LogManager_jni.cpp @@ -892,7 +892,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na ManagerAndConfig const* mc; { std::lock_guard lock(jniManagersMutex); - if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= jniManagers.size()) + if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= static_cast(jniManagers.size())) { return nullptr; } @@ -914,7 +914,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na { { std::lock_guard lock(jniManagersMutex); - if (nativeLogManager < 0 || nativeLogManager >= jniManagers.size()) + if (nativeLogManager < 0 || nativeLogManager >= static_cast(jniManagers.size())) { return; } @@ -971,7 +971,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na ManagerAndConfig* mc; { std::lock_guard lock(jniManagersMutex); - if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= jniManagers.size()) + if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= static_cast(jniManagers.size())) { return 0; } @@ -997,7 +997,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na static ILogManager* getLogManager(jlong nativeLogManager) { std::lock_guard lock(jniManagersMutex); - if (nativeLogManager < 0 || nativeLogManager >= jniManagers.size()) + if (nativeLogManager < 0 || nativeLogManager >= static_cast(jniManagers.size())) { return nullptr; } @@ -1587,7 +1587,8 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na jlong eventType, jlong identity) { std::lock_guard l(listeners_mutex); - if (identity < 0 || identity >= listeners.size() || !listeners[identity]) { + if (identity < 0 || identity >= static_cast(jniManagers.size()) || !listeners[identity]) + { return; } auto logManager = getLogManager(native_log_manager); diff --git a/tests/common/SocketTools.hpp b/tests/common/SocketTools.hpp index f06075e10..0bfe350d3 100644 --- a/tests/common/SocketTools.hpp +++ b/tests/common/SocketTools.hpp @@ -128,7 +128,7 @@ class SocketAddr #ifdef _WIN32 INT addrlen = sizeof(m_data); WCHAR buf[200]; - for(int i = 0; i < sizeof(buf) && addr[i]; i++) + for(size_t i = 0; i < sizeof(buf) && addr[i]; i++) { buf[i] = addr[i]; }