SPEC-2513 Fixes to enable w4701 (#1105)

* Some fixes

* more fixes

* fixes for debug
This commit is contained in:
Esteban Papp
2021-06-03 09:30:33 -07:00
committed by GitHub
parent e340f3ca56
commit 29c71b4e53
21 changed files with 42 additions and 25 deletions
+1 -1
View File
@@ -561,7 +561,7 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
if (pex)
{
MINIDUMP_TYPE mdumpValue;
MINIDUMP_TYPE mdumpValue = MiniDumpNormal;
bool bDump = true;
switch (g_cvars.sys_dump_type)
{
+1 -1
View File
@@ -66,7 +66,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
if (pSystem && !pSystem->IsQuitting())
{
LRESULT result;
LRESULT result = 0;
bool bAny = false;
for (std::vector<IWindowMessageHandler*>::const_iterator it = pSystem->m_windowMessageHandlers.begin(); it != pSystem->m_windowMessageHandlers.end(); ++it)
{
+1 -1
View File
@@ -634,7 +634,7 @@ ICVar* CSystem::attachVariable (const char* szVarName, int* pContainer, const ch
IConsole* pConsole = GetIConsole();
ICVar* pOldVar = pConsole->GetCVar (szVarName);
int nDefault;
int nDefault = 0;
if (pOldVar)
{
nDefault = pOldVar->GetIVal();
+2 -1
View File
@@ -395,7 +395,8 @@ namespace UnitTest
}
else
{
int result1, result2;
int result1 = 0;
int result2 = 0;
Job* job1 = aznew FibonacciJob2(m_n - 1, &result1, m_context);
Job* job2 = aznew FibonacciJob2(m_n - 2, &result2, m_context);
StartAsChild(job1);
@@ -353,6 +353,7 @@ namespace AzFramework
// Get the dimensions of the display device on which the window is currently displayed.
MONITORINFO monitorInfo;
memset(&monitorInfo, 0, sizeof(MONITORINFO)); // C4701 potentially uninitialized local variable 'monitorInfo' used
monitorInfo.cbSize = sizeof(MONITORINFO);
const BOOL success = monitor ? GetMonitorInfo(monitor, &monitorInfo) : FALSE;
if (!success)
+1 -1
View File
@@ -553,7 +553,7 @@ void CLogFile::OnWriteToConsole(const char* sText, bool bNewLine)
// remember selection and the top row
int len = m_hWndEditBox->document()->toPlainText().length();
int top;
int top = 0;
int from = m_hWndEditBox->textCursor().selectionStart();
int to = from + m_hWndEditBox->textCursor().selectionEnd();
bool keepPos = false;
+2 -2
View File
@@ -157,7 +157,7 @@ static Quatern Qt_FromMatrix(HMatrix mat)
* |w| is greater than 1/2, which is as small as a largest component can be.
* Otherwise, the largest diagonal entry corresponds to the largest of |x|,
* |y|, or |z|, one of which must be larger than |w|, and at least 1/2. */
Quatern qu;
Quatern qu = { 0.0f, 0.0f, 0.0f, 1.0f };
double tr, s;
tr = mat[X][X] + mat[Y][Y] + mat[Z][Z];
@@ -531,7 +531,7 @@ Quatern snuggle(Quatern q, HVect* k)
#define swap(a, i, j) {a[3] = a[i]; a[i] = a[j]; a[j] = a[3]; }
#define cycle(a, p) if (p) {a[3] = a[0]; a[0] = a[1]; a[1] = a[2]; a[2] = a[3]; } \
else {a[3] = a[2]; a[2] = a[1]; a[1] = a[0]; a[0] = a[3]; }
Quatern p;
Quatern p = { 0.0f, 0.0f, 0.0f, 1.0f };
float ka[4];
int i, turn = -1;
ka[X] = k->x;
+2 -1
View File
@@ -2239,7 +2239,8 @@ uint32 CFileUtil::GetAttributes(const char* filename, bool bUseSourceControl /*=
bool CFileUtil::CompareFiles(const QString& strFilePath1, const QString& strFilePath2)
{
// Get the size of both files. If either fails we say they are different (most likely one doesn't exist)
uint64 size1, size2;
uint64 size1 = 0;
uint64 size2 = 0;
if (!GetDiskFileSize(strFilePath1.toUtf8().data(), size1) || !GetDiskFileSize(strFilePath2.toUtf8().data(), size2))
{
return false;
+1
View File
@@ -116,6 +116,7 @@ bool CImageBT::Load(const QString& fileName, CFloatImage& image)
// Get the BT header data
BtHeader header;
memset(&header, 0, sizeof(BtHeader)); // C4701 potentially uninitialized local variable 'header' used
bool validData = true;
validData = validData && (fread(&header, sizeof(BtHeader), 1, file) != 0);
+1 -1
View File
@@ -419,7 +419,7 @@ static inline bool MatchesWildcardsIgnoreCaseExt_Tpl(const TS& str, const TS& wi
const typename TS::value_type* savedStrBegin = 0;
const typename TS::value_type* savedStrEnd = 0;
const typename TS::value_type* savedWild = 0;
size_t savedWildCount;
size_t savedWildCount = 0;
const typename TS::value_type* pStr = str.c_str();
const typename TS::value_type* pWild = wildcards.c_str();
@@ -88,7 +88,7 @@ namespace ImageProcessingAtom
int dstPosition;
signed short int n;
bool trimZeros = true, stillzero;
int lastnonzero, hWeight, highest;
int lastnonzero = 0, hWeight, highest = 0;
signed int sumiWeights, iWeight;
signed short int* weightsPtr;
signed short int* weightsMem;
@@ -1106,7 +1106,7 @@ namespace ImageProcessingAtom
//fractional amount to apply change in tap intensity along edge to taps
// in a perpendicular direction to edge
CP_ITYPE fixupFrac = (CP_ITYPE)(fixupDist - iFixup) / (CP_ITYPE)(fixupDist);
CP_ITYPE fixupWeight;
CP_ITYPE fixupWeight = 0.0f;
switch(a_FixupType )
{
@@ -484,6 +484,7 @@ namespace AZ
}
D3D12_RESOURCE_TRANSITION_BARRIER transition;
memset(&transition, 0, sizeof(D3D12_RESOURCE_TRANSITION_BARRIER)); // C4701 potentially unitialized local variable 'transition' used
transition.pResource = image.GetMemoryView().GetMemory();
Scope& firstScope = static_cast<Scope&>(scopeAttachment->GetScope());
@@ -165,8 +165,8 @@ namespace EMotionFX
const AZ::Outcome<size_t> boolYParamIndexOutcome = m_animGraphInstance->FindParameterIndex(nameBoolY);
success = boolXParamIndexOutcome.IsSuccess() && boolYParamIndexOutcome.IsSuccess();
uint32 boolXOutputPortIndex;
uint32 boolYOutputPortIndex;
uint32 boolXOutputPortIndex = InvalidIndex32;
uint32 boolYOutputPortIndex = InvalidIndex32;
const int portIndicesTosetCount = 2;
int portIndicesFound = 0;
const AZStd::vector<EMotionFX::AnimGraphNode::Port>& parameterNodeOutputPorts = parameterNode->GetOutputPorts();
+15 -6
View File
@@ -612,7 +612,9 @@ FN_DECIMAL FastNoise::SingleValue(unsigned char offset, FN_DECIMAL x, FN_DECIMAL
int y1 = y0 + 1;
int z1 = z0 + 1;
FN_DECIMAL xs, ys, zs;
FN_DECIMAL xs = 0.0f;
FN_DECIMAL ys = 0.0f;
FN_DECIMAL zs = 0.0f;
switch (m_interp)
{
case Linear:
@@ -726,7 +728,8 @@ FN_DECIMAL FastNoise::SingleValue(unsigned char offset, FN_DECIMAL x, FN_DECIMAL
int x1 = x0 + 1;
int y1 = y0 + 1;
FN_DECIMAL xs, ys;
FN_DECIMAL xs = 0.0f;
FN_DECIMAL ys = 0.0f;
switch (m_interp)
{
case Linear:
@@ -840,7 +843,9 @@ FN_DECIMAL FastNoise::SinglePerlin(unsigned char offset, FN_DECIMAL x, FN_DECIMA
int y1 = y0 + 1;
int z1 = z0 + 1;
FN_DECIMAL xs, ys, zs;
FN_DECIMAL xs = 0.0f;
FN_DECIMAL ys = 0.0f;
FN_DECIMAL zs = 0.0f;
switch (m_interp)
{
case Linear:
@@ -962,7 +967,8 @@ FN_DECIMAL FastNoise::SinglePerlin(unsigned char offset, FN_DECIMAL x, FN_DECIMA
int x1 = x0 + 1;
int y1 = y0 + 1;
FN_DECIMAL xs, ys;
FN_DECIMAL xs = 0.0f;
FN_DECIMAL ys = 0.0f;
switch (m_interp)
{
case Linear:
@@ -1699,7 +1705,9 @@ FN_DECIMAL FastNoise::SingleCellular(FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z) c
int zr = FastRound(z);
FN_DECIMAL distance = 999999;
int xc, yc, zc;
int xc = 0;
int yc = 0;
int zc = 0;
switch (m_cellularDistanceFunction)
{
@@ -1923,7 +1931,8 @@ FN_DECIMAL FastNoise::SingleCellular(FN_DECIMAL x, FN_DECIMAL y) const
int yr = FastRound(y);
FN_DECIMAL distance = 999999;
int xc, yc;
int xc = 0;
int yc = 0;
switch (m_cellularDistanceFunction)
{
@@ -1239,7 +1239,7 @@ namespace GraphCanvas
bool GraphUtils::IsValidModelConnection(const GraphId& graphId, const Endpoint& sourceEndpoint, const Endpoint& targetEndpoint)
{
bool validConnection;
bool validConnection = false;
AZStd::unordered_set< Endpoint > finalSourceEndpoints = RemapEndpointForModel(sourceEndpoint);
AZStd::unordered_set< Endpoint > finalTargetEndpoints = RemapEndpointForModel(targetEndpoint);
@@ -691,7 +691,7 @@ IUiAnimTrack* CUiAnimAzEntityNode::CreateTrackForAzField(const UiAnimParamData&
return nullptr;
}
EUiAnimValue valueType;
EUiAnimValue valueType = eUiAnimValue_Unknown;
switch (numElements)
{
case 2:
@@ -107,7 +107,8 @@ void UiLayoutGridComponent::ApplyLayoutHeight()
AZStd::vector<AZ::EntityId> childEntityIds;
EBUS_EVENT_ID_RESULT(childEntityIds, GetEntityId(), UiElementBus, GetChildEntityIds);
int childIndex = 0;
int columnIndex, rowIndex;
int columnIndex = 0;
int rowIndex = 0;
for (auto child : childEntityIds)
{
// Set the anchors
@@ -627,7 +628,8 @@ AZ::Vector2 UiLayoutGridComponent::GetChildrenBoundingRectSize(const AZ::Vector2
UiLayoutHelpers::GetSizeInsidePadding(GetEntityId(), m_padding, layoutRectSize);
// Calculate number of rows and columns
int numColumns, numRows;
int numColumns = 0;
int numRows = 0;
switch (m_startingDirection)
{
case StartingDirection::HorizontalOrder:
@@ -151,6 +151,8 @@ namespace UiNavigationHelpers
}
UiTransformInterface::Rect parentRect;
parentRect.Set(0.0f, 0.0f, 0.0f, 0.0f);
AZ::Matrix4x4 parentTransformFromViewport;
if (parentElement.IsValid() && !isCurElementDescendantOfParentElement)
{
@@ -72,7 +72,7 @@ namespace NumericalMethods::Optimization
for (AZ::u32 iteration = 0; iteration < lineSearchIterations; iteration++)
{
ScalarVariable alphaNew;
ScalarVariable alphaNew = 0.0;
if (iteration > 0)
{
// first try selecting a new alpha value based on cubic interpolation through the most recent points
@@ -75,7 +75,6 @@ ly_append_configurations_options(
/wd4450 # declaration hides global declaration
/wd4457 # declaration hides function parameter
/wd4459 # declaration hides global declaration
/wd4701 # potentially unintialized local variable
# 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