diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp index 6e46b930b6..f358370be5 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp @@ -47,7 +47,7 @@ namespace AZ } auto stackEntry = AZStd::make_shared( - cacheSize, blockSize, aznumeric_caster(hardware.m_maxPhysicalSectorSize), false); + cacheSize, aznumeric_cast(blockSize), aznumeric_cast(hardware.m_maxPhysicalSectorSize), false); stackEntry->SetNext(AZStd::move(parent)); return stackEntry; } diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp index 5b67c8c255..6ec3fb295c 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp @@ -45,7 +45,7 @@ namespace AZ } auto stackEntry = AZStd::make_shared( - cacheSize, blockSize, aznumeric_caster(hardware.m_maxPhysicalSectorSize), m_writeOnlyEpilog); + cacheSize, aznumeric_cast(blockSize), aznumeric_cast(hardware.m_maxPhysicalSectorSize), m_writeOnlyEpilog); stackEntry->SetNext(AZStd::move(parent)); return stackEntry; } diff --git a/Code/Framework/AzCore/AzCore/Math/Aabb.h b/Code/Framework/AzCore/AzCore/Math/Aabb.h index 8d8ded7b2d..488808bc4c 100644 --- a/Code/Framework/AzCore/AzCore/Math/Aabb.h +++ b/Code/Framework/AzCore/AzCore/Math/Aabb.h @@ -43,7 +43,7 @@ namespace AZ static Aabb CreateCenterRadius(const Vector3& center, float radius); //! Creates an AABB which contains the specified points. - static Aabb CreatePoints(const Vector3* pts, int numPts); + static Aabb CreatePoints(const Vector3* pts, size_t numPts); //! Creates an AABB which contains the specified OBB. static Aabb CreateFromObb(const Obb& obb); diff --git a/Code/Framework/AzCore/AzCore/Math/Aabb.inl b/Code/Framework/AzCore/AzCore/Math/Aabb.inl index 5806857bb1..3ce7b99792 100644 --- a/Code/Framework/AzCore/AzCore/Math/Aabb.inl +++ b/Code/Framework/AzCore/AzCore/Math/Aabb.inl @@ -60,10 +60,10 @@ namespace AZ } - AZ_MATH_INLINE Aabb Aabb::CreatePoints(const Vector3* pts, int numPts) + AZ_MATH_INLINE Aabb Aabb::CreatePoints(const Vector3* pts, size_t numPts) { Aabb aabb = Aabb::CreateFromPoint(pts[0]); - for (int i = 1; i < numPts; ++i) + for (size_t i = 1; i < numPts; ++i) { aabb.AddPoint(pts[i]); } diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp index c6fe112c6f..1c472ef901 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp @@ -71,7 +71,7 @@ namespace AZ if (context.ShouldKeepDefaults() || !defaultValue || (valAsByteStream != *static_cast(defaultValue))) { const auto base64ByteStream = AZ::StringFunc::Base64::Encode(valAsByteStream.data(), valAsByteStream.size()); - outputValue.SetString(base64ByteStream.c_str(), base64ByteStream.size(), context.GetJsonAllocator()); + outputValue.SetString(base64ByteStream.c_str(), static_cast(base64ByteStream.size()), context.GetJsonAllocator()); return context.Report(Tasks::WriteValue, Outcomes::Success, "ByteStream successfully stored."); } diff --git a/Code/Legacy/CryCommon/CryArray.h b/Code/Legacy/CryCommon/CryArray.h index 167f1cfb57..b304df28af 100644 --- a/Code/Legacy/CryCommon/CryArray.h +++ b/Code/Legacy/CryCommon/CryArray.h @@ -11,7 +11,7 @@ #define CRYINCLUDE_CRYCOMMON_CRYARRAY_H #pragma once -#include "CryLegacyAllocator.h" +#include //--------------------------------------------------------------------------- // Convenient iteration macros @@ -675,7 +675,7 @@ namespace NArray I capacity() const { - I aligned_bytes = Align(size() * sizeof(T), sizeof(I)); + I aligned_bytes = static_cast(Align(size() * sizeof(T), sizeof(I))); if (m_nSizeCap & nCAP_BIT) { // Capacity stored in word following data @@ -693,7 +693,7 @@ namespace NArray // Store size, and assert against overflow. assert(s <= c); m_nSizeCap = s; - I aligned_bytes = Align(s * sizeof(T), sizeof(I)); + I aligned_bytes = static_cast(Align(s * sizeof(T), sizeof(I))); if (c * sizeof(T) >= aligned_bytes + sizeof(I)) { // Has extra capacity, more than word-alignment diff --git a/Code/Legacy/CryCommon/CryName.h b/Code/Legacy/CryCommon/CryName.h index 0495ad78f1..ce17d1f540 100644 --- a/Code/Legacy/CryCommon/CryName.h +++ b/Code/Legacy/CryCommon/CryName.h @@ -45,7 +45,7 @@ struct INameTable const char* GetStr() { return (char*)(this + 1); } void AddRef() { nRefCount++; /*InterlockedIncrement(&_header()->nRefCount);*/}; int Release() { return --nRefCount; }; - int GetMemoryUsage() { return sizeof(SNameEntry) + strlen(GetStr()); } + int GetMemoryUsage() { return static_cast(sizeof(SNameEntry) + strlen(GetStr())); } int GetLength(){return nLength; } }; @@ -102,14 +102,14 @@ public: if (!pEntry) { // Create a new entry. - unsigned int nLen = strlen(str); - unsigned int allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char); + size_t nLen = strlen(str); + size_t allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char); pEntry = (SNameEntry*)CryModuleMalloc(allocLen); assert(pEntry != NULL); pEntry->nTag = SNameEntry::TAG; pEntry->nRefCount = 0; - pEntry->nLength = nLen; - pEntry->nAllocSize = allocLen; + pEntry->nLength = static_cast(nLen); + pEntry->nAllocSize = static_cast(allocLen); // Copy string to the end of name entry. char* pEntryStr = const_cast(pEntry->GetStr()); memcpy(pEntryStr, str, nLen + 1); @@ -134,7 +134,7 @@ public: int n = 0; for (it = m_nameMap.begin(); it != m_nameMap.end(); it++) { - nSize += strlen(it->first); + nSize += static_cast(strlen(it->first)); nSize += it->second->GetMemoryUsage(); n++; } @@ -149,7 +149,7 @@ public: } virtual int GetNumberOfEntries() { - return m_nameMap.size(); + return static_cast(m_nameMap.size()); } // Log all names inside CryName table. diff --git a/Code/Legacy/CryCommon/CryPodArray.h b/Code/Legacy/CryCommon/CryPodArray.h index ee36750f7f..20693b29ac 100644 --- a/Code/Legacy/CryCommon/CryPodArray.h +++ b/Code/Legacy/CryCommon/CryPodArray.h @@ -159,8 +159,8 @@ public: return numElements != m_elements.size(); } - ILINE int Count() const { return m_elements.size(); } - ILINE unsigned int Size() const { return m_elements.size(); } + ILINE size_t Count() const { return m_elements.size(); } + ILINE size_t Size() const { return m_elements.size(); } ILINE int IsEmpty() const { return m_elements.empty(); } diff --git a/Code/Legacy/CryCommon/CryString.h b/Code/Legacy/CryCommon/CryString.h index 72469e3dca..459e25b63c 100644 --- a/Code/Legacy/CryCommon/CryString.h +++ b/Code/Legacy/CryCommon/CryString.h @@ -1266,7 +1266,7 @@ inline void CryStringT::resize(size_type nCount, value_type _Ch) } else if (nCount < length()) { - _header()->nLength = nCount; + _header()->nLength = static_cast(nCount); m_str[length()] = 0; // Make null terminated string. } } @@ -1971,7 +1971,7 @@ inline CryStringT& CryStringT::erase(size_type nIndex, size_type nCount) _MakeUnique(); size_type nNumToCopy = length() - (nIndex + nCount) + 1; _move(m_str + nIndex, m_str + nIndex + nCount, nNumToCopy); - _header()->nLength = length() - nCount; + _header()->nLength = static_cast(length() - nCount); } return *this; @@ -2013,7 +2013,7 @@ inline CryStringT& CryStringT::insert(size_type nIndex, size_type nCount, _move(m_str + nIndex + nCount, m_str + nIndex, (nNewLength - nIndex - nCount) + 1); _set(m_str + nIndex, ch, nCount); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); CRY_STRING_DEBUG(m_str) return *this; @@ -2050,7 +2050,7 @@ inline CryStringT& CryStringT::insert(size_type nIndex, const_str pstr, si _move(m_str + nIndex + nInsertLength, m_str + nIndex, (nNewLength - nIndex - nInsertLength + 1)); _copy(m_str + nIndex, pstr, nInsertLength); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[length()] = 0; } CRY_STRING_DEBUG(m_str) @@ -2164,7 +2164,7 @@ inline CryStringT& CryStringT::replace(const_str strOld, const_str strNew) } strStart += _strlen(strStart) + 1; } - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); } CRY_STRING_DEBUG(m_str) @@ -2289,7 +2289,7 @@ inline CryStringT& CryStringT::TrimRight(const value_type* sCharSet) // Just shrink length of the string. size_type nNewLength = (size_type)(str - m_str) + 1; // m_str can change in _MakeUnique _MakeUnique(); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[nNewLength] = 0; } @@ -2317,7 +2317,7 @@ inline CryStringT& CryStringT::TrimRight() // Just shrink length of the string. size_type nNewLength = (size_type)(str - m_str) + 1; // m_str can change in _MakeUnique _MakeUnique(); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[nNewLength] = 0; } @@ -2353,7 +2353,7 @@ inline CryStringT& CryStringT::TrimLeft(const value_type* sCharSet) _MakeUnique(); size_type nNewLength = length() - nOff; _move(m_str, m_str + nOff, nNewLength + 1); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[nNewLength] = 0; } @@ -2376,7 +2376,7 @@ inline CryStringT& CryStringT::TrimLeft() _MakeUnique(); size_type nNewLength = length() - nOff; _move(m_str, m_str + nOff, nNewLength + 1); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[nNewLength] = 0; } diff --git a/Code/Legacy/CryCommon/IIndexedMesh.h b/Code/Legacy/CryCommon/IIndexedMesh.h index cb19656e35..87c3df98bd 100644 --- a/Code/Legacy/CryCommon/IIndexedMesh.h +++ b/Code/Legacy/CryCommon/IIndexedMesh.h @@ -2094,7 +2094,7 @@ public: { if (activeStreams & (1U << i)) { - nMeshSize += ((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount(); + nMeshSize += static_cast(((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount()); nMeshSize += TARGET_DEFAULT_ALIGN - (nMeshSize & (TARGET_DEFAULT_ALIGN - 1)); } } diff --git a/Code/Legacy/CryCommon/IShader.h b/Code/Legacy/CryCommon/IShader.h index 3a49e4d1ac..d445c21b1d 100644 --- a/Code/Legacy/CryCommon/IShader.h +++ b/Code/Legacy/CryCommon/IShader.h @@ -1426,9 +1426,9 @@ struct STexSamplerFX SAFE_RELEASE(m_pITarget); } - int Size() + size_t Size() { - int nSize = sizeof(*this); + size_t nSize = sizeof(*this); nSize += m_szName.capacity(); nSize += m_szTexture.capacity(); #if SHADER_REFLECT_TEXTURE_SLOTS @@ -1805,9 +1805,9 @@ struct SEfResTexture return m_Ext.m_pTexModifier; } - int Size() const + size_t Size() const { - int nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt); + size_t nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt); nSize += m_Name.size(); nSize += m_Sampler.Size(); nSize += m_Ext.Size(); @@ -1900,9 +1900,9 @@ struct SBaseShaderResources uint8 m_VoxelCoverage; - int Size() const + size_t Size() const { - int nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam); + size_t nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam); return nSize; } @@ -2032,9 +2032,9 @@ struct SInputShaderResources TexturesResourcesMap m_TexturesResourcesMap; // a map of all textures resources used by the shader by name SDeformInfo m_DeformInfo; - int Size() const + size_t Size() const { - int nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size(); + size_t nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size(); nSize += m_TexturePath.size(); nSize += sizeof(SDeformInfo); diff --git a/Code/Legacy/CryCommon/VectorMap.h b/Code/Legacy/CryCommon/VectorMap.h index 0f2b7e57e4..1a42f0e48f 100644 --- a/Code/Legacy/CryCommon/VectorMap.h +++ b/Code/Legacy/CryCommon/VectorMap.h @@ -408,8 +408,7 @@ typename VectorMap::key_compare VectorMap::key_comp() co template typename VectorMap::iterator VectorMap::lower_bound(const key_type& key) { - int count = 0; - count = m_entries.size(); + int count = static_cast(m_entries.size()); iterator first = m_entries.begin(); iterator last = m_entries.end(); for (; 0 < count; ) @@ -432,8 +431,7 @@ typename VectorMap::iterator VectorMap::lower_bound(cons template typename VectorMap::const_iterator VectorMap::lower_bound(const key_type& key) const { - int count = 0; - count = m_entries.size(); + int count = static_cast(m_entries.size()); const_iterator first = m_entries.begin(); const_iterator last = m_entries.end(); for (; 0 < count; ) diff --git a/Code/Legacy/CryCommon/platform.h b/Code/Legacy/CryCommon/platform.h index b3846b88dd..6aad8dd043 100644 --- a/Code/Legacy/CryCommon/platform.h +++ b/Code/Legacy/CryCommon/platform.h @@ -475,8 +475,6 @@ ILINE DestinationType alias_cast(SourceType pPtr) return conv_union.pDst; } -#include "CryLegacyAllocator.h" - ////////////////////////////////////////////////////////////////////////// #ifndef DEPRECATED #define DEPRECATED diff --git a/Code/Legacy/CrySystem/ConsoleBatchFile.cpp b/Code/Legacy/CrySystem/ConsoleBatchFile.cpp index 6e36780ac0..69bbfc281d 100644 --- a/Code/Legacy/CrySystem/ConsoleBatchFile.cpp +++ b/Code/Legacy/CrySystem/ConsoleBatchFile.cpp @@ -112,7 +112,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename) CryLog("%s \"%s\" found in %s ...", szLog, PathUtil::GetFile(filenameLog.c_str()), PathUtil::GetPath(filenameLog).c_str()); } - int nLen = file.GetLength(); + size_t nLen = file.GetLength(); char* sAllText = new char [nLen + 16]; file.ReadRaw(sAllText, nLen); sAllText[nLen] = '\0'; diff --git a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp index e8cc4d484c..ffaf0e7210 100644 --- a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp +++ b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp @@ -161,7 +161,7 @@ struct SLevelNameAutoComplete : public IConsoleArgumentAutoComplete { AZStd::vector levels; - virtual int GetCount() const { return levels.size(); }; + virtual int GetCount() const { return static_cast(levels.size()); }; virtual const char* GetValue(int nIndex) const { return levels[nIndex].c_str(); }; }; // definition and declaration must be separated for devirtualization diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index ce39f08480..38f8ffc5b6 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -479,7 +479,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, if (i == ELOCALIZED_COLUMN_SOUNDMOOD) { const char* pSoundMoodName = pFind + strlen(sLocalizedColumnNames[i]) + 1; - int nSoundMoodNameLength = sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1; + int nSoundMoodNameLength = static_cast(sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1); if (nSoundMoodNameLength > 0) { SoundMoodIndex[nCellIndex] = pSoundMoodName; @@ -490,7 +490,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, if (i == ELOCALIZED_COLUMN_EVENTPARAMETER) { const char* pParameterName = pFind + strlen(sLocalizedColumnNames[i]) + 1; - int nParameterNameLength = sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1; + int nParameterNameLength = static_cast(sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1); if (nParameterNameLength > 0) { EventParameterIndex[nCellIndex] = pParameterName; @@ -622,7 +622,7 @@ bool CLocalizedStringsManager::InitLocalizationData( CRY_ASSERT(m_tagFileNames.size() < 255); - uint8 curNumTags = m_tagFileNames.size(); + uint8 curNumTags = static_cast(m_tagFileNames.size()); m_tagFileNames[sType].filenames = vEntries; m_tagFileNames[sType].id = curNumTags + 1; @@ -757,7 +757,7 @@ bool CLocalizedStringsManager::ReleaseLocalizationDataByTag( bool bVecEntryErased = false; //Then remove the entries in the storage vector - const uint32 numEntries = m_pLanguage->m_vLocalizedStrings.size(); + const int32 numEntries = static_cast(m_pLanguage->m_vLocalizedStrings.size()); for (int32 i = numEntries - 1; i >= 0; i--) { SLocalizedStringEntry* entry = m_pLanguage->m_vLocalizedStrings[i]; @@ -1405,7 +1405,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, // SoundMood Entries { - pEntry->SoundMoods.resize(SoundMoodValues.size()); + pEntry->SoundMoods.resize(static_cast(SoundMoodValues.size())); if (SoundMoodValues.size() > 0) { std::map::const_iterator itEnd = SoundMoodValues.end(); @@ -1421,7 +1421,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, // EventParameter Entries { - pEntry->EventParameters.resize(EventParameterValues.size()); + pEntry->EventParameters.resize(static_cast(EventParameterValues.size())); if (EventParameterValues.size() > 0) { std::map::const_iterator itEnd = EventParameterValues.end(); @@ -2196,7 +2196,7 @@ int CLocalizedStringsManager::GetLocalizedStringCount() { return 0; } - return m_pLanguage->m_vLocalizedStrings.size(); + return static_cast(m_pLanguage->m_vLocalizedStrings.size()); } ////////////////////////////////////////////////////////////////////////// @@ -2310,10 +2310,10 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr int maxArgUsed = 0; int lastPos = 0; int curPos = 0; - const int sourceLen = sString.length(); + const int sourceLen = static_cast(sString.length()); while (true) { - int foundPos = sString.find(token, curPos); + int foundPos = static_cast(sString.find(token, curPos)); if (foundPos != string::npos) { if (foundPos + 1 < sourceLen) diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index d2d8495063..96bc29b58a 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -484,7 +484,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo break; } - int bufferlen = sizeof(szBuffer) - prefixSize; + int bufferlen = static_cast(sizeof(szBuffer) - prefixSize); if (bufferlen > 0) { #if defined(AZ_RESTRICTED_PLATFORM) diff --git a/Code/Legacy/CrySystem/SimpleStringPool.h b/Code/Legacy/CrySystem/SimpleStringPool.h index ddeca0f44c..d1a618425c 100644 --- a/Code/Legacy/CrySystem/SimpleStringPool.h +++ b/Code/Legacy/CrySystem/SimpleStringPool.h @@ -216,8 +216,8 @@ public: CryFatalError("Can't replace strings in an xml node that reuses strings"); } - int nStrLen1 = strlen(str1); - int nStrLen2 = strlen(str2); + int nStrLen1 = static_cast(strlen(str1)); + int nStrLen2 = static_cast(strlen(str2)); // undo ptr1 add. if (m_ptr != m_start) diff --git a/Code/Legacy/CrySystem/SystemCFG.cpp b/Code/Legacy/CrySystem/SystemCFG.cpp index 719928384b..4ab203ded1 100644 --- a/Code/Legacy/CrySystem/SystemCFG.cpp +++ b/Code/Legacy/CrySystem/SystemCFG.cpp @@ -285,7 +285,7 @@ public: pos = 1; for (;; ) { - pos = szValue.find_first_of("\\", pos); + pos = static_cast(szValue.find_first_of("\\", pos)); if (pos == string::npos) { @@ -300,7 +300,7 @@ public: pos = 1; for (;; ) { - pos = szValue.find_first_of("\"", pos); + pos = static_cast(szValue.find_first_of("\"", pos)); if (pos == string::npos) { @@ -414,7 +414,7 @@ bool CSystemConfiguration::ParseSystemConfig() INDENT_LOG_DURING_SCOPE(); - int nLen = file.GetLength(); + int nLen = static_cast(file.GetLength()); if (nLen == 0) { CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "Couldn't get length for Config file %s", filename.c_str()); diff --git a/Code/Legacy/CrySystem/ViewSystem/View.cpp b/Code/Legacy/CrySystem/ViewSystem/View.cpp index ef9f2591c4..e6e9f7a984 100644 --- a/Code/Legacy/CrySystem/ViewSystem/View.cpp +++ b/Code/Legacy/CrySystem/ViewSystem/View.cpp @@ -173,7 +173,7 @@ void CView::SetViewShakeEx(const SShakeParams& params) return; } - int shakes(m_shakes.size()); + int shakes = static_cast(m_shakes.size()); SShake* pSetShake(NULL); for (int i = 0; i < shakes; ++i) @@ -250,7 +250,7 @@ void CView::ProcessShaking(float frameTime) m_viewParams.shakingRatio = 0; m_viewParams.groundOnly = false; - int shakes(m_shakes.size()); + int shakes = static_cast(m_shakes.size()); for (int i = 0; i < shakes; ++i) { ProcessShake(&m_shakes[i], frameTime); @@ -556,7 +556,7 @@ void CView::ProcessShakeNormal_DoShaking(SShake* pShake, float frameTime) //------------------------------------------------------------------------ void CView::StopShake(int shakeID) { - uint32 num = m_shakes.size(); + uint32 num = static_cast(m_shakes.size()); for (uint32 i = 0; i < num; ++i) { if (m_shakes[i].ID == shakeID && m_shakes[i].updating) diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index 09b3182c04..a2f3426d5c 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -1341,7 +1341,7 @@ bool CXConsole::ProcessInput(const AzFramework::InputChannel& inputChannel) { if (isCtrlModifierActive) { - m_nScrollLine = m_dqConsoleBuffer.size() - 1; + m_nScrollLine = static_cast(m_dqConsoleBuffer.size() - 1); } else { @@ -1454,7 +1454,7 @@ bool CXConsole::GetLineNo(const int indwLineNo, char* outszBuffer, const int ind ////////////////////////////////////////////////////////////////////////// int CXConsole::GetLineCount() const { - return m_dqConsoleBuffer.size(); + return static_cast(m_dqConsoleBuffer.size()); } ////////////////////////////////////////////////////////////////////////// @@ -2675,7 +2675,7 @@ void CXConsole::RemoveOutputPrintSink(IOutputPrintSink* inpSink) { assert(inpSink); - int nCount = m_OutputSinks.size(); + int nCount = static_cast(m_OutputSinks.size()); for (int i = 0; i < nCount; i++) { @@ -2965,7 +2965,7 @@ bool CXConsole::IsHashCalculated() ////////////////////////////////////////////////////////////////////////// int CXConsole::GetNumCheatVars() { - return m_randomCheckedVariables.size(); + return static_cast(m_randomCheckedVariables.size()); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Legacy/CrySystem/XConsole.h b/Code/Legacy/CrySystem/XConsole.h index eca52771dd..1fee015f22 100644 --- a/Code/Legacy/CrySystem/XConsole.h +++ b/Code/Legacy/CrySystem/XConsole.h @@ -70,7 +70,7 @@ struct CConsoleCommandArgs CConsoleCommandArgs(string& line, std::vector& args) : m_line(line) , m_args(args) {}; - virtual int GetArgCount() const { return m_args.size(); }; + virtual int GetArgCount() const { return static_cast(m_args.size()); }; // Get argument by index, nIndex must be in 0 <= nIndex < GetArgCount() virtual const char* GetArg(int nIndex) const { diff --git a/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp b/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp index 2a532befd3..def45f27de 100644 --- a/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp +++ b/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp @@ -190,8 +190,9 @@ bool SaveArray(const IdTable& idTable, XmlNodeRef& definition, XmlNodeRef& data, } bool needIndex = false; - for (size_t i = 1; i <= numElems; i++) + for (size_t sizei = 1; sizei <= numElems; sizei++) { + const int i = static_cast(sizei); if (!childSource->HaveElemAt(i)) { needIndex = true; diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp index 60e0d2e4f1..1500717ddc 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp +++ b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp @@ -114,26 +114,26 @@ bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node, nTheoreticalPosition += sizeof(header); align(nTheoreticalPosition, nAlignment); - header.nNodeTablePosition = nTheoreticalPosition; + header.nNodeTablePosition = static_cast(nTheoreticalPosition); header.nNodeCount = int(m_nodes.size()); nTheoreticalPosition += header.nNodeCount * sizeof(Node); align(nTheoreticalPosition, nAlignment); - header.nChildTablePosition = nTheoreticalPosition; + header.nChildTablePosition = static_cast(nTheoreticalPosition); header.nChildCount = int(m_childs.size()); nTheoreticalPosition += header.nChildCount * sizeof(NodeIndex); align(nTheoreticalPosition, nAlignment); - header.nAttributeTablePosition = nTheoreticalPosition; + header.nAttributeTablePosition = static_cast(nTheoreticalPosition); header.nAttributeCount = int(m_attributes.size()); nTheoreticalPosition += header.nAttributeCount * sizeof(Attribute); align(nTheoreticalPosition, nAlignment); - header.nStringDataPosition = nTheoreticalPosition; + header.nStringDataPosition = static_cast(nTheoreticalPosition); header.nStringDataSize = m_nStringDataSize; nTheoreticalPosition += header.nStringDataSize; - header.nXMLSize = nTheoreticalPosition; + header.nXMLSize = static_cast(nTheoreticalPosition); // Swap endianness of the data structures if (bNeedSwapEndian) @@ -328,7 +328,7 @@ int XMLBinary::CXMLBinaryWriter::AddString(const XmlString& sString) // We don't have such string yet, so we should add it to the tables. m_strings.push_back(sString); itStringEntry = m_stringMap.insert(StringMap::value_type(sString, m_nStringDataSize)).first; - m_nStringDataSize += sString.length() + 1; + m_nStringDataSize += static_cast(sString.length() + 1); } // Return offset of the string in the string data buffer. diff --git a/Code/Legacy/CrySystem/XML/XmlUtils.cpp b/Code/Legacy/CrySystem/XML/XmlUtils.cpp index 1b341ee99e..16ddc6c992 100644 --- a/Code/Legacy/CrySystem/XML/XmlUtils.cpp +++ b/Code/Legacy/CrySystem/XML/XmlUtils.cpp @@ -91,7 +91,7 @@ XmlNodeRef CXmlUtils::LoadXmlFromFile(const char* sFilename, bool bReuseStrings, XmlNodeRef CXmlUtils::LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings, bool bSuppressWarnings) { XmlParser parser(bReuseStrings); - XmlNodeRef node = parser.ParseBuffer(buffer, size, true, bSuppressWarnings); + XmlNodeRef node = parser.ParseBuffer(buffer, static_cast(size), true, bSuppressWarnings); return node; } @@ -111,7 +111,7 @@ const char* CXmlUtils::HashXml(XmlNodeRef node) static char temp[16]; static const char* hex = "0123456789abcdef"; XmlString str = node->getXML(); - GetMD5(str.data(), str.length(), temp); + GetMD5(str.data(), static_cast(str.length()), temp); for (int i = 0; i < 16; i++) { signature[2 * i + 0] = hex[((uint8)temp[i]) >> 4]; diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index 5761d8a963..0493a64ca8 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -655,7 +655,7 @@ XmlNodeRef CXmlNode::findChild(const char* tag) const if (m_pChilds) { XmlNodes& childs = *m_pChilds; - for (int i = 0, num = childs.size(); i < num; ++i) + for (int i = 0, num = static_cast(childs.size()); i < num; ++i) { if (childs[i]->isTag(tag)) { @@ -690,7 +690,7 @@ void CXmlNode::deleteChild(const char* tag) if (m_pChilds) { XmlNodes& childs = *m_pChilds; - for (int i = 0, num = childs.size(); i < num; ++i) + for (int i = 0, num = static_cast(childs.size()); i < num; ++i) { if (childs[i]->isTag(tag)) { @@ -913,7 +913,7 @@ XmlNodeRef CXmlNode::clone() node->m_pChilds = new XmlNodes; node->m_pChilds->reserve(childs.size()); - for (int i = 0, num = childs.size(); i < num; ++i) + for (int i = 0, num = static_cast(childs.size()); i < num; ++i) { node->addChild(childs[i]->clone()); } @@ -956,7 +956,7 @@ static void AddTabsToString(XmlString& xml, int level) ////////////////////////////////////////////////////////////////////////// bool CXmlNode::IsValidXmlString(const char* str) const { - int len = strlen(str); + int len = static_cast(strlen(str)); { // Prevents invalid characters not from standard ASCII set to propagate to xml. @@ -1432,7 +1432,7 @@ protected: void XmlParserImp::CleanStack() { m_nNodeStackTop = 0; - for (int i = 0, num = m_nodeStack.size(); i < num; i++) + for (int i = 0, num = static_cast(m_nodeStack.size()); i < num; i++) { m_nodeStack[i].node = 0; m_nodeStack[i].childs.resize(0); diff --git a/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp b/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp index 24faf2ccaa..d4ef5b3ba8 100644 --- a/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp +++ b/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp @@ -323,7 +323,7 @@ bool SRemoteServer::ReadBuffer(const char* buffer, int data) } // Advance to the next null terminated string in the buffer - const int currentSize = strnlen(curBuffer, bytesRemaining); + const int currentSize = static_cast(strnlen(curBuffer, bytesRemaining)); bytesRemaining -= currentSize + 1; curBuffer += currentSize + 1; } @@ -466,7 +466,7 @@ void SRemoteClient::FillAutoCompleteList(AZStd::vector& list) AZStd::string item = "map "; const char* levelName = pLevel->GetName(); int start = 0; - for (int k = 0, kend = strlen(levelName); k < kend; ++k) + for (int k = 0, kend = static_cast(strlen(levelName)); k < kend; ++k) { if ((levelName[k] == '\\' || levelName[k] == '/') && k + 1 < kend) {