more fixes, will merge fixes for w4245 and w4389

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-13 12:29:24 -07:00
parent 3522f622f3
commit e9b4f48f71
31 changed files with 21 additions and 133 deletions
+2 -2
View File
@@ -43,7 +43,7 @@ public:
//evaluate size
XmlString xmlStr = m_undoCtx.node->getXML();
m_size = sizeof(CUndoBaseLibraryItem);
m_size += xmlStr.GetAllocatedMemory();
m_size += static_cast<int>(xmlStr.GetAllocatedMemory());
m_size += m_itemPath.length();
m_size += m_description.length();
}
@@ -87,7 +87,7 @@ protected:
libItem->Serialize(m_redoCtx);
XmlString xmlStr = m_redoCtx.node->getXML();
m_size += xmlStr.GetAllocatedMemory();
m_size += static_cast<int>(xmlStr.GetAllocatedMemory());
}
//load previous saved data
@@ -560,7 +560,7 @@ void ReflectedPropertyControl::RequestPropertyContextMenu(AzToolsFramework::Inst
// Popup Menu with Event selection.
QMenu menu;
UINT i = 0;
unsigned int i = 0;
const int ePPA_CustomItemBase = 10; // reserved from 10 to 99
const int ePPA_CustomPopupBase = 100; // reserved from 100 to x*100+100 where x is size of m_customPopupMenuPopups
@@ -595,12 +595,12 @@ void ReflectedPropertyControl::RequestPropertyContextMenu(AzToolsFramework::Inst
action->setData(ePPA_CustomItemBase + i);
}
for (UINT j = 0; j < m_customPopupMenuPopups.size(); ++j)
for (unsigned int j = 0; j < m_customPopupMenuPopups.size(); ++j)
{
SCustomPopupMenu* pMenuInfo = &m_customPopupMenuPopups[j];
QMenu* pSubMenu = menu.addMenu(pMenuInfo->m_text);
for (UINT k = 0; k < pMenuInfo->m_subMenuText.size(); ++k)
for (UINT k = 0; k < static_cast<UINT>(pMenuInfo->m_subMenuText.size()); ++k)
{
const UINT uID = ePPA_CustomPopupBase + ePPA_CustomPopupBase * j + k;
QAction *action = pSubMenu->addAction(pMenuInfo->m_subMenuText[k]);
-12
View File
@@ -33,18 +33,6 @@
#include <Include/SandboxAPI.h>
#include <Include/EditorCoreAPI.h>
// Warnings in STL
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information.
#pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data
#pragma warning (disable : 4018) // signed/unsigned mismatch
// Disable warning when a function returns a value inside an __asm block
#pragma warning (disable : 4035)
//////////////////////////////////////////////////////////////////////////
// 64-bits related warnings.
#pragma warning (disable : 4267) // conversion from 'size_t' to 'int', possible loss of data
//////////////////////////////////////////////////////////////////////////
// Simple type definitions.
//////////////////////////////////////////////////////////////////////////
+2 -2
View File
@@ -1915,8 +1915,8 @@ Vec3 EditorViewportWidget::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nF
{
out.x = (x / 100) * m_rcClient.width();
out.y = (y / 100) * m_rcClient.height();
out.x /= QHighDpiScaling::factor(windowHandle()->screen());
out.y /= QHighDpiScaling::factor(windowHandle()->screen());
out.x /= static_cast<float>(QHighDpiScaling::factor(windowHandle()->screen()));
out.y /= static_cast<float>(QHighDpiScaling::factor(windowHandle()->screen()));
out.z = z;
}
return out;
+2 -2
View File
@@ -1978,8 +1978,8 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
{
float fScreenScale = hc.view->GetScreenScaleFactor(pos);
iconSizeX *= OBJECT_TEXTURE_ICON_SCALE / fScreenScale;
iconSizeY *= OBJECT_TEXTURE_ICON_SCALE / fScreenScale;
iconSizeX = static_cast<int>(static_cast<float>(iconSizeX) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale);
iconSizeY = static_cast<int>(static_cast<float>(iconSizeY) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale);
}
// Hit Test icon of this object.
@@ -2597,7 +2597,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
QString htmlStripped = layerInfoString;
htmlStripped.remove(htmlMarkupRegex);
const float layerInfoPadding = 1.2f;
textWidthAvailable -= fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding;
textWidthAvailable -= static_cast<int>(fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding);
}
entityNameRichText = fontMetrics.elidedText(optionV4.text, Qt::TextElideMode::ElideRight, textWidthAvailable);
@@ -9,8 +9,6 @@
#include "platform.h"
#pragma warning(disable: 4266) // disabled warning from afk overrides
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
#include <afxwin.h>
#include <vector>
@@ -30,13 +28,10 @@
#include "QtUtil.h"
// ugly dependencies:
#pragma warning(push)
#pragma warning(disable: 4244) // warning C4244: 'argument' : conversion from 'A' to 'B', possible loss of data
#include "Functor.h"
class CXmlArchive;
#include <IRenderer.h>
#include "Util/PathUtil.h"
#pragma warning(pop)
// ^^^
// ---------------------------------------------------------------------------
@@ -258,7 +258,7 @@ void CTrackViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime)
while (fPixelsPerTick >= 12.0 && steps < 100);
float fCurrentOffset = -fAnchorTime * m_timeScale;
m_scrollOffset.rx() += fOldOffset - fCurrentOffset;
m_scrollOffset.rx() += static_cast<int>(fOldOffset - fCurrentOffset);
m_scrollBar->setValue(m_scrollOffset.x());
update();
-2
View File
@@ -9,8 +9,6 @@
#include "EditorDefs.h"
#pragma warning ( disable : 4244 ) // conversion from 'double' to 'float', possible loss of data.
/**** Decompose.h - Basic declarations ****/
typedef struct
{
+4 -8
View File
@@ -61,15 +61,11 @@ QColor ScaleColor(const QColor& c, float aScale)
aColor = QColor(1, 1, 1);
}
int r = aColor.red();
int g = aColor.green();
int b = aColor.blue();
const float r = static_cast<float>(aColor.red()) * aScale;
const float g = static_cast<float>(aColor.green()) * aScale;
const float b = static_cast<float>(aColor.blue()) * aScale;
r *= aScale;
g *= aScale;
b *= aScale;
return QColor(CLAMP(r, 0, 255), CLAMP(g, 0, 255), CLAMP(b, 0, 255));
return QColor(CLAMP(static_cast<int>(r), 0, 255), CLAMP(static_cast<int>(g), 0, 255), CLAMP(static_cast<int>(b), 0, 255));
}
CAlphaBitmap::CAlphaBitmap()
+2 -2
View File
@@ -60,7 +60,7 @@ libtiffDummyReadProc (thandle_t fd, tdata_t buf, tsize_t size)
memcpy(buf, &memImage->buffer[memImage->offset], size);
memImage->offset += size;
memImage->offset += static_cast<uint32>(size);
// Return the amount of data read
return size;
@@ -83,7 +83,7 @@ libtiffDummySeekProc (thandle_t fd, toff_t off, int i)
break;
case SEEK_CUR:
memImage->offset += off;
memImage->offset += static_cast<uint32>(off);
break;
case SEEK_END:
-3
View File
@@ -137,8 +137,6 @@ namespace Util
{
x = x - 1;
#pragma warning(push)
#pragma warning(disable : 4293)
if (sizeof(TInteger) > 0)
{
x |= x >> 1;
@@ -163,7 +161,6 @@ namespace Util
{
x |= x >> 32;
}
#pragma warning(pop)
return x + 1;
}
@@ -357,8 +357,6 @@ namespace AzFramework
}
}
#pragma warning( push )
#pragma warning( disable : 4505 ) // StackDump is useful to debug the lua stack. Disable warning about this method being unused.
//=========================================================================
// DebugPrintStack
// Prints the Lua stack starting from the bottom.
@@ -375,8 +373,6 @@ namespace AzFramework
AZ_Warning("ScriptComponent", false, "Stack Dump: '%s'", dump.c_str());
}
#pragma warning( pop )
//=========================================================================
// Properties__IndexFindSubtable
@@ -208,7 +208,7 @@ namespace O3DE::ProjectManager
const QPixmap& pixmap = iterator.value();
painter->drawPixmap(contentRect.left() + startX, contentRect.bottom() - s_platformIconSize, pixmap);
qreal aspectRatio = static_cast<qreal>(pixmap.width()) / pixmap.height();
startX += s_platformIconSize * aspectRatio + s_platformIconSize / 2.5;
startX += static_cast<int>(s_platformIconSize * aspectRatio + s_platformIconSize / 2.5);
}
}
}
@@ -45,15 +45,9 @@ namespace AWSCore
virtual std::shared_ptr<ClientType> GetClient() = 0;
};
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4250 )
// warning C4250: 'AWSCore::AwsApiClientJobConfig<ClientType>': inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance
// Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation
// This is the expected and desired behavior. The warning is superfluous.
#endif
/// Configuration for AWS jobs using a specific client type.
template<class ClientType>
class AwsApiClientJobConfig
@@ -126,9 +120,4 @@ namespace AWSCore
/// Set by ApplySettings
std::shared_ptr<ClientType> m_client;
};
#ifdef _MSC_VER
#pragma warning( pop ) // C4250
#endif
} // namespace AWSCore
@@ -27,15 +27,9 @@ namespace AWSCore
};
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4250 )
// warning C4250: 'AWSCore::HttpRequestJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance
// Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation
// This is the expected and desired behavior. The warning is superfluous.
#endif
//! Provides service job configuration using settings properties.
class HttpRequestJobConfig
: public AwsApiJobConfig
@@ -98,9 +92,4 @@ namespace AWSCore
std::shared_ptr<Aws::Http::HttpClient> m_httpClient{ nullptr };
Aws::String m_userAgent{};
};
#ifdef _MSC_VER
#pragma warning( pop ) // C4250
#endif
} // namespace AWSCore
@@ -60,15 +60,10 @@ namespace AWSCore
static const char* GetRESTApiStageKeyName() { return RESTAPI_STAGE; } \
};
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4250 )
// warning C4250: 'AWSCore::ServiceClientJobConfig<ServiceTraitsType>' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance
// Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation
// This is the expected and desired behavior. The warning is superfluous.
#endif
/// Provides service job configuration using settings properties.
template<class ServiceTraitsType>
class ServiceClientJobConfig
@@ -132,11 +127,6 @@ namespace AWSCore
}
};
#ifdef _MSC_VER
#pragma warning( pop ) // C4250
#endif
} // namespace AWSCore
@@ -19,15 +19,9 @@ namespace AWSCore
{
};
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4250 )
// warning C4250: 'AWSCore::ServiceJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance
// Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation
// This is the expected and desired behavior. The warning is superfluous.
#endif
/// Provides service job configuration using settings properties.
class ServiceJobConfig
: public HttpRequestJobConfig
@@ -63,9 +57,4 @@ namespace AWSCore
private:
};
#ifdef _MSC_VER
#pragma warning( pop ) // C4250
#endif
} // namespace AWSCore
@@ -25,15 +25,10 @@ namespace AWSCore
virtual bool IsValid() const = 0;
};
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4250 )
// warning C4250: 'AWSCore::ServiceRequestJobConfig<RequestType>' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance
// Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation
// This is the expected and desired behavior. The warning is superfluous.
#endif
template<class RequestType>
class ServiceRequestJobConfig
: public ServiceClientJobConfig<typename RequestType::ServiceTraits>
@@ -106,8 +101,4 @@ namespace AWSCore
};
#ifdef _MSC_VER
#pragma warning( pop ) // C4250
#endif
} // namespace AWSCore
@@ -12,8 +12,6 @@
#include <sstream>
#include <time.h>
#pragma warning(disable : 4996)
namespace AWSCore
{
constexpr char AWSAttributionMetricDefaultO3DEVersion[] = "1.1";
@@ -10,8 +10,6 @@
#include <ctime>
#pragma warning(disable : 4996)
namespace AWSGameLift
{
Aws::GameLift::GenericOutcome GameLiftServerSDKWrapper::AcceptPlayerSession(const std::string& playerSessionId)
@@ -15,9 +15,6 @@
#include <ctime>
#pragma warning(disable : 4996)
namespace AWSMetrics
{
MetricsEventBuilder::MetricsEventBuilder()
@@ -18,9 +18,6 @@
//--------------------------------------------------------------------------------------
// Modified from original
//disable warning about doubles being converted down to float
#pragma warning (disable : 4244 )
#define VM_LARGE_FLOAT 3.7e37f
#define VM_MIN(a, b) (((a) < (b)) ? (a) : (b))
@@ -8,9 +8,6 @@
#pragma once
//! Disables "unreferenced formal parameter" warning
#pragma warning(disable : 4100)
#include <AzCore/EBus/EBus.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/string/string.h>
@@ -15,8 +15,6 @@
#include <locale>
#include <codecvt>
#pragma warning(disable : 4996)
namespace O3de
{
@@ -251,7 +251,7 @@ void CUiAnimViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime)
while (fPixelsPerTick >= 12.0 && steps < 100);
float fCurrentOffset = -fAnchorTime * m_timeScale;
m_scrollOffset.rx() += fOldOffset - fCurrentOffset;
m_scrollOffset.rx() += static_cast<int>(fOldOffset - fCurrentOffset);
update();
-2
View File
@@ -34,8 +34,6 @@
#include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx>
#include <AzToolsFramework/Undo/UndoSystem.h>
#pragma warning(disable: 4355) // 'this' : used in base member initializer list
class CanvasSizeToolbarSection;
class CommandCanvasPropertiesChange;
class CommandCanvasSizeToolbarIndex;
@@ -21,9 +21,6 @@
#include "Node.h"
#include "Attributes.h"
#pragma warning( push )
#pragma warning( disable : 5046) // 'function' : Symbol involving type with internal linkage not defined
/**
* NodeFunctionGeneric.h
*
@@ -372,5 +369,3 @@ namespace ScriptCanvas
}
}
#pragma warning( pop )
@@ -10,8 +10,6 @@
#include <ScriptCanvas/Internal/Nodes/ExpressionNodeBase.h>
#pragma warning (disable:4503) // decorated name length exceeded, name was truncated
namespace ScriptCanvas
{
namespace Nodes
@@ -539,8 +539,8 @@ namespace ScriptCanvasDeveloper
AZ::Vector2 stepDirection = AZ::Vector2::CreateZero();
stepDirection.SetX(jutDirection.x() * stepSize.GetX());
stepDirection.SetY(jutDirection.y() * stepSize.GetY());
stepDirection.SetX(static_cast<float>(jutDirection.x() * stepSize.GetX()));
stepDirection.SetY(static_cast<float>(jutDirection.y() * stepSize.GetY()));
m_scenePoint.setX(m_scenePoint.x() + stepDirection.GetX() * 2);
}
@@ -13,9 +13,6 @@
#include <ScriptCanvas/Core/NodeFunctionGeneric.h>
#pragma warning( push )
#pragma warning( disable : 5046) //'function' : Symbol involving type with internal linkage not defined
using namespace ScriptCanvasTests;
namespace
@@ -163,6 +160,3 @@ TEST_F(ScriptCanvasTestFixture, NodeGenerics)
delete graph->GetEntity();
}
#pragma warning( pop )