more fixes for w4267

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-07-27 19:11:22 -07:00
parent 95914e3fd6
commit 074e33081f
9 changed files with 16 additions and 16 deletions
@@ -122,7 +122,7 @@ protected:
public:
//! Get number of child nodes.
int GetChildCount() const { return m_childs.size(); };
int GetChildCount() const { return static_cast<int>(m_childs.size()); };
//! Get Child by id.
ReflectedPropertyItem* GetChild(int index) const { return m_childs[index]; }
PropertyType GetType() const { return m_type; }
@@ -803,7 +803,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu)
menu->addSeparator();
const int selectedLayerCount = layersInSelection.size();
const int selectedLayerCount = static_cast<int>(layersInSelection.size());
QString saveTitle = QObject::tr("Save layer");
if(selectedLayerCount > 1)
{
@@ -259,7 +259,7 @@ QVariant OutlinerListModel::dataForName(const QModelIndex& index, int role) cons
if (highlightTextIndex >= 0)
{
const QString BACKGROUND_COLOR{ "#707070" };
label.insert(highlightTextIndex + m_filterString.length(), "</span>");
label.insert(static_cast<int>(highlightTextIndex + m_filterString.length()), "</span>");
label.insert(highlightTextIndex, "<span style=\"background-color: " + BACKGROUND_COLOR + "\">");
}
} while(highlightTextIndex > 0);
@@ -51,7 +51,7 @@ protected:
TEST_F(AWSScriptBehaviorsComponentTest, Reflect)
{
int oldEBusNum = m_behaviorContext->m_ebuses.size();
int oldEBusNum = static_cast<int>(m_behaviorContext->m_ebuses.size());
m_componentDescriptor.reset(AWSScriptBehaviorsComponent::CreateDescriptor());
m_componentDescriptor->Reflect(m_serializeContext.get());
m_componentDescriptor->Reflect(m_behaviorContext.get());
@@ -196,13 +196,13 @@ namespace AZ
{
const size_t sourceByteSize = source.size() * sizeof(AuxGeomIndex);
RHI::Ptr<RPI::DynamicBuffer> dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(sourceByteSize);
RHI::Ptr<RPI::DynamicBuffer> dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(static_cast<uint32_t>(sourceByteSize));
if (!dynamicBuffer)
{
AZ_WarningOnce("AuxGeom", false, "Failed to allocate dynamic buffer of size %d.", sourceByteSize);
return false;
}
dynamicBuffer->Write(source.data(), sourceByteSize);
}
dynamicBuffer->Write(source.data(), static_cast<uint32_t>(sourceByteSize));
group.m_indexBufferView = dynamicBuffer->GetIndexBufferView(RHI::IndexFormat::Uint32);
return true;
}
@@ -211,13 +211,13 @@ namespace AZ
{
const size_t sourceByteSize = source.size() * sizeof(AuxGeomDynamicVertex);
RHI::Ptr<RPI::DynamicBuffer> dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(sourceByteSize);
RHI::Ptr<RPI::DynamicBuffer> dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(static_cast<uint32_t>(sourceByteSize));
if (!dynamicBuffer)
{
AZ_WarningOnce("AuxGeom", false, "Failed to allocate dynamic buffer of size %d.", sourceByteSize);
return false;
}
dynamicBuffer->Write(source.data(), sourceByteSize);
}
dynamicBuffer->Write(source.data(), static_cast<uint32_t>(sourceByteSize));
group.m_streamBufferViews[0] = dynamicBuffer->GetStreamBufferView(sizeof(AuxGeomDynamicVertex));
return true;
}
@@ -54,7 +54,7 @@ namespace BarrierInput
int ReadU8() { int ret = data[0]; data += 1; return ret; }
void Eat(int len) { data += len; }
void InsertString(const char* str) { int len = strlen(str); memcpy(end, str, len); end += len; }
void InsertString(const char* str) { int len = static_cast<int>(strlen(str)); memcpy(end, str, len); end += len; }
void InsertU32(int a) { end[0] = a >> 24; end[1] = a >> 16; end[2] = a >> 8; end[3] = a; end += 4; }
void InsertU16(int a) { end[0] = a >> 8; end[1] = a; end += 2; }
void InsertU8(int a) { end[0] = a; end += 1; }
@@ -93,7 +93,7 @@ namespace BarrierInput
stream.InsertString("Barrier");
stream.InsertU16(1);
stream.InsertU16(4);
stream.InsertU32(pContext->GetClientScreenName().length());
stream.InsertU32(static_cast<int>(pContext->GetClientScreenName().length()));
stream.InsertString(pContext->GetClientScreenName().c_str());
stream.ClosePacket();
return barrierSendFunc(pContext, stream.GetBuffer(), stream.GetLength());
@@ -268,7 +268,7 @@ namespace BarrierInput
int i;
for (i = 0; i < numPackets; ++i)
{
const int len = strlen(s_packets[i].pattern);
const int len = static_cast<int>(strlen(s_packets[i].pattern));
if (packetLength >= len && memcmp(stream.GetData(), s_packets[i].pattern, len) == 0)
{
bool bDone = false;
@@ -102,7 +102,7 @@ namespace Camera
int CameraListModel::rowCount([[maybe_unused]] const QModelIndex& parent) const
{
return m_cameraItems.size();
return static_cast<int>(m_cameraItems.size());
}
QVariant CameraListModel::data(const QModelIndex& index, int role) const
@@ -401,7 +401,7 @@ namespace LmbrCentral
// 2 verts for each segment
// loops == sides
// 2 loops per segment
const AZ::u32 segments = segmentCount * spline->GetSegmentGranularity();
const AZ::u32 segments = static_cast<AZ::u32>(segmentCount * spline->GetSegmentGranularity());
const AZ::u32 totalEndSegments = capSegments * 2 * 2 * 2 * 2;
const AZ::u32 totalSegments = segments * 2 * 2 * 2;
const AZ::u32 totalLoops = 2 * sides * segments * 2;
@@ -161,7 +161,7 @@ namespace PhysX
// Add it to the list otherwise
sourceSceneMaterialNames.push_back(materialName);
AZ::u16 newIndex = sourceSceneMaterialNames.size() - 1;
AZ::u16 newIndex = static_cast<AZ::u16>(sourceSceneMaterialNames.size() - 1);
materialIndexByName[materialName] = newIndex;
return newIndex;