Enable warning MSVC 4296: 'operator': expression is always false

This commit is contained in:
Esteban Papp
2021-08-20 13:42:19 -07:00
committed by GitHub
41 changed files with 94 additions and 109 deletions
-1
View File
@@ -2634,7 +2634,6 @@ void EditorViewportWidget::ShowCursor()
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::PushDisableRendering()
{
assert(m_disableRenderingCount >= 0);
++m_disableRenderingCount;
}
+2 -2
View File
@@ -2038,7 +2038,7 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
//////////////////////////////////////////////////////////////////////////
CBaseObject* CBaseObject::GetChild(size_t const i) const
{
assert(i >= 0 && i < m_childs.size());
assert(i < m_childs.size());
return m_childs[i];
}
@@ -2729,7 +2729,7 @@ void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren)
// Set min spec for all childs.
if (bSetChildren)
{
for (size_t i = m_childs.size() - 1; i >= 0; --i)
for (int i = static_cast<int>(m_childs.size()) - 1; i >= 0; --i)
{
m_childs[i]->SetMinSpec(nSpec, true);
}
+1 -1
View File
@@ -1416,7 +1416,7 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx
void CEntityObject::ResolveEventTarget(CBaseObject* object, unsigned int index)
{
// Find target id.
assert(index >= 0 && index < m_eventTargets.size());
assert(index < m_eventTargets.size());
if (object)
{
object->AddEventListener(this);
+1 -1
View File
@@ -49,7 +49,7 @@ public:
}
void Undo(bool bUndo) override
{
for (size_t i = m_undoSteps.size() - 1; i >= 0; i--)
for (int i = static_cast<int>(m_undoSteps.size()) - 1; i >= 0; i--)
{
m_undoSteps[i]->Undo(bUndo);
}
+15 -25
View File
@@ -58,36 +58,26 @@ bool C3DConnexionDriver::InitDevice()
//Doc says RIM_TYPEHID: Data comes from an HID that is not a keyboard or a mouse.
if (m_pRawInputDeviceList[i].dwType == RIM_TYPEHID)
{
UINT nchars = 300;
TCHAR deviceName[300];
if (GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice,
RIDI_DEVICENAME, deviceName, &nchars) >= 0)
{
//_RPT3(_CRT_WARN, "Device[%d]: handle=0x%x name = %S\n", i, g_pRawInputDeviceList[i].hDevice, deviceName);
}
RID_DEVICE_INFO dinfo;
UINT sizeofdinfo = sizeof(dinfo);
dinfo.cbSize = sizeofdinfo;
if (GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice,
RIDI_DEVICEINFO, &dinfo, &sizeofdinfo) >= 0)
GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice,
RIDI_DEVICEINFO, &dinfo, &sizeofdinfo);
if (dinfo.dwType == RIM_TYPEHID)
{
if (dinfo.dwType == RIM_TYPEHID)
RID_DEVICE_INFO_HID* phidInfo = &dinfo.hid;
// Add this one to the list of interesting devices?
// Actually only have to do this once to get input from all usage 1, usagePage 8 devices
// This just keeps out the other usages.
// You might want to put up a list for users to select amongst the different devices.
// In particular, to assign separate functionality to the different devices.
if (phidInfo->usUsagePage == 1 && phidInfo->usUsage == 8)
{
RID_DEVICE_INFO_HID* phidInfo = &dinfo.hid;
// Add this one to the list of interesting devices?
// Actually only have to do this once to get input from all usage 1, usagePage 8 devices
// This just keeps out the other usages.
// You might want to put up a list for users to select amongst the different devices.
// In particular, to assign separate functionality to the different devices.
if (phidInfo->usUsagePage == 1 && phidInfo->usUsage == 8)
{
m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsagePage = phidInfo->usUsagePage;
m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsage = phidInfo->usUsage;
m_pRawInputDevices[m_nUsagePage1Usage8Devices].dwFlags = 0;
m_pRawInputDevices[m_nUsagePage1Usage8Devices].hwndTarget = nullptr;
m_nUsagePage1Usage8Devices++;
}
m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsagePage = phidInfo->usUsagePage;
m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsage = phidInfo->usUsage;
m_pRawInputDevices[m_nUsagePage1Usage8Devices].dwFlags = 0;
m_pRawInputDevices[m_nUsagePage1Usage8Devices].hwndTarget = nullptr;
m_nUsagePage1Usage8Devices++;
}
}
}
+1 -1
View File
@@ -467,7 +467,7 @@ bool CKDTree::FindNearestVertexRecursively(KDTreeNode* pNode, const Vec3& raySrc
uint32 nVertexIndex = pNode->GetVertexIndex(i);
uint32 nObjIndex = pNode->GetObjIndex(i);
assert(nObjIndex < m_StatObjectList.size() && nObjIndex >= 0);
assert(nObjIndex < m_StatObjectList.size());
const SStatObj* pStatObjInfo = &(m_StatObjectList[nObjIndex]);
+2
View File
@@ -769,7 +769,9 @@ namespace
void PySetViewPaneLayout(unsigned int layoutId)
{
AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option")
if ((layoutId >= ET_Layout0) && (layoutId <= ET_Layout8))
AZ_POP_DISABLE_WARNING
{
CLayoutWnd* layout = GetIEditor()->GetViewManager()->GetLayout();
if (layout)
@@ -49,7 +49,7 @@ namespace AZ::Platform
AZ_Assert(m_events[0], "There is no synchronization event created for the main streamer thread to use to suspend.");
DWORD result = ::WaitForMultipleObjects(m_handleCount, m_events, false, INFINITE);
if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + m_handleCount)
if (result < WAIT_OBJECT_0 + m_handleCount)
{
DWORD index = result - WAIT_OBJECT_0;
::ResetEvent(m_events[index]);
@@ -36,12 +36,23 @@ using namespace UnitTestInternal;
/**
* Validate a vector for certain number of elements.
*/
#define AZ_TEST_VALIDATE_VECTOR(_Vector, _NumElements) \
EXPECT_TRUE(_Vector.validate()); \
EXPECT_EQ(_NumElements, _Vector.size()); \
EXPECT_TRUE((_NumElements > 0) ? !_Vector.empty() : _Vector.empty()); \
EXPECT_TRUE((_NumElements > 0) ? _Vector.capacity() >= _NumElements : true); \
EXPECT_TRUE((_NumElements > 0) ? _Vector.begin() != _Vector.end() : _Vector.begin() == _Vector.end()); \
#define AZ_TEST_VALIDATE_VECTOR(_Vector, _NumElements) \
EXPECT_NE(_NumElements, 0); \
EXPECT_TRUE(_Vector.validate()); \
EXPECT_EQ(_NumElements, _Vector.size()); \
EXPECT_TRUE(!_Vector.empty()); \
EXPECT_TRUE(_Vector.capacity() >= _NumElements); \
EXPECT_TRUE(_Vector.begin() != _Vector.end()); \
EXPECT_NE(nullptr, _Vector.data())
/**
* Validate a vector for 0 number of elements. The above macro creates expressions that are always true for size == 0
*/
#define AZ_TEST_VALIDATE_VECTOR_0(_Vector) \
EXPECT_TRUE(_Vector.validate()); \
EXPECT_EQ(0, _Vector.size()); \
EXPECT_TRUE(_Vector.empty()); \
EXPECT_TRUE(_Vector.begin() == _Vector.end()); \
EXPECT_NE(nullptr, _Vector.data())
namespace UnitTest
@@ -312,7 +323,7 @@ namespace UnitTest
// erase
int_vector1.erase(int_vector1.begin(), int_vector1.end());
AZ_TEST_VALIDATE_VECTOR(int_vector1, 0); // Zero elements but valid capacity.
AZ_TEST_VALIDATE_VECTOR_0(int_vector1); // Zero elements but valid capacity.
int_vector1.push_back(10);
int_vector1.push_back(20);
@@ -324,11 +335,11 @@ namespace UnitTest
// clear
int_vector1.clear();
AZ_TEST_VALIDATE_VECTOR(int_vector1, 0); // Zero elements but valid capacity.
AZ_TEST_VALIDATE_VECTOR_0(int_vector1); // Zero elements but valid capacity.
// swap
int_vector1.swap(int_vector);
AZ_TEST_VALIDATE_VECTOR(int_vector, 0);
AZ_TEST_VALIDATE_VECTOR_0(int_vector);
AZ_TEST_VALIDATE_VECTOR(int_vector1, 33);
AZ_TEST_ASSERT(int_vector1.front() == 55);
@@ -524,11 +535,11 @@ namespace UnitTest
// Default vector (integral type).
fixed_vector<int, 50> int_vector_default;
AZ_TEST_VALIDATE_VECTOR(int_vector_default, 0);
AZ_TEST_VALIDATE_VECTOR_0(int_vector_default);
// Default vector (non-integral type).
fixed_vector<MyClass, 10> myclass_vector_default;
AZ_TEST_VALIDATE_VECTOR(myclass_vector_default, 0);
AZ_TEST_VALIDATE_VECTOR_0(myclass_vector_default);
// Create a vector (using fill ctor, with memset optimization to set the values)
typedef fixed_vector<char, 10> char_10_type;
@@ -633,7 +644,7 @@ namespace UnitTest
// erase
int_vector1.erase(int_vector1.begin(), int_vector1.end());
AZ_TEST_VALIDATE_VECTOR(int_vector1, 0);
AZ_TEST_VALIDATE_VECTOR_0(int_vector1);
int_vector1.push_back(10);
int_vector1.push_back(20);
@@ -645,11 +656,11 @@ namespace UnitTest
// clear
int_vector1.clear();
AZ_TEST_VALIDATE_VECTOR(int_vector1, 0);
AZ_TEST_VALIDATE_VECTOR_0(int_vector1);
// swap
int_vector1.swap(int_vector);
AZ_TEST_VALIDATE_VECTOR(int_vector, 0);
AZ_TEST_VALIDATE_VECTOR_0(int_vector);
AZ_TEST_VALIDATE_VECTOR(int_vector1, 33);
AZ_TEST_ASSERT(int_vector1.front() == 55);
@@ -963,7 +974,7 @@ namespace UnitTest
AZ_TEST_VALIDATE_VECTOR(deep_vec_2, 12);
deep_vec_2.clear();
AZ_TEST_VALIDATE_VECTOR(deep_vec_2, 0);
AZ_TEST_VALIDATE_VECTOR_0(deep_vec_2);
}
#endif // AZ_UNIT_TEST_SKIP_STD_VECTOR_AND_ARRAY_TESTS
@@ -1081,16 +1081,6 @@ namespace AZ
return ResultCode::Error;
}
//bound check
//note that seeking beyond end or before beginning is system dependent
//therefore we will define that on all platforms it is not allowed
if (newFilePosition < 0)
{
AZ_TracePrintf(RemoteFileIOChannel, "RemoteFileIO::Seek(fileHandle=%u, offset=%i, type=%s) seek to a position before the begining of a file!", fileHandle, offset, type == SeekType::SeekFromCurrent ? "SeekFromCurrent" : type == SeekType::SeekFromEnd ? "SeekFromEnd" : type == SeekType::SeekFromStart ? "SeekFromStart" : "Unknown");
REMOTEFILE_LOG_APPEND(AZStd::string::format("RemoteFileIO::Seek(fileHandle=%u, offset=%i, type=%s) seek to a position before the begining of a file!", fileHandle, offset, type == SeekType::SeekFromCurrent ? "SeekFromCurrent" : type == SeekType::SeekFromEnd ? "SeekFromEnd" : type == SeekType::SeekFromStart ? "SeekFromStart" : "Unknown").c_str());
newFilePosition = 0;
}
else
{
AZ::u64 fileSize = 0;
Size(fileHandle, fileSize);
+1 -1
View File
@@ -745,7 +745,7 @@ private:
void Update()
{
if (m_index >= 0 && m_index < m_parentNode->getChildCount())
if (m_index < m_parentNode->getChildCount())
{
m_currentChildNode = m_parentNode->getChild(static_cast<int>(m_index));
}
@@ -197,11 +197,11 @@ namespace AssetProcessor
m_jobsInFlight.insert(rcJob);
for(size_t jobIndex = m_jobs.size() - 1; jobIndex >= 0; --jobIndex)
for(int jobIndex = static_cast<int>(m_jobs.size()) - 1; jobIndex >= 0; --jobIndex)
{
if(m_jobs[jobIndex] == rcJob)
{
Q_EMIT dataChanged(index(aznumeric_caster(jobIndex), 0, QModelIndex()), index(aznumeric_caster(jobIndex), 0, QModelIndex()));
Q_EMIT dataChanged(index(jobIndex, 0, QModelIndex()), index(jobIndex, 0, QModelIndex()));
return;
}
}
@@ -240,7 +240,7 @@ namespace AssetProcessor
foundInQueue = m_jobsInQueueLookup.erase(foundInQueue);
}
for (size_t jobIndex = m_jobs.size() - 1; jobIndex >= 0; --jobIndex)
for (int jobIndex = static_cast<int>(m_jobs.size()) - 1; jobIndex >= 0; --jobIndex)
{
if(m_jobs[jobIndex] == rcJob)
{
@@ -251,7 +251,7 @@ namespace AssetProcessor
#if defined(DEBUG_RCJOB_MODEL)
AZ_TracePrintf(AssetProcessor::DebugChannel, "JobTrace =>JobCompleted(%i %s,%s,%s)\n", rcJob, rcJob->GetJobEntry().m_databaseSourceName.toUtf8().constData(), rcJob->GetPlatformInfo().m_identifier.c_str(), rcJob->GetJobKey().toUtf8().constData());
#endif
beginRemoveRows(QModelIndex(), aznumeric_caster(jobIndex), aznumeric_caster(jobIndex));
beginRemoveRows(QModelIndex(), jobIndex, jobIndex);
m_jobs.erase(m_jobs.begin() + jobIndex);
endRemoveRows();
@@ -52,7 +52,6 @@ namespace AssetProcessor
SizeType finalPosition = GenericStream::ComputeSeekPosition(bytes, mode);
AZ_Assert(finalPosition < INT_MAX, "Overflow of SizeType to int in ByteArrayStream.");
AZ_Assert(finalPosition >= 0, "underflow in seek in ByteArrayStream");
AZ_Assert(finalPosition <= m_activeArray->size(), "You cant seek beyond end of file");
// safety clamp!
@@ -72,11 +72,6 @@ namespace AssetUtilsInternal
bool FileCopyMoveWithTimeout(QString sourceFile, QString outputFile, bool isCopy, unsigned int waitTimeInSeconds)
{
if (waitTimeInSeconds < 0)
{
AZ_Warning("Asset Processor", waitTimeInSeconds >= 0, "Invalid timeout specified by the user");
waitTimeInSeconds = 0;
}
bool failureOccurredOnce = false; // used for logging.
bool operationSucceeded = false;
QFile outFile(outputFile);
@@ -173,10 +173,7 @@ namespace AreaChart
void AreaChart::ConfigureVerticalAxis(QString label, unsigned int minimumHeight)
{
if (minimumHeight >= 0)
{
SetMinimumValueRange(minimumHeight);
}
SetMinimumValueRange(minimumHeight);
if (m_verticalAxis == nullptr)
{
@@ -323,7 +320,7 @@ namespace AreaChart
// Need to handle the areas right at the edge of the polygons
for (int i = -1; i <= 1; ++i)
{
if ((counter+i) < 0 || (counter + i) >= m_hitAreas.size())
if ((counter + i) >= m_hitAreas.size())
{
continue;
}
@@ -90,7 +90,7 @@ namespace AWSGameLift
{
auto gameliftCreateSessionRequest = azrtti_cast<const AWSGameLiftCreateSessionRequest*>(&createSessionRequest);
return gameliftCreateSessionRequest && gameliftCreateSessionRequest->m_maxPlayer >= 0 &&
return gameliftCreateSessionRequest &&
(!gameliftCreateSessionRequest->m_aliasId.empty() || !gameliftCreateSessionRequest->m_fleetId.empty());
}
} // namespace CreateSessionActivity
@@ -79,7 +79,7 @@ namespace AWSGameLift
auto gameliftCreateSessionOnQueueRequest =
azrtti_cast<const AWSGameLiftCreateSessionOnQueueRequest*>(&createSessionRequest);
return gameliftCreateSessionOnQueueRequest && gameliftCreateSessionOnQueueRequest->m_maxPlayer >= 0 &&
return gameliftCreateSessionOnQueueRequest &&
!gameliftCreateSessionOnQueueRequest->m_queueName.empty() && !gameliftCreateSessionOnQueueRequest->m_placementId.empty();
}
} // namespace CreateSessionOnQueueActivity
@@ -499,7 +499,7 @@ namespace AZ
// outSH -> output SH coefficient array
void EvalSHRotationFast(const float R[9], const uint32_t maxBand, const float* inSH, float* outSH)
{
if (maxBand >= 0 && maxBand <= 2)
if (maxBand <= 2)
{
ZHF3(R, maxBand, inSH, outSH);
}
@@ -514,10 +514,7 @@ namespace AZ
// outSH -> output SH coefficient array
void EvalSHRotation(const float R[9], const uint32_t maxBand, const double* inSH, double* outSH)
{
if (maxBand >= 0)
{
WignerD(R, maxBand, inSH, outSH);
}
WignerD(R, maxBand, inSH, outSH);
}
// Fast evaluation for first 3 bands
@@ -199,7 +199,6 @@ namespace AZ
if ((shaderVariantId.m_mask & option.GetBitMask()).any())
{
optionValues.push_back(option.DecodeBits(shaderVariantId.m_key));
AZ_Assert(optionValues.back() >= 0, "Invalid shader variant key");
}
else
{
@@ -834,8 +834,10 @@ namespace AZ
{
// Check whether it should be sorted by name.
const uint32_t sortType = static_cast<uint32_t>(m_sortType);
AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option")
bool sortByName = (sortType >= static_cast<uint32_t>(ProfilerSortType::Alphabetical) &&
(sortType < static_cast<uint32_t>(ProfilerSortType::AlphabeticalCount)));
AZ_POP_DISABLE_WARNING
if (ImGui::Selectable("Pass Names", sortByName))
{
@@ -1011,7 +1013,7 @@ namespace AZ
const uint32_t countNumerical = static_cast<uint32_t>(count);
const uint32_t offset = static_cast<uint32_t>(m_sortType) - startNumerical;
if (offset < countNumerical && offset >= 0u)
if (offset < countNumerical)
{
// Change the sorting order.
m_sortType = static_cast<ProfilerSortType>(((offset + 1u) % countNumerical) + startNumerical);
@@ -147,7 +147,7 @@ namespace BarrierInput
{
inputChannelId = InputChannelIdByScanCodeTable[scanCode];
}
else if (0 <= (scanCode - 0x100) && scanCode < InputChannelIdByScanCodeWithExtendedPrefixTable.size())
else if (0x100 <= scanCode && scanCode < InputChannelIdByScanCodeWithExtendedPrefixTable.size())
{
inputChannelId = InputChannelIdByScanCodeWithExtendedPrefixTable[scanCode - 0x100];
}
@@ -497,13 +497,13 @@ namespace CommandSystem
}
// verify port ranges
if (m_sourcePort >= static_cast<int32>(sourceNode->GetOutputPorts().size()) || m_sourcePort < 0)
if (m_sourcePort >= static_cast<int32>(sourceNode->GetOutputPorts().size()))
{
outResult = AZStd::string::format("The output port number is not valid for the given node. Node '%s' only has %zu output ports.", sourceNode->GetName(), sourceNode->GetOutputPorts().size());
return false;
}
if (m_targetPort >= static_cast<int32>(targetNode->GetInputPorts().size()) || m_targetPort < 0)
if (m_targetPort >= static_cast<int32>(targetNode->GetInputPorts().size()))
{
outResult = AZStd::string::format("The input port number is not valid for the given node. Node '%s' only has %zu input ports.", targetNode->GetName(), targetNode->GetInputPorts().size());
return false;
@@ -30,7 +30,7 @@ namespace MCore
// find the last letter index from the right
size_t lastIndex = AZStd::string::npos;
const size_t numCharacters = prefixString.size();
for (size_t i = numCharacters - 1; i >= 0; --i)
for (int i = static_cast<int>(numCharacters) - 1; i >= 0; --i)
{
if (!AZStd::is_digit(prefixString[i]))
{
@@ -51,7 +51,7 @@ namespace GraphModelIntegrationTest
GraphModel::DataTypePtr TestGraphContext::GetDataType(GraphModel::DataType::Enum typeEnum) const
{
if (0 <= typeEnum && typeEnum < m_dataTypes.size())
if (typeEnum < m_dataTypes.size())
{
return m_dataTypes[typeEnum];
}
@@ -102,7 +102,7 @@ namespace LandscapeCanvas
GraphModel::DataTypePtr GraphContext::GetDataType(GraphModel::DataType::Enum typeEnum) const
{
if (0 <= typeEnum && typeEnum < m_dataTypes.size())
if (typeEnum < m_dataTypes.size())
{
return m_dataTypes[typeEnum];
}
@@ -294,7 +294,7 @@ unsigned int CAnimPostFXNode::GetParamCount() const
//-----------------------------------------------------------------------------
CAnimParamType CAnimPostFXNode::GetParamType(unsigned int nIndex) const
{
if (nIndex >= 0 && nIndex < (int)m_pDescription->m_nodeParams.size())
if (nIndex < m_pDescription->m_nodeParams.size())
{
return m_pDescription->m_nodeParams[nIndex].paramType;
}
@@ -304,7 +304,7 @@ unsigned int CAnimScreenFaderNode::GetParamCount() const
//-----------------------------------------------------------------------------
CAnimParamType CAnimScreenFaderNode::GetParamType(unsigned int nIndex) const
{
if (nIndex >= 0 && nIndex < (int)s_screenFaderNodeParams.size())
if (nIndex < s_screenFaderNodeParams.size())
{
return s_screenFaderNodeParams[nIndex].paramType;
}
@@ -120,7 +120,7 @@ unsigned int CCommentNode::GetParamCount() const
//-----------------------------------------------------------------------------
CAnimParamType CCommentNode::GetParamType(unsigned int nIndex) const
{
if (nIndex >= 0 && nIndex < (int)s_nodeParameters.size())
if (nIndex < s_nodeParameters.size())
{
return s_nodeParameters[nIndex].paramType;
}
@@ -144,7 +144,7 @@ unsigned int CLayerNode::GetParamCount() const
//-----------------------------------------------------------------------------
CAnimParamType CLayerNode::GetParamType(unsigned int nIndex) const
{
if (nIndex >= 0 && nIndex < (int)s_nodeParams.size())
if (nIndex < (int)s_nodeParams.size())
{
return s_nodeParams[nIndex].paramType;
}
@@ -180,7 +180,7 @@ unsigned int CAnimMaterialNode::GetParamCount() const
//////////////////////////////////////////////////////////////////////////
CAnimParamType CAnimMaterialNode::GetParamType(unsigned int nIndex) const
{
if (nIndex >= 0 && nIndex < (int)s_nodeParams.size())
if (nIndex < s_nodeParams.size())
{
return s_nodeParams[nIndex].paramType;
}
@@ -260,7 +260,7 @@ unsigned int CAnimSceneNode::GetParamCount() const
//////////////////////////////////////////////////////////////////////////
CAnimParamType CAnimSceneNode::GetParamType(unsigned int nIndex) const
{
if (nIndex >= 0 && nIndex < (int)s_nodeParams.size())
if (nIndex < s_nodeParams.size())
{
return s_nodeParams[nIndex].paramType;
}
@@ -87,7 +87,7 @@ unsigned int CShadowsSetupNode::GetParamCount() const
//-----------------------------------------------------------------------------
CAnimParamType CShadowsSetupNode::GetParamType(unsigned int nIndex) const
{
if (nIndex >= 0 && nIndex < (int)ShadowSetupNode::s_shadowSetupParams.size())
if (nIndex < ShadowSetupNode::s_shadowSetupParams.size())
{
return ShadowSetupNode::s_shadowSetupParams[nIndex].paramType;
}
@@ -1254,10 +1254,12 @@ namespace {{ Component.attrib['Namespace'] }}
bool {{ RecordName }}::CanAttachRecord(Multiplayer::ReplicationRecord& replicationRecord)
{
bool canAttach{ true };
AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option") // expression is always true
canAttach &= replicationRecord.ContainsAuthorityToClientBits() ? (replicationRecord.GetRemainingAuthorityToClientBits() >= static_cast<uint32_t>({{ AutoComponentMacros.GetNetPropertiesDirtyEnumName(ComponentName, 'Authority', 'Client') }}::Count)) : true;
canAttach &= replicationRecord.ContainsAuthorityToServerBits() ? (replicationRecord.GetRemainingAuthorityToServerBits() >= static_cast<uint32_t>({{ AutoComponentMacros.GetNetPropertiesDirtyEnumName(ComponentName, 'Authority', 'Server') }}::Count)) : true;
canAttach &= replicationRecord.ContainsAuthorityToAutonomousBits() ? (replicationRecord.GetRemainingAuthorityToAutonomousBits() >= static_cast<uint32_t>({{ AutoComponentMacros.GetNetPropertiesDirtyEnumName(ComponentName, 'Authority', 'Autonomous') }}::Count)) : true;
canAttach &= replicationRecord.ContainsAutonomousToAuthorityBits() ? (replicationRecord.GetRemainingAutonomousToAuthorityBits() >= static_cast<uint32_t>({{ AutoComponentMacros.GetNetPropertiesDirtyEnumName(ComponentName, 'Autonomous', 'Authority') }}::Count)) : true;
AZ_POP_DISABLE_WARNING
return canAttach;
}
@@ -104,7 +104,9 @@ namespace ScriptCanvas
private:\
static AZStd::string_view GetName(size_t i)\
{\
AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option")\
static_assert(s_numArgs <= s_numNames, "Number of arguments is greater than number of names in " #NODE_NAME );\
AZ_POP_DISABLE_WARNING\
/*static_assert(s_numResults <= s_numNames, "Number of results is greater than number of names in " #NODE_NAME );*/\
/*static_assert((s_numResults + s_numArgs) == s_numNames, "Argument name count + result name count != name count in " #NODE_NAME );*/\
static const AZStd::array<AZStd::string_view, s_numNames> s_names = {{ __VA_ARGS__ }};\
@@ -575,7 +575,7 @@ namespace ScriptCanvas
const SlotExecution::Map* slotExecutionMap = GetSlotExecutionMap();
const auto& executionIns = slotExecutionMap->GetIns();
if (methodIndex < 0 || methodIndex >= executionIns.size())
if (methodIndex >= executionIns.size())
{
return;
}
@@ -655,7 +655,7 @@ namespace ScriptCanvas
AZ::Outcome<void, AZStd::string> NodeableNodeOverloaded::IsValidConfiguration(size_t methodIndex, const DataIndexMapping& inputMapping, const DataIndexMapping& outputMapping)
{
if (methodIndex < 0 || methodIndex >= m_methodConfigurations.size())
if (methodIndex >= m_methodConfigurations.size())
{
return AZ::Failure(AZStd::string("Trying to access unknown method index."));
}
@@ -716,7 +716,7 @@ namespace ScriptCanvas
const SlotExecution::Map* slotExecutionMap = GetSlotExecutionMap();
const auto& executionIns = slotExecutionMap->GetIns();
if (methodIndex < 0 || methodIndex >= executionIns.size())
if (methodIndex >= executionIns.size())
{
return AZ::Failure(AZStd::string("Invalid method index given to Nodeable"));;
}
@@ -785,7 +785,7 @@ namespace ScriptCanvas
return AZ::Success();
}
if (methodIndex < 0 || methodIndex >= m_methodConfigurations.size())
if (methodIndex >= m_methodConfigurations.size())
{
return AZ::Failure(AZStd::string("Invalid Method index given to Nodeable Node Overloaded."));
}
@@ -826,7 +826,7 @@ namespace ScriptCanvas
{
static const DataTypeSet k_emptySet;
if (methodIndex >= 0 && methodIndex < m_methodSelections.size())
if (methodIndex < m_methodSelections.size())
{
const OverloadConfiguration& overloadConfiguration = m_methodConfigurations[methodIndex];
size_t startIndex = NodeableNodeOverloadedCpp::AdjustForHiddenNodeableThisPointer(overloadConfiguration, 0);
@@ -845,7 +845,7 @@ namespace ScriptCanvas
return AZ::Success();
}
if (methodIndex < 0 || methodIndex >= m_methodConfigurations.size())
if (methodIndex >= m_methodConfigurations.size())
{
return AZ::Failure(AZStd::string("Invalid Method index given to Nodeable Node Overloaded."));
}
@@ -883,7 +883,7 @@ namespace ScriptCanvas
{
static const DataTypeSet k_emptySet;
if (methodIndex >= 0 && methodIndex < m_methodSelections.size())
if (methodIndex < m_methodSelections.size())
{
return m_methodSelections[methodIndex].FindPossibleInputTypes(index);
}
@@ -37,7 +37,7 @@ namespace SubgraphInterfaceCpp
AZ_INLINE const char* GetTabs(size_t tabs)
{
AZ_Assert(tabs >= 0 && tabs <= k_maxTabs, "invalid argument to GetTabs");
AZ_Assert(tabs <= k_maxTabs, "invalid argument to GetTabs");
static const char* const k_tabs[] =
{
@@ -34,7 +34,7 @@ namespace ScriptCanvas
{
length = AZ::GetClamp<AZ::u32>(length, 0, aznumeric_cast<AZ::u32>(sourceString.size()));
if (length == 0 || index < 0 || index >= sourceString.size())
if (length == 0 || index >= sourceString.size())
{
return {};
}
@@ -30,7 +30,7 @@ namespace TranslationUtilitiesCPP
AZ_INLINE const char* GetTabs(size_t tabs)
{
AZ_Assert(tabs >= 0 && tabs <= k_maxTabs, "invalid argument to GetTabs");
AZ_Assert(tabs <= k_maxTabs, "invalid argument to GetTabs");
static const char* const k_tabs[] =
{
@@ -111,7 +111,7 @@ namespace ScriptEvents
{
// Iterate from end of parameters and count the number of consecutive valid BehaviorValue objects
size_t numDefaultArguments = 0;
for (size_t i = GetNumArguments() - 1; i >= 0 && GetDefaultValue(i); --i, ++numDefaultArguments)
for (int i = static_cast<int>(GetNumArguments()) - 1; i >= 0 && GetDefaultValue(static_cast<size_t>(i)); --i, ++numDefaultArguments)
{
}
return GetNumArguments() - numDefaultArguments;
@@ -121,7 +121,7 @@ namespace ScriptEvents
{
// Iterate from end of parameters and count the number of consecutive valid BehaviorValue objects
size_t numDefaultArguments = 0;
for (size_t i = GetNumArguments() - 1; i >= 0 && GetDefaultValue(i); --i, ++numDefaultArguments)
for (int i = static_cast<int>(GetNumArguments()) - 1; i >= 0 && GetDefaultValue(static_cast<size_t>(i)); --i, ++numDefaultArguments)
{
}
return GetNumArguments() - numDefaultArguments;
@@ -39,11 +39,11 @@ ly_append_configurations_options(
# Enabling warnings that are disabled by default from /W4
# https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019
# /we4296 # 'operator': expression is always false
/we4296 # 'operator': expression is always false
# /we4426 # optimization flags changed after including header, may be due to #pragma optimize()
# /we4464 # relative include path contains '..'
# /we4619 # #pragma warning: there is no warning number 'number'
# /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2' looks useful
# /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2'
# /we5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file
# /WE5032 # detected #pragma warning(push) with no corresponding #pragma warning(pop)