fix: clear all build warnings and clean up review nits

This commit is contained in:
MatthewBeshay 2026-04-09 09:55:13 +10:00
parent b2a4620f25
commit 0da697cbd4
30 changed files with 88 additions and 98 deletions

View file

@ -110,7 +110,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
SKIN_BOX* pSkinBox = new SKIN_BOX;
memset(pSkinBox, 0, sizeof(SKIN_BOX));
sscanf(value.c_str(), "%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10,
sscanf(value.c_str(), "%9s%f%f%f%f%f%f%f%f", wchBodyPart,
&pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW,
&pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV);
@ -132,8 +132,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
m_AdditionalBoxes.push_back(pSkinBox);
} break;
case DLCManager::e_DLCParamType_Anim: {
sscanf(value.c_str(), "%X", &m_uiAnimOverrideBitmask,
sizeof(unsigned int));
sscanf(value.c_str(), "%X", &m_uiAnimOverrideBitmask);
uint32_t skinId = app.getSkinIdFromPath(m_path);
app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask);
break;

View file

@ -15,7 +15,7 @@ LeaderboardInterface::LeaderboardInterface(IPlatformLeaderboard* man) {
m_startIndex = 0;
m_readCount = 0;
m_manager->OpenSession();
(void)m_manager->OpenSession();
}
LeaderboardInterface::~LeaderboardInterface() {

View file

@ -717,7 +717,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam,
// If the player was signed in before selecting play, we'll not
// have read the profile yet, so query the sign-in status to get
// this to happen
PlatformProfile.QuerySigninStatus();
(void)PlatformProfile.QuerySigninStatus();
// 4J-PB - clear any previous connection errors
Minecraft::GetInstance()->clearConnectionFailed();
@ -1377,7 +1377,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus(
// If the player was signed in before selecting play, we'll not
// have read the profile yet, so query the sign-in status to get
// this to happen
PlatformProfile.QuerySigninStatus();
(void)PlatformProfile.QuerySigninStatus();
// 4J-PB - clear any previous connection errors
Minecraft::GetInstance()->clearConnectionFailed();

View file

@ -875,7 +875,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() {
app.DebugPrintf("Need more H slots - ");
#if !defined(_CONTENT_PACKAGE)
fprintf(
stderr,
stderr, "%s",
app.GetString(pTempItemInst->getDescriptionId()));
#endif
app.DebugPrintf("\n");

View file

@ -302,7 +302,7 @@ void UIScene_LoadMenu::tick() {
if (szSeed[0] != 0) {
char TempString[256];
snprintf(TempString, 256, "%s: %hs", app.GetString(IDS_SEED),
snprintf(TempString, 256, "%s: %s", app.GetString(IDS_SEED),
szSeed);
m_labelSeed.setLabel(TempString);
} else {

View file

@ -787,7 +787,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) {
// If the player was signed in before selecting play, we'll not have
// read the profile yet, so query the sign-in status to get this to
// happen
PlatformProfile.QuerySigninStatus();
(void)PlatformProfile.QuerySigninStatus();
// 4J-PB - Need to check for installed DLC
if (!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad);
@ -896,7 +896,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) {
// If the player was signed in before selecting play, we'll not have
// read the profile yet, so query the sign-in status to get this to
// happen
PlatformProfile.QuerySigninStatus();
(void)PlatformProfile.QuerySigninStatus();
proceedToScene(iPad, eUIScene_LeaderboardsMenu);
}
@ -916,7 +916,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) {
// If the player was signed in before selecting play, we'll not
// have read the profile yet, so query the sign-in status to get
// this to happen
PlatformProfile.QuerySigninStatus();
(void)PlatformProfile.QuerySigninStatus();
{
bool bContentRestricted = false;
@ -1015,7 +1015,7 @@ void UIScene_MainMenu::RunHelpAndOptions(int iPad) {
// If the player was signed in before selecting play, we'll not have
// read the profile yet, so query the sign-in status to get this to
// happen
PlatformProfile.QuerySigninStatus();
(void)PlatformProfile.QuerySigninStatus();
#if TO_BE_IMPLEMENTED
// 4J-PB - You can be offline and still can go into help and options

View file

@ -885,6 +885,8 @@ TEXTURE_NAME UIScene_SkinSelectMenu::getTextureId(int skinIndex) {
case EDefaultSkins::Skin7:
texture = TN_MOB_CHAR7;
break;
case EDefaultSkins::Count:
break;
};
return texture;

View file

@ -586,7 +586,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region,
}
m_cachedSlotDraw.clear();
if (useCommandBuffers) PlatformRenderer.CBuffCall(list);
if (useCommandBuffers) (void)PlatformRenderer.CBuffCall(list);
// Finish GDraw and anything else that needs to be finalised
ui.endCustomDraw(region);

View file

@ -6,7 +6,7 @@ public:
virtual void init() override;
protected:
virtual void keyPressed(char eventCharacter, int eventKey);
virtual void keyPressed(char eventCharacter, int eventKey) override;
virtual void buttonClicked(Button* button) override;
public:

View file

@ -188,8 +188,8 @@ void Font::draw(const std::string& str, bool dropShadow) {
// 4jcraft: this is a check for §. This was easy in UTF-16, since a
// single widechar can fit §, but it's encoded as 0xA7 0xC2 in UTF-8, so
// we need to check both characters.
if (i + 2 < cleanStr.length() && c == '\xC2' &&
(unsigned char)cleanStr[i + 1] == '\xA7') {
if (i + 2 < cleanStr.length() && c == 0xC2u &&
(unsigned char)cleanStr[i + 1] == 0xA7u) {
// 4J - following block was:
// int colorN =
// "0123456789abcdefk".indexOf(str.toLowerCase().charAt(i + 1));

View file

@ -13,7 +13,7 @@ public:
protected:
using Screen::keyPressed;
virtual void keyPressed(char eventCharacter, int eventKey);
virtual void keyPressed(char eventCharacter, int eventKey) override;
public:
virtual void init() override;

View file

@ -49,7 +49,7 @@ public:
protected:
virtual void buttonClicked(Button* button) override;
virtual void keyPressed(char eventCharacter, int eventKey);
virtual void keyPressed(char eventCharacter, int eventKey) override;
public:
virtual void render(int mouseX, int mouseY, float a) override;

View file

@ -2375,7 +2375,7 @@ void ClientConnection::handleTextureChange(
#if !defined(_CONTENT_PACKAGE)
printf("Skin for remote player %s has changed to %s (%d)\n",
player->name.c_str(), player->customTextureUrl.c_str(),
player->getPlayerDefaultSkin());
static_cast<int>(player->getPlayerDefaultSkin()));
#endif
break;
case TextureChangePacket::e_TextureChange_Cape:
@ -2431,7 +2431,7 @@ void ClientConnection::handleTextureAndGeometryChange(
#if !defined(_CONTENT_PACKAGE)
printf("Skin for remote player %s has changed to %s (%d)\n",
player->name.c_str(), player->customTextureUrl.c_str(),
player->getPlayerDefaultSkin());
static_cast<int>(player->getPlayerDefaultSkin()));
#endif
if (!packet->path.empty() &&

View file

@ -16,7 +16,7 @@ public:
virtual void tick() override;
protected:
virtual void keyPressed(char eventCharacter, int eventKey);
virtual void keyPressed(char eventCharacter, int eventKey) override;
public:
virtual void init() override;

View file

@ -15,7 +15,7 @@ public:
protected:
using Screen::keyPressed;
virtual void keyPressed(char eventCharacter, int eventKey);
virtual void keyPressed(char eventCharacter, int eventKey) override;
public:
virtual void init() override;

View file

@ -373,7 +373,8 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) {
LocalPlayer::setCustomSkin(skinId);
#if !defined(_CONTENT_PACKAGE)
printf("Skin for local player %s has changed to %s (%d)\n",
name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin());
name.c_str(), customTextureUrl.c_str(),
static_cast<int>(getPlayerDefaultSkin()));
#endif
if (getCustomSkin() != oldSkinIndex)
connection->send(std::shared_ptr<TextureAndGeometryChangePacket>(

View file

@ -13,7 +13,7 @@ public:
protected:
using Screen::keyPressed;
virtual void keyPressed(char eventCharacter, int eventKey);
virtual void keyPressed(char eventCharacter, int eventKey) override;
public:
virtual void init() override;

View file

@ -3,6 +3,7 @@
#include "AbstractTexturePack.h"
#include <cinttypes>
#include <wchar.h>
#include <vector>
@ -222,7 +223,7 @@ std::string AbstractTexturePack::getXuiRootPath() {
256; // Use this to allocate space to hold a ResourceLocator string
char szResourceLocator[LOCATOR_SIZE];
snprintf(szResourceLocator, LOCATOR_SIZE, "section://%X,%s#%s",
snprintf(szResourceLocator, LOCATOR_SIZE, "section://%" PRIxPTR ",%s#%s",
c_ModuleHandle, "media", "media/");
return szResourceLocator;
}

View file

@ -2,6 +2,7 @@
#include "minecraft/util/Log.h"
#include "DLCTexturePack.h"
#include <cinttypes>
#include <cstdint>
#include <cwchar>
#include <limits>
@ -451,8 +452,9 @@ std::string DLCTexturePack::getXuiRootPath() {
constexpr int LOCATOR_SIZE =
256; // Use this to allocate space to hold a ResourceLocator string
char szResourceLocator[LOCATOR_SIZE];
snprintf(szResourceLocator, LOCATOR_SIZE, "memory://%08X,%04X#",
pbData, dwSize);
snprintf(szResourceLocator, LOCATOR_SIZE,
"memory://%08" PRIxPTR ",%04X#",
reinterpret_cast<std::uintptr_t>(pbData), dwSize);
path = szResourceLocator;
}
return path;

View file

@ -969,7 +969,7 @@ void PlayerConnection::handleTextureChange(
#if !defined(_CONTENT_PACKAGE)
printf("Skin for server player %s has changed to %s (%d)\n",
player->name.c_str(), player->customTextureUrl.c_str(),
player->getPlayerDefaultSkin());
static_cast<int>(player->getPlayerDefaultSkin()));
#endif
break;
case TextureChangePacket::e_TextureChange_Cape:
@ -1013,7 +1013,7 @@ void PlayerConnection::handleTextureAndGeometryChange(
"PlayerConnection::handleTextureAndGeometryChange - Skin for server "
"player %s has changed to %s (%d)\n",
player->name.c_str(), player->customTextureUrl.c_str(),
player->getPlayerDefaultSkin());
static_cast<int>(player->getPlayerDefaultSkin()));
#endif
if (!packet->path.empty() &&
@ -1423,7 +1423,7 @@ void PlayerConnection::handlePlayerInfo(
gameType) {
#if !defined(_CONTENT_PACKAGE)
printf("Setting %s to game mode %d\n",
serverPlayer->name.c_str(), gameType);
serverPlayer->name.c_str(), gameType->getId());
#endif
serverPlayer->setPlayerGamePrivilege(
Player::ePlayerGamePrivilege_CreativeMode,
@ -1438,7 +1438,7 @@ void PlayerConnection::handlePlayerInfo(
} else {
#if !defined(_CONTENT_PACKAGE)
printf("%s already has game mode %d\n",
serverPlayer->name.c_str(), gameType);
serverPlayer->name.c_str(), gameType->getId());
#endif
}
if (cheats) {

View file

@ -2570,7 +2570,7 @@ std::string Level::gatherStats() {
char buf[64];
{
std::lock_guard<std::recursive_mutex> lock(m_entitiesCS);
snprintf(buf, 64, "All:%d", entities.size());
snprintf(buf, 64, "All:%zu", entities.size());
}
return std::string(buf);
}

View file

@ -422,15 +422,12 @@ void SparseDataStorage::addNewPlane(int y) {
newDataAndCount |= ((int64_t)linesUsed) << 48;
// Attempt to update the data & count atomically. This command will Only
// succeed if the data stored at dataAndCount is equal to
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = lastDataAndCount;
std::atomic_ref<int64_t>(dataAndCount).compare_exchange_strong(
lastDataAndCount2, newDataAndCount, std::memory_order_release);
if (lastDataAndCount2 == lastDataAndCount) {
// Attempt to update the data & count atomically. CAS only
// succeeds if dataAndCount currently equals lastDataAndCount.
int64_t expected = lastDataAndCount;
if (std::atomic_ref<int64_t>(dataAndCount)
.compare_exchange_strong(expected, newDataAndCount,
std::memory_order_release)) {
success = true;
// Queue old data to be deleted
queueForDelete(lastDataPointer);
@ -497,15 +494,12 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) {
unsigned char* lastDataPointer =
(unsigned char*)(lastDataAndCount & 0x0000ffffffffffff);
// Attempt to update the data & count atomically. This command will Only
// succeed if the data stored at dataAndCount is equal to
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = lastDataAndCount;
std::atomic_ref<int64_t>(dataAndCount).compare_exchange_strong(
lastDataAndCount2, newDataAndCount, std::memory_order_release);
if (lastDataAndCount2 == lastDataAndCount) {
// Attempt to update the data & count atomically. CAS only
// succeeds if dataAndCount currently equals lastDataAndCount.
int64_t expected = lastDataAndCount;
if (std::atomic_ref<int64_t>(dataAndCount)
.compare_exchange_strong(expected, newDataAndCount,
std::memory_order_release)) {
success = true;
// Queue old data to be deleted
// printf("Marking for delete 0x%x (full
@ -573,15 +567,12 @@ int SparseDataStorage::compress() {
newDataAndCount |= ((int64_t)planesToAlloc) << 48;
// Attempt to update the data & count atomically. This command will Only
// succeed if the data stored at dataAndCount is equal to
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = lastDataAndCount;
std::atomic_ref<int64_t>(dataAndCount).compare_exchange_strong(
lastDataAndCount2, newDataAndCount, std::memory_order_release);
if (lastDataAndCount2 != lastDataAndCount) {
// Attempt to update the data & count atomically. CAS only
// succeeds if dataAndCount currently equals lastDataAndCount.
int64_t expected = lastDataAndCount;
if (!std::atomic_ref<int64_t>(dataAndCount)
.compare_exchange_strong(expected, newDataAndCount,
std::memory_order_release)) {
// Failed to write. Don't bother trying again... being very
// conservative here.
// printf("Marking for delete 0x%x (compress

View file

@ -426,15 +426,12 @@ void SparseLightStorage::addNewPlane(int y) {
newDataAndCount |= ((int64_t)linesUsed) << 48;
// Attempt to update the data & count atomically. This command will Only
// succeed if the data stored at dataAndCount is equal to
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = lastDataAndCount;
std::atomic_ref<int64_t>(dataAndCount).compare_exchange_strong(
lastDataAndCount2, newDataAndCount, std::memory_order_release);
if (lastDataAndCount2 == lastDataAndCount) {
// Attempt to update the data & count atomically. CAS only
// succeeds if dataAndCount currently equals lastDataAndCount.
int64_t expected = lastDataAndCount;
if (std::atomic_ref<int64_t>(dataAndCount)
.compare_exchange_strong(expected, newDataAndCount,
std::memory_order_release)) {
success = true;
// Queue old data to be deleted
queueForDelete(lastDataPointer);
@ -501,15 +498,12 @@ void SparseLightStorage::updateDataAndCount(int64_t newDataAndCount) {
unsigned char* lastDataPointer =
(unsigned char*)(lastDataAndCount & 0x0000ffffffffffff);
// Attempt to update the data & count atomically. This command will Only
// succeed if the data stored at dataAndCount is equal to
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = lastDataAndCount;
std::atomic_ref<int64_t>(dataAndCount).compare_exchange_strong(
lastDataAndCount2, newDataAndCount, std::memory_order_release);
if (lastDataAndCount2 == lastDataAndCount) {
// Attempt to update the data & count atomically. CAS only
// succeeds if dataAndCount currently equals lastDataAndCount.
int64_t expected = lastDataAndCount;
if (std::atomic_ref<int64_t>(dataAndCount)
.compare_exchange_strong(expected, newDataAndCount,
std::memory_order_release)) {
success = true;
// Queue old data to be deleted
// printf("Marking for delete 0x%x (full
@ -584,15 +578,12 @@ int SparseLightStorage::compress() {
newDataAndCount |= ((int64_t)planesToAlloc) << 48;
// Attempt to update the data & count atomically. This command will Only
// succeed if the data stored at dataAndCount is equal to
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = lastDataAndCount;
std::atomic_ref<int64_t>(dataAndCount).compare_exchange_strong(
lastDataAndCount2, newDataAndCount, std::memory_order_release);
if (lastDataAndCount2 != lastDataAndCount) {
// Attempt to update the data & count atomically. CAS only
// succeeds if dataAndCount currently equals lastDataAndCount.
int64_t expected = lastDataAndCount;
if (!std::atomic_ref<int64_t>(dataAndCount)
.compare_exchange_strong(expected, newDataAndCount,
std::memory_order_release)) {
// Failed to write. Don't bother trying again... being very
// conservative here.
// printf("Marking for delete 0x%x (compress

View file

@ -44,8 +44,7 @@ void SignTileEntity::save(CompoundTag* tag) {
#if !defined(_CONTENT_PACKAGE)
fprintf(stderr, "### - Saving a sign with text - \n");
for (int i = 0; i < 4; i++) {
fprintf(stderr, m_wsmessages[i].c_str());
fprintf(stderr, "\n");
fprintf(stderr, "%s\n", m_wsmessages[i].c_str());
}
#endif
}
@ -63,8 +62,7 @@ void SignTileEntity::load(CompoundTag* tag) {
#if !defined(_CONTENT_PACKAGE)
fprintf(stderr, "### - Loaded a sign with text - \n");
for (int i = 0; i < 4; i++) {
fprintf(stderr, m_wsmessages[i].c_str());
fprintf(stderr, "\n");
fprintf(stderr, "%s\n", m_wsmessages[i].c_str());
}
#endif

View file

@ -32,7 +32,7 @@ public:
std::string toString() {
static char buf[32];
snprintf(buf, 32, "[%d bytes]", data.size());
snprintf(buf, 32, "[%zu bytes]", data.size());
return std::string(buf);
}

View file

@ -36,7 +36,7 @@ public:
std::string toString() {
static char buf[32];
snprintf(buf, 32, "[%d bytes]", data.size());
snprintf(buf, 32, "[%zu bytes]", data.size());
return std::string(buf);
}

View file

@ -15,7 +15,7 @@ public:
uint8_t getId() { return TAG_Long; }
std::string toString() {
static char buf[32];
snprintf(buf, 32, "%I64d", data);
snprintf(buf, 32, "%lld", static_cast<long long>(data));
return std::string(buf);
}

View file

@ -14,7 +14,7 @@ struct ImageFileBuffer {
ImageFileBuffer(EImageType type, std::size_t size)
: m_type(type),
m_pBuffer(size > 0 ? std::make_unique<std::byte[]>(size) : nullptr),
m_bufferSize(static_cast<int>(size)) {}
m_bufferSize(size) {}
// move-only
ImageFileBuffer(ImageFileBuffer&&) noexcept = default;
@ -24,7 +24,7 @@ struct ImageFileBuffer {
[[nodiscard]] EImageType GetType() const { return m_type; }
[[nodiscard]] std::byte* GetBufferPointer() const { return m_pBuffer.get(); }
[[nodiscard]] int GetBufferSize() const { return m_bufferSize; }
[[nodiscard]] std::size_t GetBufferSize() const { return m_bufferSize; }
[[nodiscard]] bool Allocated() const { return m_pBuffer != nullptr; }
void Release() {
m_pBuffer.reset();
@ -33,7 +33,7 @@ struct ImageFileBuffer {
EImageType m_type{e_typePNG};
std::unique_ptr<std::byte[]> m_pBuffer;
int m_bufferSize = 0;
std::size_t m_bufferSize = 0;
};
struct D3DXIMAGE_INFO {

View file

@ -1563,7 +1563,8 @@ void glCallLists_4J(IntBuffer* lists) {
if (!lists) return;
int count = lists->limit() - lists->position();
int* ids = getIntPtr(lists);
for (int i = 0; i < count; i++) PlatformRenderer.CBuffCall(ids[i], false);
for (int i = 0; i < count; i++)
(void)PlatformRenderer.CBuffCall(ids[i], false);
}
void glReadPixels_4J(int x, int y, int w, int h, int f, int t, ByteBuffer* p) {

View file

@ -264,7 +264,11 @@
#undef glEndList
#define glEndList() PlatformRenderer.CBuffEnd()
#undef glCallList
#define glCallList(_list) PlatformRenderer.CBuffCall(_list)
// CBuffCall is [[nodiscard]] because it can fail (chunk not ready), but
// legacy display list call sites treat it as fire-and-forget rendering -
// a missed call just means nothing draws this frame, which is what the
// old GL display list semantics already gave them.
#define glCallList(_list) ((void)PlatformRenderer.CBuffCall(_list))
// glGenLists / glDeleteLists, lists are not supported in core!!!!!
#undef glGenLists