Skip to content

Commit 262a4e1

Browse files
authored
Merge branch 'main' into bump-macos-12-14
2 parents fbf4c6a + 962db1a commit 262a4e1

File tree

8 files changed

+34
-10
lines changed

8 files changed

+34
-10
lines changed

lib/jni/LogManager_jni.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
892892
ManagerAndConfig const* mc;
893893
{
894894
std::lock_guard<std::mutex> lock(jniManagersMutex);
895-
if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= jniManagers.size())
895+
if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= static_cast<jlong>(jniManagers.size()))
896896
{
897897
return nullptr;
898898
}
@@ -914,7 +914,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
914914
{
915915
{
916916
std::lock_guard<std::mutex> lock(jniManagersMutex);
917-
if (nativeLogManager < 0 || nativeLogManager >= jniManagers.size())
917+
if (nativeLogManager < 0 || nativeLogManager >= static_cast<jlong>(jniManagers.size()))
918918
{
919919
return;
920920
}
@@ -971,7 +971,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
971971
ManagerAndConfig* mc;
972972
{
973973
std::lock_guard<std::mutex> lock(jniManagersMutex);
974-
if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= jniManagers.size())
974+
if (nativeLogManagerIndex < 0 || nativeLogManagerIndex >= static_cast<jlong>(jniManagers.size()))
975975
{
976976
return 0;
977977
}
@@ -997,7 +997,7 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
997997
static ILogManager* getLogManager(jlong nativeLogManager)
998998
{
999999
std::lock_guard<std::mutex> lock(jniManagersMutex);
1000-
if (nativeLogManager < 0 || nativeLogManager >= jniManagers.size())
1000+
if (nativeLogManager < 0 || nativeLogManager >= static_cast<jlong>(jniManagers.size()))
10011001
{
10021002
return nullptr;
10031003
}
@@ -1587,7 +1587,8 @@ Java_com_microsoft_applications_events_LogManagerProvider_00024LogManagerImpl_na
15871587
jlong eventType,
15881588
jlong identity) {
15891589
std::lock_guard<std::mutex> l(listeners_mutex);
1590-
if (identity < 0 || identity >= listeners.size() || !listeners[identity]) {
1590+
if (identity < 0 || identity >= static_cast<jlong>(jniManagers.size()) || !listeners[identity])
1591+
{
15911592
return;
15921593
}
15931594
auto logManager = getLogManager(native_log_manager);

lib/modules

lib/utils/Utils.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,15 @@ namespace MAT_NS_BEGIN {
125125
std::string GetTempDirectory()
126126
{
127127
#ifdef _WIN32
128+
auto lpGetTempPathW = reinterpret_cast<decltype(&::GetTempPathW)>(GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetTempPath2W"));
129+
if (lpGetTempPathW == NULL)
130+
{
131+
lpGetTempPathW = ::GetTempPathW;
132+
}
128133
/* UTF-8 temp directory for Win32 Desktop apps */
129134
std::string path = "";
130135
wchar_t lpTempPathBuffer[MAX_PATH + 1] = { 0 };
131-
if (::GetTempPathW(MAX_PATH, lpTempPathBuffer))
136+
if (lpGetTempPathW(MAX_PATH, lpTempPathBuffer))
132137
{
133138
path = to_utf8_string(lpTempPathBuffer);
134139
}

tests/common/SocketTools.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class SocketAddr
128128
#ifdef _WIN32
129129
INT addrlen = sizeof(m_data);
130130
WCHAR buf[200];
131-
for(int i = 0; i < sizeof(buf) && addr[i]; i++)
131+
for(size_t i = 0; i < sizeof(buf) && addr[i]; i++)
132132
{
133133
buf[i] = addr[i];
134134
}

tests/functests/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests)
3535
${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp
3636
)
3737
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json)
38-
file(COPY_FILE ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json)
38+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21")
39+
# Use file(COPY_FILE ...) for CMake 3.21 and later
40+
file(COPY_FILE ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json)
41+
else()
42+
# Use file(COPY ...) as an alternative for older versions
43+
file(COPY ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json
44+
DESTINATION ${CMAKE_BINARY_DIR})
45+
endif()
3946
endif()
4047
endif()
4148

tests/unittests/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ endif()
7070
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUARD)
7171
add_definitions(-DHAVE_MAT_PRIVACYGUARD)
7272
list(APPEND SRCS
73-
${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyGuardTests.cpp
73+
${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/InitializationConfigurationTests.cpp
74+
${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernEventTests.cpp
75+
${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernMetadataProviderTests.cpp
76+
${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyGuardTests.cpp
77+
${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/SystematicSamplerTests.cpp
7478
)
7579
endif()
7680

tests/unittests/UnitTests.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@
481481
<ClCompile Include="$(ProjectDir)..\..\lib\modules\exp\tests\unittests\ECSClientUtilsTests.cpp" />
482482
</ItemGroup>
483483
<ItemGroup Condition="exists('$(ProjectDir)..\..\lib\modules\privacyguard')">
484+
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\InitializationConfigurationTests.cpp" />
485+
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\PrivacyConcernEventTests.cpp" />
486+
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\PrivacyConcernMetadataProviderTests.cpp" />
484487
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\PrivacyGuardTests.cpp" />
485488
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\SystematicSamplerTests.cpp" />
486489
</ItemGroup>

tests/unittests/UnitTests.vcxproj.filters

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@
5656
<ClCompile Include="$(ProjectDir)..\..\lib\modules\exp\tests\unittests\ECSConfigCacheTests.cpp" />
5757
<ClCompile Include="$(ProjectDir)..\..\lib\modules\exp\tests\unittests\ECSClientTests.cpp" />
5858
<ClCompile Include="$(ProjectDir)..\..\lib\modules\exp\tests\unittests\ECSClientUtilsTests.cpp" />
59+
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\InitializationConfigurationTests.cpp" />
60+
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\PrivacyConcernEventTests.cpp" />
61+
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\PrivacyConcernMetadataProviderTests.cpp" />
5962
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\PrivacyGuardTests.cpp" />
63+
<ClCompile Include="$(ProjectDir)..\..\lib\modules\privacyguard\tests\unittests\SystematicSamplerTests.cpp" />
6064
<ClCompile Include="$(ProjectDir)..\..\lib\modules\dataviewer\tests\unittests\DefaultDataViewerTests.cpp" />
6165
<ClCompile Include="$(ProjectDir)..\..\lib\modules\signals\tests\unittests\SignalsTests.cpp" />
6266
<ClCompile Include="$(ProjectDir)\InformationProviderImplTests.cpp" />

0 commit comments

Comments
 (0)