fixes for Code/CryEngine

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
pappeste
2021-06-25 13:28:51 -07:00
committed by Esteban Papp
parent 81d26d322d
commit f6cdcddc52
12 changed files with 18 additions and 16 deletions
@@ -17,6 +17,7 @@
#include <AzCore/Debug/StackTracer.h>
#include <AzCore/Debug/Trace.h>
#include <AzCore/Math/Sfmt.h>
#include <AzCore/Casting/lossy_cast.h>
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<unsigned char>(rand());
srand(0);
TestClass<16>* someObject = aznew TestClass<16>();
+1 -1
View File
@@ -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<uint8>(ort); };
ILINE int ORT() const { return m_ORT; };
ILINE int isORT(int o) const { return (m_ORT == o); };
+2 -2
View File
@@ -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<unsigned char>(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<unsigned char>(nSwap);
}
// Generate the gradient lookup tables
+1 -1
View File
@@ -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<uint8>(stride);
}
@@ -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<char>(i);
// find SoundMood
if (i == ELOCALIZED_COLUMN_SOUNDMOOD)
+1 -1
View File
@@ -1227,7 +1227,7 @@ void CLog::CreateBackupFile() const
while (!fileSystem->Eof(inFileHandle))
{
uint8 c = AZ::IO::GetC(inFileHandle);
uint8 c = static_cast<uint8>(AZ::IO::GetC(inFileHandle));
if (c == '\"')
{
+3 -2
View File
@@ -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;
@@ -44,7 +44,7 @@ bool CSerializeXMLReaderImpl::Value(const char* name, int8& value)
}
else
{
value = temp;
value = static_cast<int8>(temp);
}
return bResult;
}
+1 -1
View File
@@ -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<uint8>(r), static_cast<uint8>(g), static_cast<uint8>(b), static_cast<uint8>(a));
return true;
}
}
@@ -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<uint16>(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<uint16>(nChildCount);
return true;
}
+1 -1
View File
@@ -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<uint8>(r), static_cast<uint8>(g), static_cast<uint8>(b), static_cast<uint8>(a));
return true;
}
}
@@ -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<float>(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<float>(key.mWeights[valIdx]), key.mTime);
valueToKeyDataMap[currentValue].insert(
AZStd::upper_bound(valueToKeyDataMap[currentValue].begin(), valueToKeyDataMap[currentValue].end(),thisKey),
thisKey);