mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 07:37:10 +00:00
fix: resolve all remaining compilation warnings
This commit is contained in:
parent
87c9733e09
commit
ca11afdfca
|
|
@ -7,7 +7,7 @@
|
||||||
// Desc: Internal helper function
|
// Desc: Internal helper function
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
#ifndef _CONTENT_PACKAGE
|
#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__)
|
#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined(__linux__)
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ PBYTE DLCAudioFile::getData(DWORD &dwBytes)
|
||||||
return m_pbData;
|
return m_pbData;
|
||||||
}
|
}
|
||||||
|
|
||||||
WCHAR *DLCAudioFile::wchTypeNamesA[]=
|
const WCHAR *DLCAudioFile::wchTypeNamesA[]=
|
||||||
{
|
{
|
||||||
L"CUENAME",
|
L"CUENAME",
|
||||||
L"CREDIT",
|
L"CREDIT",
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
e_AudioParamType_Max,
|
e_AudioParamType_Max,
|
||||||
|
|
||||||
};
|
};
|
||||||
static WCHAR *wchTypeNamesA[e_AudioParamType_Max];
|
static const WCHAR *wchTypeNamesA[e_AudioParamType_Max];
|
||||||
|
|
||||||
DLCAudioFile(const wstring &path);
|
DLCAudioFile(const wstring &path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -888,7 +888,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||||
IntCache::ReleaseThreadStorage();
|
IntCache::ReleaseThreadStorage();
|
||||||
Level::destroyLightingCache();
|
Level::destroyLightingCache();
|
||||||
|
|
||||||
if(lpParameter != NULL) delete lpParameter;
|
if(lpParameter != NULL) delete (NetworkGameInitData*)lpParameter;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1351,7 +1351,7 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void *
|
||||||
*height = 64;
|
*height = 64;
|
||||||
|
|
||||||
#endif
|
#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());
|
app.DebugPrintf("Found substitution texture %ls (%d) - %dx%d\n", (wchar_t *)texture_name, id, image.getWidth(), image.getHeight());
|
||||||
return ui.getSubstitutionTexture(id);
|
return ui.getSubstitutionTexture(id);
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUse
|
||||||
IggyMemoryUseInfo internalMemoryInfo;
|
IggyMemoryUseInfo internalMemoryInfo;
|
||||||
int internalIteration = 0;
|
int internalIteration = 0;
|
||||||
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
||||||
NULL ,
|
0 ,
|
||||||
memoryInfo.subcategory ,
|
memoryInfo.subcategory ,
|
||||||
memoryInfo.subcategory_stringlen ,
|
memoryInfo.subcategory_stringlen ,
|
||||||
internalIteration ,
|
internalIteration ,
|
||||||
|
|
@ -415,7 +415,7 @@ void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
||||||
__int64 sceneStatic = 0;
|
__int64 sceneStatic = 0;
|
||||||
__int64 sceneDynamic = 0;
|
__int64 sceneDynamic = 0;
|
||||||
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
||||||
NULL ,
|
0 ,
|
||||||
"" ,
|
"" ,
|
||||||
0 ,
|
0 ,
|
||||||
iteration ,
|
iteration ,
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,6 @@ void UIScene_HowToPlayMenu::handlePress(F64 controlId, F64 childId)
|
||||||
|
|
||||||
unsigned int uiInitData;
|
unsigned int uiInitData;
|
||||||
uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[(int)childId] << 16 ) | ( short )( m_iPad ) );
|
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 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -551,7 +551,7 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer
|
||||||
int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||||
{
|
{
|
||||||
BYTE smallId = *(BYTE *)pParam;
|
BYTE smallId = *(BYTE *)pParam;
|
||||||
delete pParam;
|
delete (BYTE*)pParam;
|
||||||
|
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId)
|
||||||
int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||||
{
|
{
|
||||||
BYTE smallId = *(BYTE *)pParam;
|
BYTE smallId = *(BYTE *)pParam;
|
||||||
delete pParam;
|
delete (BYTE*)pParam;
|
||||||
|
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ void UIScene_InGameSaveManagementMenu::GetSaveInfo( )
|
||||||
m_pSaveDetails=StorageManager.ReturnSavesInfo();
|
m_pSaveDetails=StorageManager.ReturnSavesInfo();
|
||||||
if(m_pSaveDetails==NULL)
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@
|
||||||
// if the value is greater than 32000, it's an xzp icon that needs displayed, rather than the game icon
|
// 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] =
|
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 },
|
{ 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 },
|
{ 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] = {
|
const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu::LEADERBOARD_DESCRIPTORS[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][4] = {
|
||||||
|
|
|
||||||
|
|
@ -874,7 +874,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo()
|
||||||
m_pSaveDetails=StorageManager.ReturnSavesInfo();
|
m_pSaveDetails=StorageManager.ReturnSavesInfo();
|
||||||
if(m_pSaveDetails==NULL)
|
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
|
#if TO_BE_IMPLEMENTED
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
//#define SKIN_SELECT_PACK_PLAYER_CUSTOM 1
|
//#define SKIN_SELECT_PACK_PLAYER_CUSTOM 1
|
||||||
#define SKIN_SELECT_MAX_DEFAULTS 2
|
#define SKIN_SELECT_MAX_DEFAULTS 2
|
||||||
|
|
||||||
WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]=
|
const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]=
|
||||||
{
|
{
|
||||||
L"USE LOCALISED VERSION", // Server selected
|
L"USE LOCALISED VERSION", // Server selected
|
||||||
L"Steve",
|
L"Steve",
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
class UIScene_SkinSelectMenu : public UIScene
|
class UIScene_SkinSelectMenu : public UIScene
|
||||||
{
|
{
|
||||||
private:
|
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
|
// 4J Stu - How many to show on each side of the main control
|
||||||
static const BYTE sidePreviewControls = 4;
|
static const BYTE sidePreviewControls = 4;
|
||||||
|
|
|
||||||
|
|
@ -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
|
// 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 )
|
if( initData->saveData )
|
||||||
{
|
{
|
||||||
delete initData->saveData->data;
|
delete[] (BYTE*)initData->saveData->data;
|
||||||
initData->saveData->data = 0;
|
initData->saveData->data = 0;
|
||||||
initData->saveData->fileSize = 0;
|
initData->saveData->fileSize = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -672,7 +672,7 @@ app.loadStringTable();
|
||||||
// fuck you
|
// fuck you
|
||||||
ui.init(1920, 1080);
|
ui.init(1920, 1080);
|
||||||
// storage manager is needed for the trial key check
|
// 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 //
|
// Initialise //
|
||||||
|
|
@ -994,8 +994,11 @@ vector<uint8_t *> vRichPresenceStrings;
|
||||||
// convert wstring to UTF-8 string
|
// convert wstring to UTF-8 string
|
||||||
std::string wstring_to_utf8 (const std::wstring& str)
|
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;
|
std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
|
||||||
return myconv.to_bytes(str);
|
return myconv.to_bytes(str);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *mallocAndCreateUTF8ArrayFromString(int iID)
|
uint8_t *mallocAndCreateUTF8ArrayFromString(int iID)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
class Chunk;
|
class Chunk;
|
||||||
class Mob;
|
class Mob;
|
||||||
|
|
||||||
class DirtyChunkSorter : public std::binary_function<const Chunk *,const Chunk *,bool>
|
class DirtyChunkSorter
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
shared_ptr<Mob> cameraEntity;
|
shared_ptr<Mob> cameraEntity;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
class Entity;
|
class Entity;
|
||||||
class Chunk;
|
class Chunk;
|
||||||
|
|
||||||
class DistanceChunkSorter : public std::binary_function<const Chunk *,const Chunk *,bool>
|
class DistanceChunkSorter
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
double ix, iy, iz;
|
double ix, iy, iz;
|
||||||
|
|
|
||||||
|
|
@ -2386,7 +2386,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
|
||||||
|
|
||||||
dirtyChunksLockFreeStack.Push((int *)(index));
|
dirtyChunksLockFreeStack.Push((int *)(index));
|
||||||
#else
|
#else
|
||||||
dirtyChunksLockFreeStack.Push((int *)(index + 2));
|
dirtyChunksLockFreeStack.Push((int *)(intptr_t)(index + 2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
|
|
@ -3599,7 +3599,7 @@ void LevelRenderer::staticCtor()
|
||||||
for(unsigned int i = 0; i < MAX_CHUNK_REBUILD_THREADS; ++i)
|
for(unsigned int i = 0; i < MAX_CHUNK_REBUILD_THREADS; ++i)
|
||||||
{
|
{
|
||||||
sprintf(threadName,"Rebuild Chunk Thread %d\n",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();
|
s_activationEventA[i] = new C4JThread::Event();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1376,7 +1376,7 @@ TEXTURE_NAME OriginalImages[] =
|
||||||
TN_COUNT
|
TN_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
wchar_t *OriginalImagesPaths[] =
|
const wchar_t *OriginalImagesPaths[] =
|
||||||
{
|
{
|
||||||
L"misc/watercolor.png",
|
L"misc/watercolor.png",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
ControlsScreen::ControlsScreen(Screen *lastScreen, Options *options)
|
ControlsScreen::ControlsScreen(Screen *lastScreen, Options *options)
|
||||||
{
|
{
|
||||||
// 4J - added initialisers
|
// 4J - added initialisers
|
||||||
title == L"Controls";
|
title = L"Controls";
|
||||||
selectedKey = -1;
|
selectedKey = -1;
|
||||||
|
|
||||||
this->lastScreen = lastScreen;
|
this->lastScreen = lastScreen;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "../../Headers/net.minecraft.world.entity.ai.sensing.h"
|
#include "../../Headers/net.minecraft.world.entity.ai.sensing.h"
|
||||||
#include "../../Headers/net.minecraft.world.phys.h"
|
#include "../../Headers/net.minecraft.world.phys.h"
|
||||||
#include "MeleeAttackGoal.h"
|
#include "MeleeAttackGoal.h"
|
||||||
|
#include "../Navigation/Path.h"
|
||||||
|
|
||||||
void MeleeAttackGoal::_init(Mob *mob, float speed, bool trackTarget)
|
void MeleeAttackGoal::_init(Mob *mob, float speed, bool trackTarget)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ bool PistonBaseTile::ignoreUpdate()
|
||||||
|
|
||||||
void PistonBaseTile::ignoreUpdate(bool set)
|
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() )
|
PistonBaseTile::PistonBaseTile(int id, bool isSticky) : Tile(id, Material::piston, isSolidRender() )
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ bool TheEndPortal::allowAnywhere()
|
||||||
|
|
||||||
void TheEndPortal::allowAnywhere(bool set)
|
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())
|
TheEndPortal::TheEndPortal(int id, Material *material) : EntityTile(id, material, isSolidRender())
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include "../../Headers/net.minecraft.world.level.h"
|
#include "../../Headers/net.minecraft.world.level.h"
|
||||||
#include "../../../Minecraft.Client/Textures/Textures.h"
|
#include "../../../Minecraft.Client/Textures/Textures.h"
|
||||||
#include "Villager.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_VALUES;
|
||||||
unordered_map<int, pair<int,int> > Villager::MIN_MAX_PRICES;
|
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
|
// 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)
|
if (offers == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ void ConsoleSaveFileSplit::RegionFileReference::ReleaseCompressed()
|
||||||
// app.DebugPrintf("Releasing compressed data for region file from 0x%.8x\n", fileEntry->data.regionIndex );
|
// app.DebugPrintf("Releasing compressed data for region file from 0x%.8x\n", fileEntry->data.regionIndex );
|
||||||
free(dataCompressed);
|
free(dataCompressed);
|
||||||
dataCompressed = NULL;
|
dataCompressed = NULL;
|
||||||
dataCompressedSize = NULL;
|
dataCompressedSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex)
|
FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex)
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ void Socket::SocketInputStreamLocal::close()
|
||||||
{
|
{
|
||||||
m_streamOpen = false;
|
m_streamOpen = false;
|
||||||
EnterCriticalSection(&s_hostQueueLock[m_queueIdx]);
|
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]);
|
LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -366,7 +366,7 @@ void Socket::SocketOutputStreamLocal::close()
|
||||||
{
|
{
|
||||||
m_streamOpen = false;
|
m_streamOpen = false;
|
||||||
EnterCriticalSection(&s_hostQueueLock[m_queueIdx]);
|
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]);
|
LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#include "Hasher.h"
|
#include "Hasher.h"
|
||||||
|
#include <openssl/evp.h>
|
||||||
|
|
||||||
Hasher::Hasher(wstring &salt)
|
Hasher::Hasher(wstring &salt)
|
||||||
{
|
{
|
||||||
|
|
@ -36,13 +37,15 @@ wstring Hasher::getHash(wstring &name)
|
||||||
// adapted from a SSL example
|
// adapted from a SSL example
|
||||||
std::wstring combined = salt + name;
|
std::wstring combined = salt + name;
|
||||||
std::string combined_str(combined.begin(), combined.end());
|
std::string combined_str(combined.begin(), combined.end());
|
||||||
unsigned char result[MD5_DIGEST_LENGTH];
|
unsigned char result[EVP_MAX_MD_SIZE];
|
||||||
MD5_CTX md5_ctx;
|
EVP_MD_CTX* md5_ctx = EVP_MD_CTX_new();
|
||||||
MD5_Init(&md5_ctx);
|
EVP_DigestInit_ex(md5_ctx, EVP_md5(), NULL);
|
||||||
MD5_Update(&md5_ctx, combined_str.c_str(), combined_str.size());
|
EVP_DigestUpdate(md5_ctx, combined_str.c_str(), combined_str.size());
|
||||||
MD5_Final(result, &md5_ctx);
|
unsigned int result_len;
|
||||||
|
EVP_DigestFinal_ex(md5_ctx, result, &result_len);
|
||||||
|
EVP_MD_CTX_free(md5_ctx);
|
||||||
std::stringstream ss;
|
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];
|
ss << std::setw(2) << std::setfill('0') << std::hex << (int)result[i];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue