Fix Warnings

This commit is contained in:
Gustavo Varo 2025-04-01 08:41:05 -04:00
parent c2caa84f24
commit 375fd44ab0
3 changed files with 7 additions and 6 deletions

View file

@ -83,7 +83,7 @@ extern "C" __declspec(dllexport) HRESULT CALLBACK mi_dump_process_info(PDEBUG_CL
// 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;

View file

@ -187,12 +187,12 @@ size_t mi_bitmap_count(mi_bitmap_t* bmp) {
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 @@ std::string FormatSize(std::size_t bytes) {
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;

View file

@ -37,8 +37,8 @@ HRESULT ReadMemory(ULONG64 address, void* outBuffer, ULONG bufferSize);
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,