Skip to content

Commit

Permalink
Fix -Wsign-compare warnings in 1DS C++ SDK.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoscumb committed Jan 14, 2025
1 parent 0a4edad commit 54130aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lib/jni/LogManager_jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
ManagerAndConfig const* mc;
{
std::lock_guard<std::mutex> lock(jniManagersMutex);
if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= jniManagers.size())
if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= static_cast<jlong>(jniManagers.size()))
{
return nullptr;
}
Expand All @@ -914,7 +914,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
{
{
std::lock_guard<std::mutex> lock(jniManagersMutex);
if (nativeLogManager < 0 || nativeLogManager >= jniManagers.size())
if (nativeLogManager < 0 || nativeLogManager >= static_cast<jlong>(jniManagers.size()))
{
return;
}
Expand Down Expand Up @@ -971,7 +971,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
ManagerAndConfig* mc;
{
std::lock_guard<std::mutex> lock(jniManagersMutex);
if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= jniManagers.size())
if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= static_cast<jlong>(jniManagers.size()))
{
return 0;
}
Expand All @@ -997,7 +997,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
static ILogManager* getLogManager(jlong nativeLogManager)
{
std::lock_guard<std::mutex> lock(jniManagersMutex);
if (nativeLogManager < 0 || nativeLogManager >= jniManagers.size())
if (nativeLogManager < 0 || nativeLogManager >= static_cast<jlong>(jniManagers.size()))
{
return nullptr;
}
Expand Down Expand Up @@ -1587,7 +1587,8 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
jlong eventType,
jlong identity) {
std::lock_guard<std::mutex> l(listeners_mutex);
if (identity < 0 || identity >= listeners.size() || !listeners[identity]) {
if (identity < 0 || identity >= static_cast<jlong>(jniManagers.size()) || !listeners[identity])
{
return;
}
auto logManager = getLogManager(native_log_manager);
Expand Down
2 changes: 1 addition & 1 deletion tests/common/SocketTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit 54130aa

Please sign in to comment.