diff --git a/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp b/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp index 3bda826313..2b0e7bee92 100644 --- a/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp +++ b/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace Internal @@ -297,7 +298,7 @@ AZ_POP_DISABLE_WARNING // the overflow guard is generated out of rand, so we set a fixed seed before doing the allocation // to get a deterministic guard srand(0); - const unsigned char expectedInitialGuard = rand(); + const unsigned char expectedInitialGuard = azlossy_cast(rand()); srand(0); TestClass<16>* someObject = aznew TestClass<16>(); diff --git a/Code/Legacy/CryCommon/ISplines.h b/Code/Legacy/CryCommon/ISplines.h index ad59f1328d..2353489163 100644 --- a/Code/Legacy/CryCommon/ISplines.h +++ b/Code/Legacy/CryCommon/ISplines.h @@ -466,7 +466,7 @@ namespace spline ILINE void flag_clr(int flag) { m_flags &= ~flag; }; ILINE int flag(int flag) { return m_flags & flag; }; - ILINE void ORT(int ort) { m_ORT = ort; }; + ILINE void ORT(int ort) { m_ORT = static_cast(ort); }; ILINE int ORT() const { return m_ORT; }; ILINE int isORT(int o) const { return (m_ORT == o); }; diff --git a/Code/Legacy/CryCommon/PNoise3.h b/Code/Legacy/CryCommon/PNoise3.h index 1cb7f0d65b..fe19997ef4 100644 --- a/Code/Legacy/CryCommon/PNoise3.h +++ b/Code/Legacy/CryCommon/PNoise3.h @@ -205,7 +205,7 @@ public: // Initialize the permutation table for(i = 0; i < NOISE_TABLE_SIZE; i++) - m_p[i] = i; + m_p[i] = static_cast(i); for(i = 0; i < NOISE_TABLE_SIZE; i++) { @@ -213,7 +213,7 @@ public: nSwap = m_p[i]; m_p[i] = m_p[j]; - m_p[j] = nSwap; + m_p[j] = static_cast(nSwap); } // Generate the gradient lookup tables diff --git a/Code/Legacy/CryCommon/Vertex.h b/Code/Legacy/CryCommon/Vertex.h index 2e61524cab..b9e0b25d38 100644 --- a/Code/Legacy/CryCommon/Vertex.h +++ b/Code/Legacy/CryCommon/Vertex.h @@ -1037,7 +1037,7 @@ namespace AZ } AZ_Assert(stride < (0x1 << (sizeof(m_stride) * 8)), "Vertex stride is larger than the maximum supported, update the type for m_stride in Vertex.h"); - m_stride = stride; + m_stride = static_cast(stride); } diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index 68a8a6659b..db77eda3e8 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -473,7 +473,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, const char* pFind = strstr(sCellContent.c_str(), sLocalizedColumnNames[i]); if (pFind != 0) { - nCellIndexToType[nCellIndex] = i; + nCellIndexToType[nCellIndex] = static_cast(i); // find SoundMood if (i == ELOCALIZED_COLUMN_SOUNDMOOD) diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index d248274b1d..32d5e995ab 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -1227,7 +1227,7 @@ void CLog::CreateBackupFile() const while (!fileSystem->Eof(inFileHandle)) { - uint8 c = AZ::IO::GetC(inFileHandle); + uint8 c = static_cast(AZ::IO::GetC(inFileHandle)); if (c == '\"') { diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index 36443fb9ee..a69fd348f5 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -2464,8 +2464,9 @@ void CXConsole::DisplayVarValue(ICVar* pVar) sValue += " ("; if (nonAlphaBits != 0) { - char nonAlphaChars[3]; // 1..63 + '\0' - sValue += azitoa(nonAlphaBits, nonAlphaChars, AZ_ARRAY_SIZE(nonAlphaChars), 10); + char nonAlphaChars[3] = { 0 }; // 1..63 + '\0' + azitoa(nonAlphaBits, nonAlphaChars, AZ_ARRAY_SIZE(nonAlphaChars), 10); + sValue += nonAlphaChars; sValue += ", "; } sValue += alphaChars; diff --git a/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp b/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp index e74b457191..841697ecdb 100644 --- a/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp +++ b/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp @@ -44,7 +44,7 @@ bool CSerializeXMLReaderImpl::Value(const char* name, int8& value) } else { - value = temp; + value = static_cast(temp); } return bResult; } diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp index 257fc3ca69..d209478957 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp +++ b/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp @@ -320,7 +320,7 @@ bool CBinaryXmlNode::getAttr(const char* key, ColorB& value) const // If we only found 3 values, a should be unchanged, and still be 255 if (r < 256 && g < 256 && b < 256 && a < 256) { - value = ColorB(r, g, b, a); + value = ColorB(static_cast(r), static_cast(g), static_cast(b), static_cast(a)); return true; } } diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp index a2a35cfe8b..265953850f 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp +++ b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp @@ -244,7 +244,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar nd.nContentStringOffset = nContentStringOffset; nd.nParentIndex = nParentIndex; nd.nFirstAttributeIndex = nFirstAttributeIndex; - nd.nAttributeCount = nAttributeCount; + nd.nAttributeCount = static_cast(nAttributeCount); m_nodes.push_back(nd); } @@ -271,7 +271,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar } } - m_nodes[nIndex].nChildCount = nChildCount; + m_nodes[nIndex].nChildCount = static_cast(nChildCount); return true; } diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index 7a9bb4bc36..adbfcc5f3e 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -641,7 +641,7 @@ bool CXmlNode::getAttr(const char* key, ColorB& value) const // If we only found 3 values, a should be unchanged, and still be 255 if (r < 256 && g < 256 && b < 256 && a < 256) { - value = ColorB(r, g, b, a); + value = ColorB(static_cast(r), static_cast(g), static_cast(b), static_cast(a)); return true; } } diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp index 97b5960a8d..a76cb3531d 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp @@ -49,7 +49,7 @@ namespace AZ double totalFramesAtDefaultTimeStep = totalTicks / AssImpAnimationImporter::s_defaultTimeStepBetweenFrames + 1; if (!AZ::IsClose(totalFramesAtDefaultTimeStep, numKeys, 1)) { - numKeys = AZStd::ceilf(totalFramesAtDefaultTimeStep); + numKeys = AZStd::ceilf(static_cast(totalFramesAtDefaultTimeStep)); } return numKeys; } @@ -620,7 +620,7 @@ namespace AZ for (unsigned int valIdx = 0; valIdx < key.mNumValuesAndWeights; ++valIdx) { int currentValue = key.mValues[valIdx]; - KeyData thisKey(key.mWeights[valIdx], key.mTime); + KeyData thisKey(static_cast(key.mWeights[valIdx]), key.mTime); valueToKeyDataMap[currentValue].insert( AZStd::upper_bound(valueToKeyDataMap[currentValue].begin(), valueToKeyDataMap[currentValue].end(),thisKey), thisKey);