From 5458ce50e54f9ad8ea5323a3b5f9cad67c47cef7 Mon Sep 17 00:00:00 2001 From: mdh1418 Date: Mon, 8 Jul 2024 13:51:33 -0400 Subject: [PATCH] Fix compilation errors on non-windows platforms --- .../gcheapenumerationprofiler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tests/profiler/native/gcheapenumerationprofiler/gcheapenumerationprofiler.cpp b/src/tests/profiler/native/gcheapenumerationprofiler/gcheapenumerationprofiler.cpp index 1e4cd2ea186d56..6f7a19ad315db6 100644 --- a/src/tests/profiler/native/gcheapenumerationprofiler/gcheapenumerationprofiler.cpp +++ b/src/tests/profiler/native/gcheapenumerationprofiler/gcheapenumerationprofiler.cpp @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. #include "gcheapenumerationprofiler.h" -#include +#include "../profilerstring.h" #if WIN32 #define EXPORT @@ -34,7 +34,9 @@ HRESULT GCHeapEnumerationProfiler::Initialize(IUnknown* pICorProfilerInfoUnk) printf("FAIL: ICorProfilerInfo::GetEnvironmentVariable() failed hr=0x%x", hr); return hr; } - if (wcscmp(envVar, L"TRUE") == 0) + String envVarStr = envVar; + String expectedEnvVarStr = reinterpret_cast(u"TRUE"); + if (envVarStr == expectedEnvVarStr) { printf("Setting GarbageCollectionStarted event masks\n"); eventMask |= COR_PRF_MONITOR_GC; @@ -128,7 +130,8 @@ static BOOL STDMETHODCALLTYPE heap_walk_fn(ObjectID object, void* callbackState) } String classIdName = state->instance->GetClassIDNameHelper(classId); - if (classIdName.ToWString() == L"CustomGCHeapObject") + String expectedCustomObjectClass = reinterpret_cast(u"CustomGCHeapObject"); + if (classIdName == expectedCustomObjectClass) { state->customGcHeapObjectTypeCount->fetch_add(1, std::memory_order_relaxed); }