Fix Warnings
diff --git a/src/prim/windows/windbg/mimalloc_windbg_process_info.cpp b/src/prim/windows/windbg/mimalloc_windbg_process_info.cpp index 5dd7e97..bea8283 100644 --- a/src/prim/windows/windbg/mimalloc_windbg_process_info.cpp +++ b/src/prim/windows/windbg/mimalloc_windbg_process_info.cpp
@@ -83,7 +83,7 @@ // Convert wide string to narrow string std::string commandLine; commandLine.resize(cmdLine.Length / sizeof(WCHAR) + 1); // +1 for null terminator - WideCharToMultiByte(CP_UTF8, 0, commandLineWide.c_str(), -1, commandLine.data(), commandLine.size(), nullptr, nullptr); + WideCharToMultiByte(CP_UTF8, 0, commandLineWide.c_str(), -1, commandLine.data(), static_cast<int>(commandLine.size()), nullptr, nullptr); // Get Processor Type (x86, x64, ARM64, etc.) ULONG processorType = 0;
diff --git a/src/prim/windows/windbg/mimalloc_windbg_utils.cpp b/src/prim/windows/windbg/mimalloc_windbg_utils.cpp index 86c4047..22a894e 100644 --- a/src/prim/windows/windbg/mimalloc_windbg_utils.cpp +++ b/src/prim/windows/windbg/mimalloc_windbg_utils.cpp
@@ -187,12 +187,12 @@ return totalCount; } -std::string FormatSize(std::size_t bytes) { +std::string FormatSize(int64_t value) { const char* suffixes[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB"}; constexpr int maxIndex = static_cast<int>(std::size(suffixes)) - 1; - double size = static_cast<double>(bytes); int index = 0; + double size = static_cast<double>(value); while (size >= 1024.0 && index < maxIndex) { size /= 1024.0; ++index; @@ -201,11 +201,12 @@ return std::format("{:.2f} {}", size, suffixes[index]); } -std::string FormatNumber(double num) { +std::string FormatNumber(int64_t value) { const char* suffixes[] = {"", "K", "M", "B", "T"}; constexpr int maxIndex = static_cast<int>(std::size(suffixes)) - 1; int index = 0; + double num = static_cast<double>(value); while (num >= 1000.0 && index < maxIndex) { num /= 1000.0; ++index;
diff --git a/src/prim/windows/windbg/mimalloc_windbg_utils.h b/src/prim/windows/windbg/mimalloc_windbg_utils.h index e3f74a2..15c5dd3 100644 --- a/src/prim/windows/windbg/mimalloc_windbg_utils.h +++ b/src/prim/windows/windbg/mimalloc_windbg_utils.h
@@ -37,8 +37,8 @@ HRESULT ReadString(const char* symbolName, std::string& outBuffer); HRESULT ReadWideString(ULONG64 address, std::wstring& outString, size_t maxLength = 1024); size_t mi_bitmap_count(mi_bitmap_t* bmp); -std::string FormatSize(std::size_t bytes); -std::string FormatNumber(double num); +std::string FormatSize(int64_t bytes); +std::string FormatNumber(int64_t num); inline void PrintLink(ULONG64 addr, std::string cmd, std::string linkText, std::string extraText = "") { g_DebugControl->ControlledOutput(DEBUG_OUTCTL_AMBIENT_DML, DEBUG_OUTPUT_NORMAL,