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;
}