From e3fc6ebe52d6e1a0c031a6593d868d54860e7e45 Mon Sep 17 00:00:00 2001 From: zukrmn Date: Fri, 6 Mar 2026 22:57:02 +0000 Subject: [PATCH] fix: resolve high-severity Linux compiler warnings --- Minecraft.Client/GameState/GameMode.cpp | 1 + Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp | 2 +- Minecraft.World/IO/Files/FileOutputStream.cpp | 4 ++-- .../Level/Storage/ChunkStorageProfileDecorator.cpp | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/GameState/GameMode.cpp b/Minecraft.Client/GameState/GameMode.cpp index 632618570..b8f4bde32 100644 --- a/Minecraft.Client/GameState/GameMode.cpp +++ b/Minecraft.Client/GameState/GameMode.cpp @@ -49,6 +49,7 @@ void GameMode::render(float a) bool GameMode::useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly) { + return false; } void GameMode::initPlayer(shared_ptr player) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp index 955840e6e..7cbebd035 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp @@ -102,7 +102,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleS { FileEntry *sourceFe = sourceSave->createFile( sourcePlayerDatPath ); FileEntry *targetFe = targetSave->createFile( targetPlayerDatPath ); - printf("Processing player dat file %s\n", playerFiles->at(fileIdx)->data.filename); + wprintf(L"Processing player dat file %ls\n", playerFiles->at(fileIdx)->data.filename); ProcessSimpleFile(sourceSave, sourceFe, targetSave, targetFe); targetFe->data.lastModifiedTime = sourceFe->data.lastModifiedTime; diff --git a/Minecraft.World/IO/Files/FileOutputStream.cpp b/Minecraft.World/IO/Files/FileOutputStream.cpp index bea46104c..a2ec8028b 100644 --- a/Minecraft.World/IO/Files/FileOutputStream.cpp +++ b/Minecraft.World/IO/Files/FileOutputStream.cpp @@ -86,7 +86,7 @@ void FileOutputStream::write(unsigned int b) ); #else // LINUX int fileDescriptor = (int)(intptr_t)(m_fileHandle); - ssize_t numberOfBytesWritten = ::write(fileDescriptor, NULL, 1); + ssize_t numberOfBytesWritten = ::write(fileDescriptor, &value, 1); int result = static_cast(numberOfBytesWritten); #endif // _WIN32 @@ -115,7 +115,7 @@ void FileOutputStream::write(byteArray b) ); #else // Linux int fileDescriptor = (int)(intptr_t)(m_fileHandle); - ssize_t numberOfBytesWritten = ::write(fileDescriptor, NULL, 1); + ssize_t numberOfBytesWritten = ::write(fileDescriptor, static_cast(b.data), b.length); int result = static_cast(numberOfBytesWritten); #endif // _WIN32 diff --git a/Minecraft.World/Level/Storage/ChunkStorageProfileDecorator.cpp b/Minecraft.World/Level/Storage/ChunkStorageProfileDecorator.cpp index 34288d534..4d173142e 100644 --- a/Minecraft.World/Level/Storage/ChunkStorageProfileDecorator.cpp +++ b/Minecraft.World/Level/Storage/ChunkStorageProfileDecorator.cpp @@ -44,6 +44,8 @@ void ChunkStorageProfilerDecorator::tick() #ifndef _CONTENT_PACKAGE #ifdef __PSVITA__ sprintf(buf,"Average load time: %f (%lld)",0.000001 * (double) timeSpentLoading / (double) loadCount, loadCount); +#elif defined(__linux__) + sprintf(buf,"Average load time: %f (%lld)",0.000001 * (double) timeSpentLoading / (double) loadCount, (long long)loadCount); #else sprintf(buf,"Average load time: %f (%I64d)",0.000001 * (double) timeSpentLoading / (double) loadCount, loadCount); #endif @@ -55,6 +57,8 @@ void ChunkStorageProfilerDecorator::tick() #ifndef _CONTENT_PACKAGE #ifdef __PSVITA__ sprintf(buf,"Average save time: %f (%lld)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount); +#elif defined(__linux__) + sprintf(buf,"Average save time: %f (%lld)",0.000001 * (double) timeSpentSaving / (double) loadCount, (long long)loadCount); #else sprintf(buf,"Average save time: %f (%I64d)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount); #endif