fix: resolve all remaining compilation warnings

This commit is contained in:
zukrmn 2026-03-07 04:43:50 +00:00
parent 87c9733e09
commit ca11afdfca
28 changed files with 46 additions and 36 deletions

View file

@ -7,7 +7,7 @@
// Desc: Internal helper function
//--------------------------------------------------------------------------------------
#ifndef _CONTENT_PACKAGE
static VOID DebugSpewV( const CHAR* strFormat, const va_list pArgList )
static VOID DebugSpewV( const CHAR* strFormat, va_list pArgList )
{
#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined(__linux__)
assert(0);

View file

@ -26,7 +26,7 @@ PBYTE DLCAudioFile::getData(DWORD &dwBytes)
return m_pbData;
}
WCHAR *DLCAudioFile::wchTypeNamesA[]=
const WCHAR *DLCAudioFile::wchTypeNamesA[]=
{
L"CUENAME",
L"CREDIT",

View file

@ -28,7 +28,7 @@ public:
e_AudioParamType_Max,
};
static WCHAR *wchTypeNamesA[e_AudioParamType_Max];
static const WCHAR *wchTypeNamesA[e_AudioParamType_Max];
DLCAudioFile(const wstring &path);

View file

@ -888,7 +888,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
IntCache::ReleaseThreadStorage();
Level::destroyLightingCache();
if(lpParameter != NULL) delete lpParameter;
if(lpParameter != NULL) delete (NetworkGameInitData*)lpParameter;
return 0;
}

View file

@ -1351,7 +1351,7 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void *
*height = 64;
#endif
*destroy_callback_data = (void *)id;
*destroy_callback_data = (void *)(intptr_t)id;
app.DebugPrintf("Found substitution texture %ls (%d) - %dx%d\n", (wchar_t *)texture_name, id, image.getWidth(), image.getHeight());
return ui.getSubstitutionTexture(id);

View file

@ -392,7 +392,7 @@ void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUse
IggyMemoryUseInfo internalMemoryInfo;
int internalIteration = 0;
while(res = IggyDebugGetMemoryUseInfo ( swf ,
NULL ,
0 ,
memoryInfo.subcategory ,
memoryInfo.subcategory_stringlen ,
internalIteration ,
@ -415,7 +415,7 @@ void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
__int64 sceneStatic = 0;
__int64 sceneDynamic = 0;
while(res = IggyDebugGetMemoryUseInfo ( swf ,
NULL ,
0 ,
"" ,
0 ,
iteration ,

View file

@ -200,6 +200,6 @@ void UIScene_HowToPlayMenu::handlePress(F64 controlId, F64 childId)
unsigned int uiInitData;
uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[(int)childId] << 16 ) | ( short )( m_iPad ) );
ui.NavigateToScene(m_iPad, eUIScene_HowToPlay, ( void* )( uiInitData ) );
ui.NavigateToScene(m_iPad, eUIScene_HowToPlay, ( void* )(intptr_t)( uiInitData ) );
}
}

View file

@ -551,7 +551,7 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer
int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
BYTE smallId = *(BYTE *)pParam;
delete pParam;
delete (BYTE*)pParam;
if(result==C4JStorage::EMessage_ResultAccept)
{

View file

@ -361,7 +361,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId)
int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
BYTE smallId = *(BYTE *)pParam;
delete pParam;
delete (BYTE*)pParam;
if(result==C4JStorage::EMessage_ResultAccept)
{

View file

@ -379,7 +379,7 @@ void UIScene_InGameSaveManagementMenu::GetSaveInfo( )
m_pSaveDetails=StorageManager.ReturnSavesInfo();
if(m_pSaveDetails==NULL)
{
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save");
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,(char*)"save");
}

View file

@ -11,9 +11,9 @@
// if the value is greater than 32000, it's an xzp icon that needs displayed, rather than the game icon
const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] =
{
{ UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, NULL },
{ UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, 0 },
{ Tile::dirt_Id, Tile::stoneBrick_Id, Tile::sand_Id, Tile::rock_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id },
{ Item::egg_Id, Item::wheat_Id, Tile::mushroom1_Id, Tile::reeds_Id, Item::milk_Id, Tile::pumpkin_Id, NULL },
{ Item::egg_Id, Item::wheat_Id, Tile::mushroom1_Id, Tile::reeds_Id, Item::milk_Id, Tile::pumpkin_Id, 0 },
{ UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIE, UIControl_LeaderboardList::e_ICON_TYPE_SKELETON, UIControl_LeaderboardList::e_ICON_TYPE_CREEPER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDERJOKEY, UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIEPIGMAN, UIControl_LeaderboardList::e_ICON_TYPE_SLIME },
};
const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu::LEADERBOARD_DESCRIPTORS[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][4] = {

View file

@ -874,7 +874,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo()
m_pSaveDetails=StorageManager.ReturnSavesInfo();
if(m_pSaveDetails==NULL)
{
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save");
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,(char*)"save");
}
#if TO_BE_IMPLEMENTED

View file

@ -13,7 +13,7 @@
//#define SKIN_SELECT_PACK_PLAYER_CUSTOM 1
#define SKIN_SELECT_MAX_DEFAULTS 2
WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]=
const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]=
{
L"USE LOCALISED VERSION", // Server selected
L"Steve",

View file

@ -6,7 +6,7 @@
class UIScene_SkinSelectMenu : public UIScene
{
private:
static WCHAR *wchDefaultNamesA[eDefaultSkins_Count];
static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count];
// 4J Stu - How many to show on each side of the main control
static const BYTE sidePreviewControls = 4;

View file

@ -262,7 +262,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
// 4J delete passed in save data now - this is only required for the tutorial which is loaded by passing data directly in rather than using the storage manager
if( initData->saveData )
{
delete initData->saveData->data;
delete[] (BYTE*)initData->saveData->data;
initData->saveData->data = 0;
initData->saveData->fileSize = 0;
}

View file

@ -672,7 +672,7 @@ app.loadStringTable();
// fuck you
ui.init(1920, 1080);
// storage manager is needed for the trial key check
StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app,"");
StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),(char*)"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app,(char*)"");
////////////////
// Initialise //
@ -994,8 +994,11 @@ vector<uint8_t *> vRichPresenceStrings;
// convert wstring to UTF-8 string
std::string wstring_to_utf8 (const std::wstring& str)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
return myconv.to_bytes(str);
#pragma GCC diagnostic pop
}
uint8_t *mallocAndCreateUTF8ArrayFromString(int iID)

View file

@ -2,7 +2,7 @@
class Chunk;
class Mob;
class DirtyChunkSorter : public std::binary_function<const Chunk *,const Chunk *,bool>
class DirtyChunkSorter
{
private:
shared_ptr<Mob> cameraEntity;

View file

@ -2,7 +2,7 @@
class Entity;
class Chunk;
class DistanceChunkSorter : public std::binary_function<const Chunk *,const Chunk *,bool>
class DistanceChunkSorter
{
private:
double ix, iy, iz;

View file

@ -2386,7 +2386,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
dirtyChunksLockFreeStack.Push((int *)(index));
#else
dirtyChunksLockFreeStack.Push((int *)(index + 2));
dirtyChunksLockFreeStack.Push((int *)(intptr_t)(index + 2));
#endif
#ifdef _XBOX
@ -3599,7 +3599,7 @@ void LevelRenderer::staticCtor()
for(unsigned int i = 0; i < MAX_CHUNK_REBUILD_THREADS; ++i)
{
sprintf(threadName,"Rebuild Chunk Thread %d\n",i);
rebuildThreads[i] = new C4JThread(rebuildChunkThreadProc,(void *)i,threadName);
rebuildThreads[i] = new C4JThread(rebuildChunkThreadProc,(void *)(intptr_t)i,threadName);
s_activationEventA[i] = new C4JThread::Event();

View file

@ -1376,7 +1376,7 @@ TEXTURE_NAME OriginalImages[] =
TN_COUNT
};
wchar_t *OriginalImagesPaths[] =
const wchar_t *OriginalImagesPaths[] =
{
L"misc/watercolor.png",

View file

@ -7,7 +7,7 @@
ControlsScreen::ControlsScreen(Screen *lastScreen, Options *options)
{
// 4J - added initialisers
title == L"Controls";
title = L"Controls";
selectedKey = -1;
this->lastScreen = lastScreen;

View file

@ -7,6 +7,7 @@
#include "../../Headers/net.minecraft.world.entity.ai.sensing.h"
#include "../../Headers/net.minecraft.world.phys.h"
#include "MeleeAttackGoal.h"
#include "../Navigation/Path.h"
void MeleeAttackGoal::_init(Mob *mob, float speed, bool trackTarget)
{

View file

@ -33,7 +33,7 @@ bool PistonBaseTile::ignoreUpdate()
void PistonBaseTile::ignoreUpdate(bool set)
{
TlsSetValue(tlsIdx,(LPVOID)(set?1:0));
TlsSetValue(tlsIdx,(LPVOID)(intptr_t)(set?1:0));
}
PistonBaseTile::PistonBaseTile(int id, bool isSticky) : Tile(id, Material::piston, isSolidRender() )

View file

@ -18,7 +18,7 @@ bool TheEndPortal::allowAnywhere()
void TheEndPortal::allowAnywhere(bool set)
{
TlsSetValue(tlsIdx,(LPVOID)(set?1:0));
TlsSetValue(tlsIdx,(LPVOID)(intptr_t)(set?1:0));
}
TheEndPortal::TheEndPortal(int id, Material *material) : EntityTile(id, material, isSolidRender())

View file

@ -15,6 +15,7 @@
#include "../../Headers/net.minecraft.world.level.h"
#include "../../../Minecraft.Client/Textures/Textures.h"
#include "Villager.h"
#include <random>
unordered_map<int, pair<int,int> > Villager::MIN_MAX_VALUES;
unordered_map<int, pair<int,int> > Villager::MIN_MAX_PRICES;
@ -529,7 +530,9 @@ void Villager::addOffers(int addCount)
}
// shuffle the list to make it more interesting
std::random_shuffle(newOffers->begin(), newOffers->end());
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(newOffers->begin(), newOffers->end(), g);
if (offers == NULL)
{

View file

@ -359,7 +359,7 @@ void ConsoleSaveFileSplit::RegionFileReference::ReleaseCompressed()
// app.DebugPrintf("Releasing compressed data for region file from 0x%.8x\n", fileEntry->data.regionIndex );
free(dataCompressed);
dataCompressed = NULL;
dataCompressedSize = NULL;
dataCompressedSize = 0;
}
FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex)

View file

@ -318,7 +318,7 @@ void Socket::SocketInputStreamLocal::close()
{
m_streamOpen = false;
EnterCriticalSection(&s_hostQueueLock[m_queueIdx]);
s_hostQueue[m_queueIdx].empty();
while(!s_hostQueue[m_queueIdx].empty()) s_hostQueue[m_queueIdx].pop();
LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]);
}
@ -366,7 +366,7 @@ void Socket::SocketOutputStreamLocal::close()
{
m_streamOpen = false;
EnterCriticalSection(&s_hostQueueLock[m_queueIdx]);
s_hostQueue[m_queueIdx].empty();
while(!s_hostQueue[m_queueIdx].empty()) s_hostQueue[m_queueIdx].pop();
LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]);
}

View file

@ -8,6 +8,7 @@
#include <sstream>
#endif // _WIN32
#include "Hasher.h"
#include <openssl/evp.h>
Hasher::Hasher(wstring &salt)
{
@ -36,13 +37,15 @@ wstring Hasher::getHash(wstring &name)
// adapted from a SSL example
std::wstring combined = salt + name;
std::string combined_str(combined.begin(), combined.end());
unsigned char result[MD5_DIGEST_LENGTH];
MD5_CTX md5_ctx;
MD5_Init(&md5_ctx);
MD5_Update(&md5_ctx, combined_str.c_str(), combined_str.size());
MD5_Final(result, &md5_ctx);
unsigned char result[EVP_MAX_MD_SIZE];
EVP_MD_CTX* md5_ctx = EVP_MD_CTX_new();
EVP_DigestInit_ex(md5_ctx, EVP_md5(), NULL);
EVP_DigestUpdate(md5_ctx, combined_str.c_str(), combined_str.size());
unsigned int result_len;
EVP_DigestFinal_ex(md5_ctx, result, &result_len);
EVP_MD_CTX_free(md5_ctx);
std::stringstream ss;
for (int i = 0; i < MD5_DIGEST_LENGTH; i++)
for (unsigned int i = 0; i < result_len; i++)
{
ss << std::setw(2) << std::setfill('0') << std::hex << (int)result[i];
}