diff --git a/minecraft/Minecraft.Client/Common/Consoles_App.cpp b/minecraft/Minecraft.Client/Common/Consoles_App.cpp index 44a845ade..d02ca3088 100644 --- a/minecraft/Minecraft.Client/Common/Consoles_App.cpp +++ b/minecraft/Minecraft.Client/Common/Consoles_App.cpp @@ -143,11 +143,11 @@ CMinecraftApp::CMinecraftApp() { m_bDebugOptions = false; #endif - // ZeroMemory(m_PreviewBuffer,sizeof(XSOCIAL_PREVIEWIMAGE)*XUSER_MAX_COUNT); + // memset(m_PreviewBuffer, 0, sizeof(XSOCIAL_PREVIEWIMAGE)*XUSER_MAX_COUNT); m_xuidNotch = INVALID_XUID; - ZeroMemory(&m_InviteData, sizeof(JoinFromInviteData)); + memset(&m_InviteData, 0, sizeof(JoinFromInviteData)); // m_bRead_TMS_XUIDS_XML=false; // m_bRead_TMS_DLCINFO_XML=false; @@ -164,7 +164,7 @@ CMinecraftApp::CMinecraftApp() { m_iTotalDLCInstalled = 0; mfTrialPausedTime = 0.0f; m_uiAutosaveTimer = 0; - ZeroMemory(m_pszUniqueMapName, 14); + memset(m_pszUniqueMapName, 0, 14); m_bNewDLCAvailable = false; m_bSeenNewDLCTip = false; @@ -177,7 +177,7 @@ CMinecraftApp::CMinecraftApp() { m_GameNewHellScale = 0; #endif - ZeroMemory(m_playerColours, MINECRAFT_NET_MAX_PLAYERS); + memset(m_playerColours, 0, MINECRAFT_NET_MAX_PLAYERS); m_iDLCOfferC = 0; m_bAllDLCContentRetrieved = true; @@ -4816,7 +4816,7 @@ int CMinecraftApp::TipsSortFunction(const void* a, const void* b) { void CMinecraftApp::InitialiseTips() { // We'll randomise the tips at start up based on their priority - ZeroMemory(m_TipIDA, sizeof(m_TipIDA)); + memset(m_TipIDA, 0, sizeof(m_TipIDA)); // Make the first tip tell you that you can play splitscreen in HD modes if // you are in SD @@ -5261,7 +5261,7 @@ int32_t CMinecraftApp::RegisterMojangData(wchar_t* pXuidName, PlayerUID xuid, if (eTempXuid != eXUID_Undefined) { pMojangData = new MOJANG_DATA; - ZeroMemory(pMojangData, sizeof(MOJANG_DATA)); + memset(pMojangData, 0, sizeof(MOJANG_DATA)); pMojangData->eXuid = eTempXuid; wcsncpy(pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE); @@ -5313,7 +5313,7 @@ int32_t CMinecraftApp::RegisterDLCData(wchar_t* pType, wchar_t* pBannerName, wchar_t* pDataFile) { int32_t hr = 0; DLC_INFO* pDLCData = new DLC_INFO; - ZeroMemory(pDLCData, sizeof(DLC_INFO)); + memset(pDLCData, 0, sizeof(DLC_INFO)); pDLCData->ullOfferID_Full = ullOfferID_Full; pDLCData->ullOfferID_Trial = ullOfferID_Trial; pDLCData->eDLCType = e_DLC_NotDefined; @@ -5375,7 +5375,7 @@ int32_t CMinecraftApp::RegisterDLCData(char* pchDLCName, char chDLCType[3]; int32_t hr = 0; DLC_INFO* pDLCData = new DLC_INFO; - ZeroMemory(pDLCData, sizeof(DLC_INFO)); + memset(pDLCData, 0, sizeof(DLC_INFO)); chDLCType[0] = pchDLCName[0]; chDLCType[1] = pchDLCName[1]; @@ -6203,7 +6203,7 @@ void CMinecraftApp::GetImageTextData(std::uint8_t* imageData, // check that it's the 4J text unsigned char* pszKeyword = &ucPtr[uiCount]; while (pszKeyword < ucPtr + uiCount + uiChunkLen) { - ZeroMemory(szKeyword, 80); + memset(szKeyword, 0, 80); unsigned int uiKeywordC = 0; while (*pszKeyword != 0) { szKeyword[uiKeywordC++] = *pszKeyword; @@ -6225,7 +6225,7 @@ void CMinecraftApp::GetImageTextData(std::uint8_t* imageData, unsigned int uiValueC = 0; unsigned char pszHostOptions[9]; // Hex representation of // unsigned int - ZeroMemory(&pszHostOptions, 9); + memset(&pszHostOptions, 0, 9); while (*pszKeyword != 0 && (pszKeyword < ucPtr + uiCount + uiChunkLen) && uiValueC < 8) { @@ -6242,7 +6242,7 @@ void CMinecraftApp::GetImageTextData(std::uint8_t* imageData, unsigned int uiValueC = 0; unsigned char pszTexturePack[9]; // Hex representation of // unsigned int - ZeroMemory(&pszTexturePack, 9); + memset(&pszTexturePack, 0, 9); while (*pszKeyword != 0 && (pszKeyword < ucPtr + uiCount + uiChunkLen) && uiValueC < 8) { @@ -6653,7 +6653,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, // app.DebugPrintf("Adding a request to the TMSPP // download queue - %ls\n",pDLC->wchBanner); TMSPPRequest* pTMSPPreq = new TMSPPRequest; - ZeroMemory(pTMSPPreq, sizeof(TMSPPRequest)); + memset(pTMSPPreq, 0, sizeof(TMSPPRequest)); pTMSPPreq->CallbackFunc = &CMinecraftApp::TMSPPFileReturned; diff --git a/minecraft/Minecraft.Client/Common/Source Files/DLC/DLCSkinFile.cpp b/minecraft/Minecraft.Client/Common/Source Files/DLC/DLCSkinFile.cpp index 426e41e32..0a12ed7b2 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/DLC/DLCSkinFile.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/DLC/DLCSkinFile.cpp @@ -107,7 +107,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, case DLCManager::e_DLCParamType_Box: { wchar_t wchBodyPart[10]; SKIN_BOX* pSkinBox = new SKIN_BOX; - ZeroMemory(pSkinBox, sizeof(SKIN_BOX)); + memset(pSkinBox, 0, sizeof(SKIN_BOX)); swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10, &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, diff --git a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.h b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.h index 76492eed9..ae2fc5d60 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.h +++ b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.h @@ -54,7 +54,7 @@ public: Compression::ECompressionTypes compressionType; _XboxSchematicInitParam() { - ZeroMemory(name, 64 * (sizeof(wchar_t))); + memset(name, 0, 64 * (sizeof(wchar_t))); startX = startY = startZ = endX = endY = endZ = 0; bSaveMobs = false; compressionType = Compression::eCompressionType_None; diff --git a/minecraft/Minecraft.Client/Common/Source Files/Network/PlatformNetworkManagerStub.cpp b/minecraft/Minecraft.Client/Common/Source Files/Network/PlatformNetworkManagerStub.cpp index 664fbabf1..1c940521a 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/Network/PlatformNetworkManagerStub.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/Network/PlatformNetworkManagerStub.cpp @@ -451,7 +451,7 @@ std::wstring CPlatformNetworkManagerStub::GatherRTTStats() { ((NetworkPlayerQNet*)GetPlayerByIndex(i))->GetQNetPlayer(); if (!pQNetPlayer->IsLocal()) { - ZeroMemory(stat, 32 * sizeof(wchar_t)); + memset(stat, 0, 32 * sizeof(wchar_t)); swprintf(stat, 32, L"%d: %d/", i, pQNetPlayer->GetCurrentRtt()); stats.append(stat); } diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp index 7f910e1d7..f1337c8f3 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp @@ -599,7 +599,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry( LeaderboardEntry* leaderboardEntry = &(m_leaderboard.m_entries[leaderboardEntryIndex]); - ZeroMemory(leaderboardEntry, sizeof(LeaderboardEntry)); + memset(leaderboardEntry, 0, sizeof(LeaderboardEntry)); leaderboardEntry->m_xuid = statsRow->m_uid; // Copy the rank @@ -635,7 +635,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry( // Copy the other columns for (unsigned int i = 0; i < statsRow->m_statsSize; i++) { leaderboardEntry->m_columns[i] = statsRow->m_statsData[i]; - ZeroMemory(leaderboardEntry->m_wcColumns[i], 12 * sizeof(wchar_t)); + memset(leaderboardEntry->m_wcColumns[i], 0, 12 * sizeof(wchar_t)); if (!isDistanceLeaderboard) { unsigned int displayValue = leaderboardEntry->m_columns[i]; if (displayValue > 99999) displayValue = 99999; diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp index 8a7ab08a2..58433938e 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp @@ -270,7 +270,7 @@ void UIScene_LoadMenu::tick() { unsigned int uiHostOptions = 0; char szSeed[50]; - ZeroMemory(szSeed, 50); + memset(szSeed, 0, 50); app.GetImageTextData( m_pbThumbnailData, m_uiThumbnailSize, (unsigned char*)&szSeed, uiHostOptions, bHostOptionsRead, m_MoreOptionsParams.dwTexturePack); diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp index 776cfb24d..0c48ec5f0 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp @@ -1099,7 +1099,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() { } SessionID selectedSessionId; - ZeroMemory(&selectedSessionId, sizeof(SessionID)); + memset(&selectedSessionId, 0, sizeof(SessionID)); if (pSelectedSession != nullptr) selectedSessionId = pSelectedSession->sessionId; pSelectedSession = nullptr; @@ -1476,7 +1476,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( // bring up a keyboard wchar_t wSaveName[128]; // CD - Fix - We must memset the SaveName - ZeroMemory(wSaveName, 128 * sizeof(wchar_t)); + memset(wSaveName, 0, 128 * sizeof(wchar_t)); mbstowcs( wSaveName, pClass @@ -1722,7 +1722,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { // on saving games that std::uint8_t bTextMetadata[88]; - ZeroMemory(bTextMetadata, 88); + memset(bTextMetadata, 0, 88); unsigned int hostOptions = app.getRemoteStorage()->getSaveHostOptions(); int iTextMetadataBytes = app.CreateImageTextData( @@ -1898,7 +1898,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { // for use on saving games that std::uint8_t bTextMetadata[88]; - ZeroMemory(bTextMetadata, 88); + memset(bTextMetadata, 0, 88); unsigned int remoteHostOptions = app.getRemoteStorage()->getSaveHostOptions(); app.SetGameHostOption(eGameHostOption_All, diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Help & Options/UIScene_Credits.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Help & Options/UIScene_Credits.cpp index 63c52c1ea..11ea90645 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -237,7 +237,7 @@ void UIScene_Credits::tick() { wchar_t* creditsString = new wchar_t[128]; if (pDef->m_iStringID[0] == NO_TRANSLATED_STRING) { - ZeroMemory(creditsString, 128); + memset(creditsString, 0, 128); memcpy(creditsString, sanitisedString.c_str(), sizeof(wchar_t) * sanitisedString.length()); } else if (pDef->m_iStringID[1] != NO_TRANSLATED_STRING) { diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp index 17b72ac2a..19a6ff2dc 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp @@ -235,7 +235,7 @@ void UIScene_EndPoem::updateNoise() { colour = eHTMLColor_9; else if (randomVal == 2) colour = eHTMLColor_a; - ZeroMemory(replacements, 64 * sizeof(wchar_t)); + memset(replacements, 0, 64 * sizeof(wchar_t)); swprintf( replacements, 64, L"%ls", diff --git a/minecraft/Minecraft.Client/Linux/Linux_Minecraft.cpp b/minecraft/Minecraft.Client/Linux/Linux_Minecraft.cpp index d45794baa..97ad9f2e7 100644 --- a/minecraft/Minecraft.Client/Linux/Linux_Minecraft.cpp +++ b/minecraft/Minecraft.Client/Linux/Linux_Minecraft.cpp @@ -547,7 +547,7 @@ int32_t InitDevice() { uint32_t numFeatureLevels = ARRAYSIZE(featureLevels); DXGI_SWAP_CHAIN_DESC sd; - ZeroMemory(&sd, sizeof(sd)); + memset(&sd, 0, sizeof(sd)); sd.BufferCount = 1; sd.BufferDesc.Width = width; sd.BufferDesc.Height = height; diff --git a/minecraft/Minecraft.Client/Linux/Stubs/winapi_stubs.h b/minecraft/Minecraft.Client/Linux/Stubs/winapi_stubs.h index 0d3533338..365af9a1f 100644 --- a/minecraft/Minecraft.Client/Linux/Stubs/winapi_stubs.h +++ b/minecraft/Minecraft.Client/Linux/Stubs/winapi_stubs.h @@ -14,9 +14,6 @@ #include #include -#define RtlZeroMemory(Destination, Length) memset((Destination), 0, (Length)) -#define ZeroMemory RtlZeroMemory - #define __cdecl #define _vsnprintf_s vsnprintf; diff --git a/minecraft/Minecraft.Client/Source Files/BufferedImage.cpp b/minecraft/Minecraft.Client/Source Files/BufferedImage.cpp index 2ea7b60c0..c9e63a7d0 100644 --- a/minecraft/Minecraft.Client/Source Files/BufferedImage.cpp +++ b/minecraft/Minecraft.Client/Source Files/BufferedImage.cpp @@ -88,7 +88,7 @@ BufferedImage::BufferedImage(const std::wstring& File, } D3DXIMAGE_INFO ImageInfo; - ZeroMemory(&ImageInfo, sizeof(D3DXIMAGE_INFO)); + memset(&ImageInfo, 0, sizeof(D3DXIMAGE_INFO)); if (foundOnDisk) { hr = RenderManager.LoadTextureData(wstringtofilename(finalPath), @@ -164,7 +164,7 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { } D3DXIMAGE_INFO ImageInfo; - ZeroMemory(&ImageInfo, sizeof(D3DXIMAGE_INFO)); + memset(&ImageInfo, 0, sizeof(D3DXIMAGE_INFO)); int32_t hr = RenderManager.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[0]); diff --git a/minecraft/Minecraft.Client/Windows64/Source Files/Windows64_Minecraft.cpp b/minecraft/Minecraft.Client/Windows64/Source Files/Windows64_Minecraft.cpp index abde05fb4..e2a5390ad 100644 --- a/minecraft/Minecraft.Client/Windows64/Source Files/Windows64_Minecraft.cpp +++ b/minecraft/Minecraft.Client/Windows64/Source Files/Windows64_Minecraft.cpp @@ -564,7 +564,7 @@ int32_t InitDevice() { uint32_t numFeatureLevels = ARRAYSIZE(featureLevels); DXGI_SWAP_CHAIN_DESC sd; - ZeroMemory(&sd, sizeof(sd)); + memset(&sd, 0, sizeof(sd)); sd.BufferCount = 1; sd.BufferDesc.Width = width; sd.BufferDesc.Height = height; diff --git a/minecraft/Minecraft.Client/Windows64/XML/xmlFilesCallback.h b/minecraft/Minecraft.Client/Windows64/XML/xmlFilesCallback.h index 26b712e86..4f58aa799 100644 --- a/minecraft/Minecraft.Client/Windows64/XML/xmlFilesCallback.h +++ b/minecraft/Minecraft.Client/Windows64/XML/xmlFilesCallback.h @@ -38,7 +38,7 @@ public: pAttributes[i].ValueLen); } else if (_wcsicmp(wAttName, L"xuid") == 0) { if (pAttributes[i].ValueLen <= 32) { - ZeroMemory(wTemp, sizeof(wchar_t) * 35); + memset(wTemp, 0, sizeof(wchar_t) * 35); wcsncpy_s(wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); xuid = _wcstoui64(wTemp, nullptr, 10); @@ -203,7 +203,7 @@ public: pAttributes[i].NameLen); if (_wcsicmp(wAttName, L"SortIndex") == 0) { if (pAttributes[i].ValueLen <= 32) { - ZeroMemory(wTemp, sizeof(wchar_t) * 35); + memset(wTemp, 0, sizeof(wchar_t) * 35); wcsncpy_s(wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); uiSortIndex = wcstoul(wTemp, nullptr, 16); @@ -215,14 +215,14 @@ public: } } else if (_wcsicmp(wAttName, L"Full") == 0) { if (pAttributes[i].ValueLen <= 32) { - ZeroMemory(wTemp, sizeof(wchar_t) * 35); + memset(wTemp, 0, sizeof(wchar_t) * 35); wcsncpy_s(wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); ullFull = _wcstoui64(wTemp, nullptr, 16); } } else if (_wcsicmp(wAttName, L"Trial") == 0) { if (pAttributes[i].ValueLen <= 32) { - ZeroMemory(wTemp, sizeof(wchar_t) * 35); + memset(wTemp, 0, sizeof(wchar_t) * 35); wcsncpy_s(wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); ullTrial = _wcstoui64(wTemp, nullptr, 16); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/gui/Minimap.cpp b/minecraft/Minecraft.Client/net/minecraft/client/gui/Minimap.cpp index ac0fe229a..2b3a9f6e9 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/gui/Minimap.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/gui/Minimap.cpp @@ -252,7 +252,7 @@ void Minimap::render(std::shared_ptr player, Textures* textures, // DCR: Render the players current position here instead if (player != nullptr) { wchar_t playerPosText[32]; - ZeroMemory(&playerPosText, sizeof(wchar_t) * 32); + memset(&playerPosText, 0, sizeof(wchar_t) * 32); int posx = floor(player->x); int posy = floor(player->y); int posz = floor(player->z); diff --git a/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.cpp b/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.cpp index b7db8acce..e041fefab 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.cpp @@ -99,7 +99,7 @@ void PlayerList::placeNewPlayer(Connection* connection, std::uint8_t playerIndex = 0; { bool usedIndexes[MINECRAFT_NET_MAX_PLAYERS]; - ZeroMemory(&usedIndexes, MINECRAFT_NET_MAX_PLAYERS * sizeof(bool)); + memset(&usedIndexes, 0, MINECRAFT_NET_MAX_PLAYERS * sizeof(bool)); for (auto it = players.begin(); it < players.end(); ++it) { usedIndexes[(int)(*it)->getPlayerIndex()] = true; } diff --git a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 2cd0ff20c..9fe57b6bf 100644 --- a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -505,7 +505,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, // 4J Stu - Saves created between 2/12/2011 and 7/12/2011 will // have this problem app.DebugPrintf("Invalid save data format\n"); - ZeroMemory(pvSaveMem, fileSize); + memset(pvSaveMem, 0, fileSize); // Clear the first 8 bytes that reference the header header.WriteHeader(pvSaveMem); } else { @@ -542,7 +542,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, #if !defined(_CONTENT_PACKAGE) __debugbreak(); #endif - ZeroMemory(pvSaveMem, fileSize); + memset(pvSaveMem, 0, fileSize); // Clear the first 8 bytes that reference the header header.WriteHeader(pvSaveMem); } @@ -1347,7 +1347,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime); PIXEndNamedEvent(); - ZeroMemory(compData, 8); + memset(compData, 0, 8); int saveVer = 0; memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); @@ -1363,7 +1363,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { unsigned int dwDataSizeSaveImage = 0; std::uint8_t bTextMetadata[88]; - ZeroMemory(bTextMetadata, 88); + memset(bTextMetadata, 0, 88); int64_t seed = 0; bool hasSeed = false; diff --git a/minecraft/Minecraft.World/net/minecraft/network/packet/PreLoginPacket.cpp b/minecraft/Minecraft.World/net/minecraft/network/packet/PreLoginPacket.cpp index 1e6e1c20c..8e289b14a 100644 --- a/minecraft/Minecraft.World/net/minecraft/network/packet/PreLoginPacket.cpp +++ b/minecraft/Minecraft.World/net/minecraft/network/packet/PreLoginPacket.cpp @@ -16,7 +16,7 @@ PreLoginPacket::PreLoginPacket() { m_dwPlayerCount = 0; m_friendsOnlyBits = 0; m_ugcPlayersVersion = 0; - ZeroMemory(m_szUniqueSaveName, m_iSaveNameLen); + memset(m_szUniqueSaveName, 0, m_iSaveNameLen); m_serverSettings = 0; m_hostIndex = 0; m_texturePackId = 0; @@ -29,7 +29,7 @@ PreLoginPacket::PreLoginPacket(std::wstring userName) { m_dwPlayerCount = 0; m_friendsOnlyBits = 0; m_ugcPlayersVersion = 0; - ZeroMemory(m_szUniqueSaveName, m_iSaveNameLen); + memset(m_szUniqueSaveName, 0, m_iSaveNameLen); m_serverSettings = 0; m_hostIndex = 0; m_texturePackId = 0; diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/monster/EnderMan.cpp b/minecraft/Minecraft.World/net/minecraft/world/entity/monster/EnderMan.cpp index 077c6a4bc..26165d7c9 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/monster/EnderMan.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/monster/EnderMan.cpp @@ -39,7 +39,7 @@ AttributeModifier* EnderMan::SPEED_MODIFIER_ATTACKING = bool EnderMan::MAY_TAKE[256]; void EnderMan::staticCtor() { - ZeroMemory(MAY_TAKE, sizeof(bool) * 256); + memset(MAY_TAKE, 0, sizeof(bool) * 256); MAY_TAKE[Tile::grass_Id] = true; MAY_TAKE[Tile::dirt_Id] = true; MAY_TAKE[Tile::sand_Id] = true; diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ArmorDyeRecipe.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ArmorDyeRecipe.cpp index dee8ff898..8cea01b71 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ArmorDyeRecipe.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ArmorDyeRecipe.cpp @@ -148,10 +148,10 @@ void ArmorDyeRecipe::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { TempIngReq.iIngValA = new int[3 * 3]; TempIngReq.iIngAuxValA = new int[3 * 3]; - ZeroMemory(TempIngReq.iIngIDA, sizeof(int) * 9); - ZeroMemory(TempIngReq.iIngValA, sizeof(int) * 9); + memset(TempIngReq.iIngIDA, 0, sizeof(int) * 9); + memset(TempIngReq.iIngValA, 0, sizeof(int) * 9); memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9); - ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9); + memset(TempIngReq.uiGridA, 0, sizeof(unsigned int) * 9); pIngReq->iIngIDA = new int[TempIngReq.iIngC]; pIngReq->iIngValA = new int[TempIngReq.iIngC]; diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ShapedRecipy.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ShapedRecipy.cpp index 0e8c7ac12..61babd9d6 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ShapedRecipy.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ShapedRecipy.cpp @@ -129,10 +129,10 @@ void ShapedRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { TempIngReq.iIngValA = new int[9]; TempIngReq.iIngAuxValA = new int[9]; - ZeroMemory(TempIngReq.iIngIDA, sizeof(int) * 9); - ZeroMemory(TempIngReq.iIngValA, sizeof(int) * 9); + memset(TempIngReq.iIngIDA, 0, sizeof(int) * 9); + memset(TempIngReq.iIngValA, 0, sizeof(int) * 9); memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9); - ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9); + memset(TempIngReq.uiGridA, 0, sizeof(unsigned int) * 9); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ShapelessRecipy.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ShapelessRecipy.cpp index 0bdf2a2ff..2d13c13c6 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ShapelessRecipy.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/crafting/ShapelessRecipy.cpp @@ -106,10 +106,10 @@ void ShapelessRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { TempIngReq.iIngValA = new int[3 * 3]; TempIngReq.iIngAuxValA = new int[3 * 3]; - ZeroMemory(TempIngReq.iIngIDA, sizeof(int) * 9); - ZeroMemory(TempIngReq.iIngValA, sizeof(int) * 9); + memset(TempIngReq.iIngIDA, 0, sizeof(int) * 9); + memset(TempIngReq.iIngValA, 0, sizeof(int) * 9); memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9); - ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9); + memset(TempIngReq.uiGridA, 0, sizeof(unsigned int) * 9); auto citEnd = ingredients->end(); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.cpp index 7d986157c..de3e47394 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.cpp @@ -67,7 +67,7 @@ RegionFile::RegionFile(ConsoleSaveFile* saveFile, File* path) { unsigned int numberOfBytesWritten = 0; unsigned int bytesToWrite = 0x1000 - (fileEntry->getFileSize() & 0xfff); std::uint8_t* zeroBytes = new std::uint8_t[bytesToWrite]; - ZeroMemory(zeroBytes, bytesToWrite); + memset(zeroBytes, 0, bytesToWrite); /* the file size is not a multiple of 4KB, grow it */ m_saveFile->writeFile(fileEntry, zeroBytes, bytesToWrite, @@ -455,7 +455,7 @@ void RegionFile::insertInitialSectors() { m_saveFile->setFilePointer(fileEntry, 0, SaveFileSeekOrigin::Begin); unsigned int numberOfBytesWritten = 0; std::uint8_t zeroBytes[SECTOR_BYTES]; - ZeroMemory(zeroBytes, SECTOR_BYTES); + memset(zeroBytes, 0, SECTOR_BYTES); /* we need to write the chunk offset table */ m_saveFile->writeFile(fileEntry, zeroBytes, SECTOR_BYTES, diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 8a8de42eb..2ec852406 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -43,8 +43,8 @@ const std::wstring DirectoryLevelStorage::sc_szPlayerDir(L"players/"); _MapDataMappings::_MapDataMappings() { - ZeroMemory(xuids, sizeof(PlayerUID) * MAXIMUM_MAP_SAVE_DATA); - ZeroMemory(dimensions, sizeof(uint8_t) * (MAXIMUM_MAP_SAVE_DATA / 4)); + memset(xuids, 0, sizeof(PlayerUID) * MAXIMUM_MAP_SAVE_DATA); + memset(dimensions, 0, sizeof(uint8_t) * (MAXIMUM_MAP_SAVE_DATA / 4)); } int _MapDataMappings::getDimension(int id) { @@ -102,8 +102,8 @@ void _MapDataMappings::setMapping(int id, PlayerUID xuid, int dimension) { // Old version the only used 1 bit for dimension indexing _MapDataMappings_old::_MapDataMappings_old() { - ZeroMemory(xuids, sizeof(PlayerUID) * MAXIMUM_MAP_SAVE_DATA); - ZeroMemory(dimensions, sizeof(uint8_t) * (MAXIMUM_MAP_SAVE_DATA / 8)); + memset(xuids, 0, sizeof(PlayerUID) * MAXIMUM_MAP_SAVE_DATA); + memset(dimensions, 0, sizeof(uint8_t) * (MAXIMUM_MAP_SAVE_DATA / 8)); } int _MapDataMappings_old::getDimension(int id) { diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/SignTileEntity.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/SignTileEntity.cpp index 4cd8c2e2b..7cfa29787 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -111,7 +111,7 @@ void SignTileEntity::setChanged() { for (int i = 0; i < MAX_SIGN_LINES; ++i) { wcMessages[i]=new wchar_t [MAX_LINE_LENGTH+1]; - ZeroMemory(wcMessages[i],sizeof(wchar_t)*(MAX_LINE_LENGTH+1)); + memset(wcMessages[i], 0, sizeof(wchar_t)*(MAX_LINE_LENGTH+1)); if(m_wsmessages[i].length()>0) { memcpy(wcMessages[i],m_wsmessages[i].c_str(),m_wsmessages[i].length()*sizeof(wchar_t));