diff --git a/Code/Editor/BaseLibraryManager.h b/Code/Editor/BaseLibraryManager.h index 05f370e632..6f0b905760 100644 --- a/Code/Editor/BaseLibraryManager.h +++ b/Code/Editor/BaseLibraryManager.h @@ -73,7 +73,7 @@ public: virtual IDataBaseLibrary* AddLibrary(const QString& library, bool bIsLevelLibrary = false, bool bIsLoading = true) override; virtual void DeleteLibrary(const QString& library, bool forceDeleteLevel = false) override; //! Get number of libraries. - virtual int GetLibraryCount() const override { return m_libs.size(); }; + virtual int GetLibraryCount() const override { return static_cast(m_libs.size()); }; //! Get number of modified libraries. virtual int GetModifiedLibraryCount() const override; diff --git a/Code/Editor/Commands/CommandManager.cpp b/Code/Editor/Commands/CommandManager.cpp index f28ca96ac8..5f194971f5 100644 --- a/Code/Editor/Commands/CommandManager.cpp +++ b/Code/Editor/Commands/CommandManager.cpp @@ -529,8 +529,8 @@ QString CEditorCommandManager::ExecuteAndLogReturn(CCommand* pCommand, const CCo void CEditorCommandManager::GetArgsFromString(const AZStd::string& argsTxt, CCommand::CArgs& argList) { const char quoteSymbol = '\''; - int curPos = 0; - int prevPos = 0; + size_t curPos = 0; + size_t prevPos = 0; AZStd::vector tokens; AZ::StringFunc::Tokenize(argsTxt, tokens, ' '); for(AZStd::string& arg : tokens) diff --git a/Code/Editor/ConfigGroup.cpp b/Code/Editor/ConfigGroup.cpp index b18edf1142..74fe6f7b5c 100644 --- a/Code/Editor/ConfigGroup.cpp +++ b/Code/Editor/ConfigGroup.cpp @@ -33,7 +33,7 @@ namespace Config uint32 CConfigGroup::GetVarCount() { - return m_vars.size(); + return static_cast(m_vars.size()); } IConfigVar* CConfigGroup::GetVar(const char* szName) diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index 093575d445..acbd75444c 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -220,7 +220,7 @@ void ConsoleLineEdit::keyPressEvent(QKeyEvent* ev) } // If a history command was reused directly via up arrow enter, do not reset history index - if (m_history.size() > 0 && m_historyIndex < m_history.size() && m_history[m_historyIndex] == str) + if (m_history.size() > 0 && m_historyIndex < static_cast(m_history.size()) && m_history[m_historyIndex] == str) { m_bReusedHistory = true; } diff --git a/Code/Editor/Controls/ImageHistogramCtrl.cpp b/Code/Editor/Controls/ImageHistogramCtrl.cpp index 7218c0cd38..22223a3251 100644 --- a/Code/Editor/Controls/ImageHistogramCtrl.cpp +++ b/Code/Editor/Controls/ImageHistogramCtrl.cpp @@ -244,7 +244,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) } } - crtX = rcGraph.left() + x + 1; + crtX = static_cast(rcGraph.left() + x + 1); painter.drawLine(crtX, graphBottom, crtX, graphBottom - scale * graphHeight); } } @@ -260,7 +260,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) { i = ((float)x / graphWidth) * (kNumColorLevels - 1); i = CLAMP(i, 0, kNumColorLevels - 1); - crtX = rcGraph.left() + x + 1; + crtX = static_cast(rcGraph.left() + x + 1); scaleR = scaleG = scaleB = scaleA = 0; if (m_maxCount[0]) @@ -385,7 +385,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) } painter.setPen(pPen); - painter.drawLine(rcGraph.left() + x + 1, graphBottom, rcGraph.left() + x + 1, graphBottom - scale * graphHeight); + painter.drawLine(rcGraph.left() + static_cast(x) + 1, graphBottom, rcGraph.left() + static_cast(x) + 1, graphBottom - scale * graphHeight); } // then draw 3 lines so we separate the channels diff --git a/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp index fde5642b05..4fb18e438c 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp @@ -56,8 +56,8 @@ CReflectedVarAnimation AnimationPropertyCtrl::value() const void AnimationPropertyCtrl::OnApplyClicked() { QStringList cSelectedAnimations; - size_t nTotalAnimations(0); - size_t nCurrentAnimation(0); + int nTotalAnimations(0); + int nCurrentAnimation(0); QString combinedString = GetIEditor()->GetResourceSelectorHost()->GetGlobalSelection("animation"); SplitString(combinedString, cSelectedAnimations, ','); diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp index cf80d56962..3c7bda21d9 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp @@ -203,7 +203,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo outBlockPtr = new CVarBlock; for (size_t i = 0, iGroupCount(node->getChildCount()); i < iGroupCount; ++i) { - XmlNodeRef groupNode = node->getChild(i); + XmlNodeRef groupNode = node->getChild(static_cast(i)); if (groupNode->haveAttr("hidden")) { diff --git a/Code/Editor/Controls/SplineCtrlEx.cpp b/Code/Editor/Controls/SplineCtrlEx.cpp index 5977aff105..9eb0098762 100644 --- a/Code/Editor/Controls/SplineCtrlEx.cpp +++ b/Code/Editor/Controls/SplineCtrlEx.cpp @@ -1583,7 +1583,7 @@ bool AbstractSplineWidget::IsKeySelected(ISplineInterpolator* pSpline, int nKey, int AbstractSplineWidget::GetNumSelected() { int nSelected = 0; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { if (ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline) { @@ -1818,7 +1818,7 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point } // For each Spline... - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline; @@ -1973,7 +1973,7 @@ void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, floa m_nHitKeyIndex = -1; m_nHitDimension = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2077,7 +2077,7 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT float affectedRangeMin = FLT_MAX; float affectedRangeMax = -FLT_MAX; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2184,7 +2184,7 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue) m_nHitKeyIndex = -1; m_nHitDimension = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2223,7 +2223,7 @@ void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys) } // For each spline... - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2298,7 +2298,7 @@ void AbstractSplineWidget::RemoveSelectedKeys() m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2338,7 +2338,7 @@ void AbstractSplineWidget::RemoveSelectedKeyTimesImpl() StoreUndo(); SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex) + for (size_t splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex) { std::vector::iterator itTime = m_keyTimes.begin(), endTime = m_keyTimes.end(); for (int keyIndex = 0, endIndex = m_splines[splineIndex].pSpline->GetKeyCount(); keyIndex < endIndex; ) @@ -2376,9 +2376,9 @@ void AbstractSplineWidget::RedrawWindowAroundMarker() { UpdateKeyTimes(); std::vector::iterator itKeyTime = std::lower_bound(m_keyTimes.begin(), m_keyTimes.end(), KeyTime(m_fTimeMarker, 0)); - int keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size()); + size_t keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size()); int redrawRangeStart = (keyTimeIndex >= 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time) : m_rcSpline.left()); - int redrawRangeEnd = (keyTimeIndex < int(m_keyTimes.size()) - 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time) : m_rcSpline.right() + 1); + int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time) : m_rcSpline.right() + 1); QRect rc(QPoint(redrawRangeStart, m_rcSpline.top()), QPoint(redrawRangeEnd, m_rcSpline.bottom() + 1) - QPoint(1, 1)); rc = rc.normalized().intersected(m_rcSpline); @@ -2478,7 +2478,7 @@ void AbstractSplineWidget::ClearSelection() { ConditionalStoreUndo(); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2521,7 +2521,7 @@ void AbstractSplineWidget::StoreUndo() if (CUndo::IsRecording() && !m_pCurrentUndo) { std::vector splines(m_splines.size()); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { splines[splineIndex] = m_splines[splineIndex].pSpline; } @@ -2564,7 +2564,7 @@ void AbstractSplineWidget::DuplicateSelectedKeys() using KeysToAddContainer = std::vector; KeysToAddContainer keysToInsert; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2664,7 +2664,7 @@ void AbstractSplineWidget::KeyAll() ////////////////////////////////////////////////////////////////////////// void AbstractSplineWidget::SelectAll() { - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2815,7 +2815,7 @@ void AbstractSplineWidget::SelectRectangle(const QRect& rc, bool bSelect) { std::swap(t0, t1); } - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline; @@ -3031,7 +3031,7 @@ void AbstractSplineWidget::ModifySelectedKeysFlags(int nRemoveFlags, int nAddFla SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -3188,7 +3188,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey) { bool boFoundTheSelectedKey(false); - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; for (int i = 0; i < pSpline->GetKeyCount(); i++) @@ -3230,7 +3230,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey) } else { - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -3281,7 +3281,7 @@ void AbstractSplineWidget::RemoveAllKeysButThis() { std::vector keys; - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; diff --git a/Code/Editor/Controls/SplineCtrlEx.h b/Code/Editor/Controls/SplineCtrlEx.h index add4bcb0a9..711cbcf8d4 100644 --- a/Code/Editor/Controls/SplineCtrlEx.h +++ b/Code/Editor/Controls/SplineCtrlEx.h @@ -98,7 +98,7 @@ public: void AddSpline(ISplineInterpolator * pSpline, ISplineInterpolator * pDetailSpline, QColor anColorArray[4]); void RemoveSpline(ISplineInterpolator* pSpline); void RemoveAllSplines(); - int GetSplineCount() const { return m_splines.size(); } + int GetSplineCount() const { return static_cast(m_splines.size()); } ISplineInterpolator* GetSpline(int nIndex) const { return m_splines[nIndex].pSpline; } void SetTimeMarker(float fTime); diff --git a/Code/Editor/Controls/TextEditorCtrl.cpp b/Code/Editor/Controls/TextEditorCtrl.cpp index 5961c9d9a3..c372138d80 100644 --- a/Code/Editor/Controls/TextEditorCtrl.cpp +++ b/Code/Editor/Controls/TextEditorCtrl.cpp @@ -53,7 +53,7 @@ void CTextEditorCtrl::LoadFile(const QString& sFileName) size_t length = file.GetLength(); QByteArray text; - text.resize(length); + text.resize(static_cast(length)); file.ReadRaw(text.data(), length); setPlainText(text); diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 80b5b091c6..cbc4b89d0a 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -613,7 +613,7 @@ public: } // Get boolean options - const int numOptions = options.size(); + const int numOptions = static_cast(options.size()); for (int i = 0; i < numOptions; ++i) { options[i].second = parser.isSet(options[i].first); @@ -3240,7 +3240,7 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled) { QFileInfo info(fullyQualifiedLevelName); const AZStd::string rawProjectDirectory = Path::GetEditingGameDataFolder(); - const QString projectDirectory = QDir::toNativeSeparators(QString::fromUtf8(rawProjectDirectory.data(), rawProjectDirectory.size())); + const QString projectDirectory = QDir::toNativeSeparators(QString::fromUtf8(rawProjectDirectory.data(), static_cast(rawProjectDirectory.size()))); const QString elidedLevelName = QStringLiteral("%1...%2").arg(levelName.left(10)).arg(levelName.right(10)); const QString elidedLevelFileName = QStringLiteral("%1...%2").arg(info.fileName().left(10)).arg(info.fileName().right(10)); const QString message = QObject::tr( diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index c720299ce8..789aa1bdb9 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -1260,7 +1260,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) if (savedEntities) { AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml"); - pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), entitySaveBuffer.size()); + pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), static_cast(entitySaveBuffer.size())); // Save XML archive to pak file. bool bSaved = xmlAr.SaveToPak(Path::GetPath(tempSaveFile), pakFile); diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index c7b1976432..50e6e5d67d 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -1477,7 +1477,7 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu) Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras); QVector additionalCameras; - additionalCameras.reserve(getCameraResults.values.size()); + additionalCameras.reserve(static_cast(getCameraResults.values.size())); for (const AZ::EntityId& entityId : getCameraResults.values) { diff --git a/Code/Editor/ErrorReportTableModel.cpp b/Code/Editor/ErrorReportTableModel.cpp index c0c24bb7ce..2da3110e37 100644 --- a/Code/Editor/ErrorReportTableModel.cpp +++ b/Code/Editor/ErrorReportTableModel.cpp @@ -119,7 +119,7 @@ void CErrorReportTableModel::setErrorReport(CErrorReport* report) int CErrorReportTableModel::rowCount(const QModelIndex& parent) const { - return parent.isValid() ? 0 : m_errorRecords.size(); + return parent.isValid() ? 0 : static_cast(m_errorRecords.size()); } int CErrorReportTableModel::columnCount(const QModelIndex& parent) const diff --git a/Code/Editor/Export/ExportManager.cpp b/Code/Editor/Export/ExportManager.cpp index 5abd3ab5d0..8c90d7322d 100644 --- a/Code/Editor/Export/ExportManager.cpp +++ b/Code/Editor/Export/ExportManager.cpp @@ -302,7 +302,7 @@ void CExportManager::ProcessEntityAnimationTrack( return; } - for (int trackNumber = 0; trackNumber < pEntityTrack->GetChildCount(); ++trackNumber) + for (unsigned int trackNumber = 0; trackNumber < pEntityTrack->GetChildCount(); ++trackNumber) { CTrackViewTrack* pSubTrack = static_cast(pEntityTrack->GetChild(trackNumber)); @@ -964,7 +964,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo } const uint numKeys = pSequenceTrack->GetKeyCount(); - for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) + for (uint keyIndex = 0; keyIndex < numKeys; ++keyIndex) { const CTrackViewKeyHandle& keyHandle = pSequenceTrack->GetKey(keyIndex); ISequenceKey sequenceKey; @@ -1043,7 +1043,7 @@ bool CExportManager::AddSelectedRegionObjects() std::vector objects; GetIEditor()->GetObjectManager()->FindObjectsInAABB(box, objects); - int numObjects = objects.size(); + const size_t numObjects = objects.size(); if (numObjects > m_data.m_objects.size()) { m_data.m_objects.reserve(numObjects + 1); // +1 for terrain diff --git a/Code/Editor/Export/ExportManager.h b/Code/Editor/Export/ExportManager.h index 698ad3ad5d..be81591e56 100644 --- a/Code/Editor/Export/ExportManager.h +++ b/Code/Editor/Export/ExportManager.h @@ -36,7 +36,7 @@ namespace Export public: CMesh(); - virtual int GetFaceCount() const { return m_faces.size(); } + virtual int GetFaceCount() const { return static_cast(m_faces.size()); } virtual const Face* GetFaceBuffer() const { return m_faces.size() ? &m_faces[0] : 0; } private: @@ -53,22 +53,22 @@ namespace Export public: CObject(const char* pName); - virtual int GetVertexCount() const { return m_vertices.size(); } - virtual const Vector3D* GetVertexBuffer() const{ return m_vertices.size() ? &m_vertices[0] : 0; } + int GetVertexCount() const override { return static_cast(m_vertices.size()); } + const Vector3D* GetVertexBuffer() const override { return m_vertices.size() ? &m_vertices[0] : nullptr; } - virtual int GetNormalCount() const { return m_normals.size(); } - virtual const Vector3D* GetNormalBuffer() const { return m_normals.size() ? &m_normals[0] : 0; } + int GetNormalCount() const override { return static_cast(m_normals.size()); } + const Vector3D* GetNormalBuffer() const override { return m_normals.size() ? &m_normals[0] : nullptr; } - virtual int GetTexCoordCount() const { return m_texCoords.size(); } - virtual const UV* GetTexCoordBuffer() const { return m_texCoords.size() ? &m_texCoords[0] : 0; } + int GetTexCoordCount() const override { return static_cast(m_texCoords.size()); } + const UV* GetTexCoordBuffer() const override { return m_texCoords.size() ? &m_texCoords[0] : nullptr; } - virtual int GetMeshCount() const { return m_meshes.size(); } - virtual Mesh* GetMesh(int index) const { return m_meshes[index]; } + int GetMeshCount() const override { return static_cast(m_meshes.size()); } + Mesh* GetMesh(int index) const override { return m_meshes[index]; } - virtual size_t MeshHash() const{return m_MeshHash; } + size_t MeshHash() const override{return m_MeshHash; } void SetMaterialName(const char* pName); - virtual int GetEntityAnimationDataCount() const {return m_entityAnimData.size(); } + virtual int GetEntityAnimationDataCount() const {return static_cast(m_entityAnimData.size()); } virtual const EntityAnimData* GetEntityAnimationData(int index) const {return &m_entityAnimData[index]; } virtual void SetEntityAnimationData(EntityAnimData entityData){ m_entityAnimData.push_back(entityData); }; void SetLastPtr(CBaseObject* pObject){m_pLastObject = pObject; }; @@ -92,7 +92,7 @@ namespace Export : public IData { public: - virtual int GetObjectCount() const { return m_objects.size(); } + virtual int GetObjectCount() const { return static_cast(m_objects.size()); } virtual Object* GetObject(int index) const { return m_objects[index]; } virtual Object* AddObject(const char* objectName); void Clear(); diff --git a/Code/Editor/Export/OBJExporter.cpp b/Code/Editor/Export/OBJExporter.cpp index bd2696090e..6ce40f8cd3 100644 --- a/Code/Editor/Export/OBJExporter.cpp +++ b/Code/Editor/Export/OBJExporter.cpp @@ -227,7 +227,7 @@ QString COBJExporter::MakeRelativePath(const char* pMainFileName, const char* pF const char* ch = strrchr(pMainFileName, '\\'); if (ch) { - if (strlen(pFileName) > ch - pMainFileName && !_strnicmp(pMainFileName, pFileName, ch - pMainFileName)) + if (strlen(pFileName) > static_cast(ch - pMainFileName) && !_strnicmp(pMainFileName, pFileName, ch - pMainFileName)) { return QString(pFileName + (ch - pMainFileName) + 1); } @@ -256,7 +256,7 @@ const char* COBJExporter::TrimFloat(float fValue) const ++nCurBuf; sprintf_s(pBuf, bufSize, "%f", fValue); - for (int i = strlen(pBuf) - 1; i > 0; --i) + for (int i = static_cast(strlen(pBuf)) - 1; i > 0; --i) { if (pBuf[i] == '0') { diff --git a/Code/Editor/Export/OCMExporter.cpp b/Code/Editor/Export/OCMExporter.cpp index 653dc28dd3..ba5c343d0d 100644 --- a/Code/Editor/Export/OCMExporter.cpp +++ b/Code/Editor/Export/OCMExporter.cpp @@ -215,7 +215,7 @@ bool COCMExporter::ExportToFile(const char* filename, const Export::IData* pExpo for (size_t a = 0; a < MeshCount; a++) { SOCMeshInfo MeshInfo; - MeshInfo.m_MeshHash = pExportData->GetObject(a)->MeshHash(); + MeshInfo.m_MeshHash = pExportData->GetObject(static_cast(a))->MeshHash(); const tdMeshOffset::iterator it = std::find(MeshOffsets.begin(), MeshOffsets.end(), MeshInfo); if (it != MeshOffsets.end()) { @@ -223,15 +223,15 @@ bool COCMExporter::ExportToFile(const char* filename, const Export::IData* pExpo } else { - MeshInfo.m_Offset = Offset; - Offset += SaveMesh(Writer, pExportData->GetObject(a), MeshInfo.m_OBBMat); + MeshInfo.m_Offset = static_cast(Offset); + Offset += SaveMesh(Writer, pExportData->GetObject(static_cast(a)), MeshInfo.m_OBBMat); } MeshOffsets.push_back(MeshInfo); } - OffsetInstances = Offset; + OffsetInstances = static_cast(Offset); for (size_t a = 0; a < InstCount; a++) { - SaveInstance(Writer, pExportData->GetObject(a), MeshOffsets[a]); + SaveInstance(Writer, pExportData->GetObject(static_cast(a)), MeshOffsets[a]); } Writer.Seek(4); Writer.Write(static_cast(MeshOffsets.size())); @@ -263,7 +263,7 @@ const char* COCMExporter::TrimFloat(float fValue) const ++nCurBuf; sprintf_s(pBuf, bufSize, "%f", fValue); - for (int i = strlen(pBuf) - 1; i > 0; --i) + for (int i = static_cast(strlen(pBuf)) - 1; i > 0; --i) { if (pBuf[i] == '0') { diff --git a/Code/Editor/GameExporter.cpp b/Code/Editor/GameExporter.cpp index 415103e10d..1fc980fdac 100644 --- a/Code/Editor/GameExporter.cpp +++ b/Code/Editor/GameExporter.cpp @@ -252,11 +252,11 @@ void CGameExporter::ExportOcclusionMesh(const char* pszGamePath) { CMemoryBlock Temp; const size_t Size = FileIn.size(); - Temp.Allocate(Size); + Temp.Allocate(static_cast(Size)); FileIn.read(reinterpret_cast(Temp.GetBuffer()), Size); FileIn.close(); CCryMemFile FileOut; - FileOut.Write(Temp.GetBuffer(), Size); + FileOut.Write(Temp.GetBuffer(), static_cast(Size)); m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), FileOut); } } @@ -281,13 +281,13 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/ QString levelDataFile = path + "LevelData.xml"; XmlString xmlData = root->getXML(); CCryMemFile file; - file.Write(xmlData.c_str(), xmlData.length()); + file.Write(xmlData.c_str(), static_cast(xmlData.length())); m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), file); QString levelDataActionFile = path + "LevelDataAction.xml"; XmlString xmlDataAction = rootAction->getXML(); CCryMemFile fileAction; - fileAction.Write(xmlDataAction.c_str(), xmlDataAction.length()); + fileAction.Write(xmlDataAction.c_str(), static_cast(xmlDataAction.length())); m_levelPak.m_pakFile.UpdateFile(levelDataActionFile.toUtf8().data(), fileAction); AZStd::vector entitySaveBuffer; @@ -298,7 +298,7 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/ { QString entitiesFile; entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, "Mission0"); - m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), entitySaveBuffer.size()); + m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), static_cast(entitySaveBuffer.size())); } } @@ -329,7 +329,7 @@ void CGameExporter::ExportLevelInfo(const QString& path) XmlString xmlData = root->getXML(); CCryMemFile file; - file.Write(xmlData.c_str(), xmlData.length()); + file.Write(xmlData.c_str(), static_cast(xmlData.length())); m_levelPak.m_pakFile.UpdateFile(filename.toUtf8().data(), file); } @@ -342,7 +342,7 @@ void CGameExporter::ExportLevelResourceList(const QString& path) CCryMemFile memFile; for (const char* filename = pResList->GetFirst(); filename; filename = pResList->GetNext()) { - memFile.Write(filename, strlen(filename)); + memFile.Write(filename, static_cast(strlen(filename))); memFile.Write("\n", 1); } diff --git a/Code/Editor/GameResourcesExporter.cpp b/Code/Editor/GameResourcesExporter.cpp index dd16b2eca1..b47f8c63a6 100644 --- a/Code/Editor/GameResourcesExporter.cpp +++ b/Code/Editor/GameResourcesExporter.cpp @@ -97,7 +97,7 @@ void CGameResourcesExporter::Save(const QString& outputDirectory) { // Save this file in target folder. QString trgFilename = Path::Make(outputDirectory, srcFilename); - int fsize = file.GetLength(); + int fsize = static_cast(file.GetLength()); if (fsize > data.GetSize()) { data.Allocate(fsize + 16); @@ -123,23 +123,6 @@ void CGameResourcesExporter::Save(const QString& outputDirectory) m_files.clear(); } -#if defined(WIN64) || defined(APPLE) || defined(AZ_PLATFORM_LINUX) -template -void Append(Container1& a, const Container2& b) -{ - a.reserve (a.size() + b.size()); - for (auto it = b.begin(); it != b.end(); ++it) - { - a.insert(a.end(), *it); - } -} -#else -template -void Append(Container1& a, const Container2& b) -{ - a.insert (a.end(), b.begin(), b.end()); -} -#endif ////////////////////////////////////////////////////////////////////////// // // Go through all editor objects and gathers files from thier properties. @@ -150,5 +133,5 @@ void CGameResourcesExporter::GetFilesFromObjects() CUsedResources rs; GetIEditor()->GetObjectManager()->GatherUsedResources(rs); - Append(m_files, rs.files); + AZStd::copy(rs.files.begin(), rs.files.end(), AZStd::back_inserter(m_files)); } diff --git a/Code/Editor/Geometry/TriMesh.cpp b/Code/Editor/Geometry/TriMesh.cpp index 8e85de3904..2106265aca 100644 --- a/Code/Editor/Geometry/TriMesh.cpp +++ b/Code/Editor/Geometry/TriMesh.cpp @@ -420,7 +420,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const pIndexedMesh->SetBBox(bb); - pIndexedMesh->SetSubSetCount(usedMaterialIds.size()); + pIndexedMesh->SetSubSetCount(static_cast(usedMaterialIds.size())); for (int i = 0; i < usedMaterialIds.size(); i++) { pIndexedMesh->SetSubsetMaterialId(i, usedMaterialIds[i]); diff --git a/Code/Editor/LevelFileDialog.cpp b/Code/Editor/LevelFileDialog.cpp index cefa1330eb..c0c2b96c59 100644 --- a/Code/Editor/LevelFileDialog.cpp +++ b/Code/Editor/LevelFileDialog.cpp @@ -477,7 +477,7 @@ bool CLevelFileDialog::ValidateLevelPath(const QString& levelPath) const QString currentPath = (Path::GetEditingGameDataFolder() + "/" + kLevelsFolder).c_str(); for (size_t i = 0; i < splittedPath.size() - 1; ++i) { - currentPath += "/" + splittedPath[i]; + currentPath += "/" + splittedPath[static_cast(i)]; if (CFileUtil::FileExists(currentPath) || CheckLevelFolder(currentPath)) { diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index bb246c2337..8c466c47c2 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -1674,7 +1674,7 @@ void MainWindow::OnUpdateConnectionStatus() tooltip += m_connectionListener->LastAssetProcessorTask().c_str(); tooltip += "\n"; AZStd::set failedJobs = m_connectionListener->FailedJobsList(); - int failureCount = failedJobs.size(); + int failureCount = static_cast(failedJobs.size()); if (failureCount) { tooltip += "\n Failed Jobs\n"; diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp index f40363ba98..e68b17b99f 100644 --- a/Code/Editor/Objects/BaseObject.cpp +++ b/Code/Editor/Objects/BaseObject.cpp @@ -840,8 +840,8 @@ void CBaseObject::DrawDefault(DisplayContext& dc, const QColor& labelColor) { dc.DrawLine(GetParentAttachPointWorldTM().GetTranslation(), wp, IsFrozen() ? kLinkColorGray : kLinkColorParent, IsFrozen() ? kLinkColorGray : kLinkColorChild); } - int nChildCount = GetChildCount(); - for (int i = 0; i < nChildCount; ++i) + size_t nChildCount = GetChildCount(); + for (size_t i = 0; i < nChildCount; ++i) { const CBaseObject* pChild = GetChild(i); dc.DrawLine(pChild->GetParentAttachPointWorldTM().GetTranslation(), pChild->GetWorldPos(), pChild->IsFrozen() ? kLinkColorGray : kLinkColorParent, pChild->IsFrozen() ? kLinkColorGray : kLinkColorChild); @@ -1375,7 +1375,7 @@ bool CBaseObject::IsHiddenBySpec() const return false; } - return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > gSettings.editorConfigSpec); + return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > static_cast(gSettings.editorConfigSpec)); } ////////////////////////////////////////////////////////////////////////// @@ -1893,7 +1893,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box) std::vector convexHullForRegion1; ConvexHull2D(convexHullForRegion1, pointsForRegion1); - nEdgeList1Count = convexHullForRegion1.size(); + nEdgeList1Count = static_cast(convexHullForRegion1.size()); if (nEdgeList1Count < 3 || nEdgeList1Count > kMaxSizeOfEdgeList1) { return true; @@ -2062,7 +2062,7 @@ void CBaseObject::GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj { const CBaseObject* pBaseObj = pObj ? pObj : this; - for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) + for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) { CBaseObject* pChild = pBaseObj->GetChild(i); if (pChild == nullptr) @@ -2078,7 +2078,7 @@ void CBaseObject::GetAllChildren(DynArray< _smart_ptr >& outAllChil { const CBaseObject* pBaseObj = pObj ? pObj : this; - for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) + for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) { CBaseObject* pChild = pBaseObj->GetChild(i); if (pChild == nullptr) @@ -2094,7 +2094,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p { const CBaseObject* pBaseObj = pObj ? pObj : this; - for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) + for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) { CBaseObject* pChild = pBaseObj->GetChild(i); if (pChild == nullptr) @@ -2114,7 +2114,7 @@ void CBaseObject::CloneChildren(CBaseObject* pFromObject) return; } - for (int i = 0, nChildCount(pFromObject->GetChildCount()); i < nChildCount; ++i) + for (size_t i = 0, nChildCount(pFromObject->GetChildCount()); i < nChildCount; ++i) { CBaseObject* pFromChildObject = pFromObject->GetChild(i); @@ -2729,7 +2729,7 @@ void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren) // Set min spec for all childs. if (bSetChildren) { - for (int i = m_childs.size() - 1; i >= 0; --i) + for (size_t i = m_childs.size() - 1; i >= 0; --i) { m_childs[i]->SetMinSpec(nSpec, true); } diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp index 77fab543f9..02f89c268f 100644 --- a/Code/Editor/Objects/EntityObject.cpp +++ b/Code/Editor/Objects/EntityObject.cpp @@ -63,7 +63,7 @@ protected: void Undo([[maybe_unused]] bool bUndo) override { - for (int i = 0, iLinkSize(m_Links.size()); i < iLinkSize; ++i) + for (int i = 0, iLinkSize = static_cast(m_Links.size()); i < iLinkSize; ++i) { SLink& link = m_Links[i]; CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID); @@ -1217,7 +1217,7 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN if (!m_links.empty()) { XmlNodeRef linksNode = objNode->newChild("EntityLinks"); - for (int i = 0, num = m_links.size(); i < num; i++) + for (size_t i = 0, num = m_links.size(); i < num; i++) { if (m_links[i].target) { @@ -1368,8 +1368,8 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx // Clone event targets. if (!pFromEntity->m_eventTargets.empty()) { - int numTargets = pFromEntity->m_eventTargets.size(); - for (int i = 0; i < numTargets; i++) + size_t numTargets = pFromEntity->m_eventTargets.size(); + for (size_t i = 0; i < numTargets; i++) { CEntityEventTarget& et = pFromEntity->m_eventTargets[i]; CBaseObject* pClonedTarget = ctx.FindClone(et.target); @@ -1386,7 +1386,7 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx // Clone links. if (!pFromEntity->m_links.empty()) { - int numTargets = pFromEntity->m_links.size(); + int numTargets = static_cast(pFromEntity->m_links.size()); for (int i = 0; i < numTargets; i++) { CEntityLink& et = pFromEntity->m_links[i]; @@ -1437,7 +1437,7 @@ void CEntityObject::RemoveAllEntityLinks() { while (!m_links.empty()) { - RemoveEntityLink(m_links.size() - 1); + RemoveEntityLink(static_cast(m_links.size() - 1)); } m_links.clear(); SetModified(false); @@ -1448,7 +1448,7 @@ void CEntityObject::ReleaseEventTargets() { while (!m_eventTargets.empty()) { - RemoveEventTarget(m_eventTargets.size() - 1, false); + RemoveEventTarget(static_cast(m_eventTargets.size() - 1), false); } m_eventTargets.clear(); SetModified(false); @@ -1518,7 +1518,7 @@ void CEntityObject::SaveLink(XmlNodeRef xmlNode) } XmlNodeRef linksNode = xmlNode->newChild("EntityLinks"); - for (int i = 0, num = m_links.size(); i < num; i++) + for (size_t i = 0, num = m_links.size(); i < num; i++) { XmlNodeRef linkNode = linksNode->newChild("Link"); linkNode->setAttr("TargetId", m_links[i].targetId); @@ -1534,7 +1534,7 @@ void CEntityObject::OnObjectEvent(CBaseObject* target, int event) if (event == CBaseObject::ON_DELETE) { // Find this target in events list and remove. - int numTargets = m_eventTargets.size(); + int numTargets = static_cast(m_eventTargets.size()); for (int i = 0; i < numTargets; i++) { if (m_eventTargets[i].target == target) @@ -1547,7 +1547,7 @@ void CEntityObject::OnObjectEvent(CBaseObject* target, int event) } else if (event == CBaseObject::ON_PREDELETE) { - int numTargets = m_links.size(); + int numTargets = static_cast(m_links.size()); for (int i = 0; i < numTargets; i++) { if (m_links[i].target == target) @@ -1589,7 +1589,7 @@ int CEntityObject::AddEventTarget(CBaseObject* target, const QString& event, con m_eventTargets.push_back(et); SetModified(false); - return m_eventTargets.size() - 1; + return static_cast(m_eventTargets.size() - 1); } ////////////////////////////////////////////////////////////////////////// @@ -1659,13 +1659,13 @@ int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId) SetModified(false); - return m_links.size() - 1; + return static_cast(m_links.size() - 1); } ////////////////////////////////////////////////////////////////////////// bool CEntityObject::EntityLinkExists(const QString& name, GUID targetEntityId) { - for (int i = 0, num = m_links.size(); i < num; ++i) + for (size_t i = 0, num = m_links.size(); i < num; ++i) { if (m_links[i].targetId == targetEntityId && name.compare(m_links[i].name, Qt::CaseInsensitive) == 0) { diff --git a/Code/Editor/Objects/ObjectLoader.cpp b/Code/Editor/Objects/ObjectLoader.cpp index 2583eb6230..9596265bb9 100644 --- a/Code/Editor/Objects/ObjectLoader.cpp +++ b/Code/Editor/Objects/ObjectLoader.cpp @@ -126,7 +126,7 @@ void CObjectArchive::ResolveObjects() ////////////////////////////////////////////////////////////////////////// // Serialize All Objects from XML. ////////////////////////////////////////////////////////////////////////// - int numObj = m_loadedObjects.size(); + int numObj = static_cast(m_loadedObjects.size()); for (i = 0; i < numObj; i++) { if (m_bProgressBarEnabled) @@ -143,7 +143,7 @@ void CObjectArchive::ResolveObjects() m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr); // Objects can be added to the list here (from Groups). - numObj = m_loadedObjects.size(); + numObj = static_cast(m_loadedObjects.size()); } m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr); ////////////////////////////////////////////////////////////////////////// @@ -221,7 +221,7 @@ void CObjectArchive::ResolveObjects() ////////////////////////////////////////////////////////////////////////// // Serialize All Objects from XML. ////////////////////////////////////////////////////////////////////////// - int numObj = m_loadedObjects.size(); + int numObj = static_cast(m_loadedObjects.size()); for (i = 0; i < numObj; i++) { if (m_bProgressBarEnabled) @@ -246,7 +246,7 @@ void CObjectArchive::ResolveObjects() // Call PostLoad on all these objects. ////////////////////////////////////////////////////////////////////////// { - int numObj = m_loadedObjects.size(); + int numObj = static_cast(m_loadedObjects.size()); for (i = 0; i < numObj; i++) { SLoadedObjectInfo& obj = m_loadedObjects[i]; diff --git a/Code/Editor/Objects/ObjectManager.cpp b/Code/Editor/Objects/ObjectManager.cpp index fbdd56f080..3e2a1c0d2c 100644 --- a/Code/Editor/Objects/ObjectManager.cpp +++ b/Code/Editor/Objects/ObjectManager.cpp @@ -746,7 +746,7 @@ void CObjectManager::ChangeObjectName(CBaseObject* obj, const QString& newName) ////////////////////////////////////////////////////////////////////////// int CObjectManager::GetObjectCount() const { - return m_objects.size(); + return static_cast(m_objects.size()); } ////////////////////////////////////////////////////////////////////////// @@ -765,7 +765,7 @@ void CObjectManager::GetObjects(DynArray& objects) const CBaseObjectsArray objectArray; GetObjects(objectArray); objects.clear(); - for (int i = 0, iCount(objectArray.size()); i < iCount; ++i) + for (size_t i = 0, iCount(objectArray.size()); i < iCount; ++i) { objects.push_back(objectArray[i]); } @@ -1336,11 +1336,11 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]] bbox.max.zero(); pDispayedViewObjects->ClearObjects(); - pDispayedViewObjects->Reserve(m_visibleObjects.size()); + pDispayedViewObjects->Reserve(static_cast(m_visibleObjects.size())); if (dc.flags & DISPLAY_2D) { - int numVis = m_visibleObjects.size(); + int numVis = static_cast(m_visibleObjects.size()); for (int i = 0; i < numVis; i++) { CBaseObject* obj = m_visibleObjects[i]; @@ -1374,7 +1374,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]] pSelection->GetObject(0)->CBaseObject::DrawDimensions(dc, &mergedAABB); } - int numVis = m_visibleObjects.size(); + int numVis = static_cast(m_visibleObjects.size()); for (int i = 0; i < numVis; i++) { CBaseObject* obj = m_visibleObjects[i]; @@ -2016,7 +2016,7 @@ void CObjectManager::GetClassCategories(QStringList& categories) } } categories.clear(); - categories.reserve(cset.size()); + categories.reserve(static_cast(cset.size())); for (std::set::iterator cit = cset.begin(); cit != cset.end(); ++cit) { categories.push_back(*cit); @@ -2629,7 +2629,7 @@ void CObjectManager::EnteredComponentMode(const AZStd::vector& /*compo const size_t gizmoCount = static_cast(gizmoManager->GetGizmoCount()); for (size_t i = 0; i < gizmoCount; ++i) { - gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(i)); + gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(static_cast(i))); } } diff --git a/Code/Editor/Objects/SelectionGroup.cpp b/Code/Editor/Objects/SelectionGroup.cpp index 027c88172e..57a86262aa 100644 --- a/Code/Editor/Objects/SelectionGroup.cpp +++ b/Code/Editor/Objects/SelectionGroup.cpp @@ -109,7 +109,7 @@ bool CSelectionGroup::SameObjectType() ////////////////////////////////////////////////////////////////////////// int CSelectionGroup::GetCount() const { - return m_objects.size(); + return static_cast(m_objects.size()); } ////////////////////////////////////////////////////////////////////////// @@ -632,7 +632,7 @@ void CSelectionGroup::IndicateSnappingVertex(DisplayContext& dc) const void CSelectionGroup::FinishChanges() { Objects selectedObjects(m_objects); - int iObjectSize(selectedObjects.size()); + int iObjectSize = static_cast(selectedObjects.size()); for (int i = 0; i < iObjectSize; ++i) { CBaseObject* pObject = selectedObjects[i]; diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp index 0d661349a9..d0091f968e 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp @@ -472,7 +472,7 @@ void AssetCatalogModel::LoadDatabase() { m_fileCacheCurrentIndex = 0; Q_EMIT UpdateProgress(0); - Q_EMIT SetTotalProgress(m_fileCache.size()); + Q_EMIT SetTotalProgress(static_cast(m_fileCache.size())); }; EBUS_EVENT(AZ::Data::AssetCatalogRequestBus, EnumerateAssets, startCB, enumerateCB, endCB); diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp index f7f2b721b7..cd0fba350f 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp @@ -262,7 +262,7 @@ QModelIndex ComponentDataModel::parent([[maybe_unused]] const QModelIndex &child int ComponentDataModel::rowCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const { - return m_componentList.size(); + return static_cast(m_componentList.size()); } int ComponentDataModel::columnCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const diff --git a/Code/Editor/PreferencesStdPages.cpp b/Code/Editor/PreferencesStdPages.cpp index a4b3ee8ba4..b593541a07 100644 --- a/Code/Editor/PreferencesStdPages.cpp +++ b/Code/Editor/PreferencesStdPages.cpp @@ -89,7 +89,7 @@ REFGUID CStdPreferencesClassDesc::ClassID() ////////////////////////////////////////////////////////////////////////// int CStdPreferencesClassDesc::GetPagesCount() { - return m_pageCreators.size(); + return static_cast(m_pageCreators.size()); } IPreferencesPage* CStdPreferencesClassDesc::CreateEditorPreferencesPage(int index) diff --git a/Code/Editor/QtViewPaneManager.cpp b/Code/Editor/QtViewPaneManager.cpp index f4f18fde83..d8111aa09c 100644 --- a/Code/Editor/QtViewPaneManager.cpp +++ b/Code/Editor/QtViewPaneManager.cpp @@ -184,7 +184,7 @@ bool QtViewPane::CloseInstance(QDockWidget* dockWidget, CloseModes closeModes) const int numTopLevel = topLevelWidgets.size(); for (size_t i = 0; i < numTopLevel; ++i) { - QWidget* widget = topLevelWidgets[i]; + QWidget* widget = topLevelWidgets[static_cast(i)]; if (widget->isModal() && widget->isVisible()) { widget->activateWindow(); diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp index 09b0d0f4f4..259f71b69b 100644 --- a/Code/Editor/Settings.cpp +++ b/Code/Editor/Settings.cpp @@ -1061,7 +1061,7 @@ void SEditorSettings::ConvertPath(const AZStd::string_view sourcePath, AZStd::st // The reason for the difference is to have this API be consistent with the path syntax in Open 3D Engine Python APIs. // Find the last pipe separator ("|") in the path - int lastSeparator = sourcePath.find_last_of("|"); + size_t lastSeparator = sourcePath.find_last_of("|"); // Everything before the last separator is the category (since only the category is hierarchical) category = sourcePath.substr(0, lastSeparator); diff --git a/Code/Editor/ToolBox.cpp b/Code/Editor/ToolBox.cpp index d784bc2083..1f08bd74fc 100644 --- a/Code/Editor/ToolBox.cpp +++ b/Code/Editor/ToolBox.cpp @@ -237,7 +237,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in { if (bToolbox) { - const int macroCount = m_macros.size(); + const int macroCount = static_cast(m_macros.size()); if (macroCount > ID_TOOL_LAST - ID_TOOL_FIRST + 1) { return nullptr; @@ -261,7 +261,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in } else { - const int shelveMacroCount = m_shelveMacros.size(); + const int shelveMacroCount = static_cast(m_shelveMacros.size()); if (shelveMacroCount > ID_TOOL_SHELVE_LAST - ID_TOOL_SHELVE_FIRST + 1) { return nullptr; diff --git a/Code/Editor/ToolbarManager.cpp b/Code/Editor/ToolbarManager.cpp index d44e794b6a..1831fe6a55 100644 --- a/Code/Editor/ToolbarManager.cpp +++ b/Code/Editor/ToolbarManager.cpp @@ -503,7 +503,7 @@ void ToolbarManager::InitializeStandardToolbars() { auto macroToolbars = GetIEditor()->GetToolBoxManager()->GetToolbars(); - m_standardToolbars.reserve(5 + macroToolbars.size()); + m_standardToolbars.reserve(static_cast(5 + macroToolbars.size())); m_standardToolbars.push_back(GetEditModeToolbar()); m_standardToolbars.push_back(GetObjectToolbar()); m_standardToolbars.push_back(GetPlayConsoleToolbar()); diff --git a/Code/Editor/ToolsConfigPage.cpp b/Code/Editor/ToolsConfigPage.cpp index 965c862554..1871dc763f 100644 --- a/Code/Editor/ToolsConfigPage.cpp +++ b/Code/Editor/ToolsConfigPage.cpp @@ -840,7 +840,7 @@ void CToolsConfigPage::FillScriptCmds() { EditorPythonConsoleInterface::GlobalFunctionCollection globalFunctionCollection; editorPythonConsoleInterface->GetGlobalFunctionList(globalFunctionCollection); - commands.reserve(globalFunctionCollection.size()); + commands.reserve(static_cast(globalFunctionCollection.size())); for (const EditorPythonConsoleInterface::GlobalFunction& globalFunction : globalFunctionCollection) { const QString fullCmd = QString("%1.%2()").arg(globalFunction.m_moduleName.data()).arg(globalFunction.m_functionName.data()); diff --git a/Code/Editor/TrackView/CommentKeyUIControls.cpp b/Code/Editor/TrackView/CommentKeyUIControls.cpp index c7c5f83cbf..6b52efd8f1 100644 --- a/Code/Editor/TrackView/CommentKeyUIControls.cpp +++ b/Code/Editor/TrackView/CommentKeyUIControls.cpp @@ -122,7 +122,7 @@ void CCommentKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& sel for (size_t keyIndex = 0, num = selectedKeys.GetKeyCount(); keyIndex < num; keyIndex++) { - CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex); + CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(static_cast(keyIndex)); CAnimParamType paramType = keyHandle.GetTrack()->GetParameterType(); if (paramType == AnimParamType::CommentText) diff --git a/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp b/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp index a62ab17cbf..d8b3a2bdf7 100644 --- a/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp +++ b/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp @@ -128,7 +128,7 @@ void CScreenFaderKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& for (size_t keyIndex = 0, num = selectedKeys.GetKeyCount(); keyIndex < num; ++keyIndex) { - CTrackViewKeyHandle selectedKey = selectedKeys.GetKey(keyIndex); + CTrackViewKeyHandle selectedKey = selectedKeys.GetKey(static_cast(keyIndex)); CAnimParamType paramType = selectedKey.GetTrack()->GetParameterType(); if (paramType == AnimParamType::ScreenFader) diff --git a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp index 66c4f63d35..aea655e9d3 100644 --- a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp +++ b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp @@ -357,7 +357,7 @@ void CSequenceBatchRenderDialog::OnRenderItemSelChange() QString cvarsText; for (size_t i = 0; i < item.cvars.size(); ++i) { - cvarsText += item.cvars[i]; + cvarsText += item.cvars[static_cast(i)]; cvarsText += "\r\n"; } m_ui->m_cvarsEdit->setPlainText(cvarsText); @@ -894,7 +894,7 @@ void CSequenceBatchRenderDialog::CaptureItemStart() // Set up the custom config cvars for this item. for (size_t i = 0; i < renderItem.cvars.size(); ++i) { - GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(renderItem.cvars[i].toUtf8().data()); + GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(renderItem.cvars[static_cast(i)].toUtf8().data()); } // Set specific capture options for this item. @@ -1519,7 +1519,7 @@ void CSequenceBatchRenderDialog::OnSaveBatch() // cvars for (size_t k = 0; k < item.cvars.size(); ++k) { - itemNode->newChild("cvar")->setContent(item.cvars[k].toUtf8().data()); + itemNode->newChild("cvar")->setContent(item.cvars[static_cast(k)].toUtf8().data()); } } diff --git a/Code/Editor/TrackView/SequenceKeyUIControls.cpp b/Code/Editor/TrackView/SequenceKeyUIControls.cpp index c3bc39d65d..4199563e10 100644 --- a/Code/Editor/TrackView/SequenceKeyUIControls.cpp +++ b/Code/Editor/TrackView/SequenceKeyUIControls.cpp @@ -84,7 +84,7 @@ bool CSequenceKeyUIControls::OnKeySelectionChange(CTrackViewKeyBundle& selectedK mv_sequence->AddEnumItem(QObject::tr(""), CTrackViewDialog::GetEntityIdAsString(AZ::EntityId(AZ::EntityId::InvalidEntityId))); const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager(); - for (int i = 0; i < pSequenceManager->GetCount(); ++i) + for (unsigned int i = 0; i < pSequenceManager->GetCount(); ++i) { CTrackViewSequence* pCurrentSequence = pSequenceManager->GetSequenceByIndex(i); bool bNotMe = pCurrentSequence != pSequence; diff --git a/Code/Editor/TrackView/TVEventsDialog.cpp b/Code/Editor/TrackView/TVEventsDialog.cpp index c8221b38cd..86b4c1f6bc 100644 --- a/Code/Editor/TrackView/TVEventsDialog.cpp +++ b/Code/Editor/TrackView/TVEventsDialog.cpp @@ -363,7 +363,7 @@ int TVEventsModel::GetNumberOfUsageAndFirstTimeUsed(const char* eventName, float { CTrackViewTrack* pTrack = tracks.GetTrack(currentTrack); - for (int currentKey = 0; currentKey < pTrack->GetKeyCount(); ++currentKey) + for (unsigned int currentKey = 0; currentKey < pTrack->GetKeyCount(); ++currentKey) { CTrackViewKeyHandle keyHandle = pTrack->GetKey(currentKey); diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index 9edac32da0..dd6fb8f936 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -452,7 +452,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode( { // Check for a duplicates CTrackViewAnimNodeBundle azEntityNodesFound = director2->GetAnimNodesByType(AnimNodeType::AzEntity); - for (int x = 0; x < azEntityNodesFound.GetCount(); x++) + for (unsigned int x = 0; x < azEntityNodesFound.GetCount(); x++) { if (azEntityNodesFound.GetNode(x)->GetAzEntityId() == owner) { diff --git a/Code/Editor/TrackView/TrackViewCurveEditor.cpp b/Code/Editor/TrackView/TrackViewCurveEditor.cpp index 83204f76a6..a757387563 100644 --- a/Code/Editor/TrackView/TrackViewCurveEditor.cpp +++ b/Code/Editor/TrackView/TrackViewCurveEditor.cpp @@ -145,7 +145,7 @@ void CTrackViewCurveEditor::UpdateSplines() std::set newTracks; if (selectedTracks.AreAllOfSameType()) { - for (int i = 0; i < selectedTracks.GetCount(); i++) + for (unsigned int i = 0; i < selectedTracks.GetCount(); i++) { CTrackViewTrack* pTrack = selectedTracks.GetTrack(i); diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index 309d776b81..bdec68e928 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -782,7 +782,7 @@ void CTrackViewDialog::UpdateActions() } bool allSelectedTracksUseMute = true; - for (int i = 0; i < selectedTrackCount; i++) + for (unsigned int i = 0; i < selectedTrackCount; i++) { CTrackViewTrack* pTrack = selectedTracks.GetTrack(i); if (pTrack && !pTrack->UsesMute()) @@ -1121,7 +1121,7 @@ void CTrackViewDialog::ReloadSequencesComboBox() CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager(); const unsigned int numSequences = pSequenceManager->GetCount(); - for (int k = 0; k < numSequences; ++k) + for (unsigned int k = 0; k < numSequences; ++k) { CTrackViewSequence* sequence = pSequenceManager->GetSequenceByIndex(k); QString entityIdString = GetEntityIdAsString(sequence->GetSequenceComponentEntityId()); @@ -1799,7 +1799,7 @@ void CTrackViewDialog::SaveMiscSettings() const settings.setValue(s_kFrameSnappingFPSEntry, fps); settings.setValue(s_kTickDisplayModeEntry, static_cast(m_wndDopeSheet->GetTickDisplayMode())); settings.setValue(s_kDefaultTracksEntry, QByteArray(reinterpret_cast(m_defaultTracksForEntityNode.data()), - m_defaultTracksForEntityNode.size() * sizeof(AnimParamType))); + static_cast(m_defaultTracksForEntityNode.size() * sizeof(AnimParamType)))); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index c784142b3c..0ff7cc6ca9 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -1028,12 +1028,12 @@ void CTrackViewDopeSheetBase::SelectAllKeysWithinTimeFrame(const QRect& rc, cons CTrackViewTrackBundle tracks = sequence->GetAllTracks(); CTrackViewSequenceNotificationContext context(sequence); - for (int i = 0; i < tracks.GetCount(); ++i) + for (unsigned int i = 0; i < tracks.GetCount(); ++i) { CTrackViewTrack* pTrack = tracks.GetTrack(i); // Check which keys we intersect. - for (int j = 0; j < pTrack->GetKeyCount(); j++) + for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++) { CTrackViewKeyHandle keyHandle = pTrack->GetKey(j); const float time = keyHandle.GetTime(); @@ -1429,7 +1429,7 @@ bool CTrackViewDopeSheetBase::IsOkToAddKeyHere(const CTrackViewTrack* pTrack, fl { const float timeEpsilon = 0.05f; - for (int i = 0; i < pTrack->GetKeyCount(); ++i) + for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i) { const CTrackViewKeyConstHandle& keyHandle = pTrack->GetKey(i); @@ -1764,7 +1764,7 @@ float CTrackViewDopeSheetBase::MagnetSnap(float newTime, const CTrackViewAnimNod newTime = keys.GetKey(0).GetTime(); // But if there is an in-range key in a sibling track, use it instead. // Here a 'sibling' means a track that belongs to a same node. - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { CTrackViewKeyHandle keyHandle = keys.GetKey(i); if (keyHandle.GetTrack()->GetAnimNode() == pNode) diff --git a/Code/Editor/TrackView/TrackViewNode.cpp b/Code/Editor/TrackView/TrackViewNode.cpp index 882a23f6b0..d8507d9b0a 100644 --- a/Code/Editor/TrackView/TrackViewNode.cpp +++ b/Code/Editor/TrackView/TrackViewNode.cpp @@ -86,7 +86,7 @@ void CTrackViewKeyHandle::SetTime(float time, bool notifyListeners) if (!m_pTrack->IsSortMarkerKey(m_keyIndex)) { CTrackViewKeyBundle allKeys = m_pTrack->GetAllKeys(); - for (int x = 0; x < allKeys.GetKeyCount(); x++) + for (unsigned int x = 0; x < allKeys.GetKeyCount(); x++) { unsigned int curIndex = allKeys.GetKey(x).GetIndex(); if (m_pTrack->IsSortMarkerKey(curIndex)) diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index 550d36af83..4d6249288e 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -2306,7 +2306,7 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con &Maestro::EditorSequenceComponentRequestBus::Events::GetAllAnimatablePropertiesForComponent, animatableProperties, azEntityId, animNode->GetComponentId()); - paramCount = animatableProperties.size(); + paramCount = static_cast(animatableProperties.size()); } } else diff --git a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp index acabff6827..d50060269b 100644 --- a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp +++ b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp @@ -113,7 +113,7 @@ namespace AZStd::string PyTrackViewGetSequenceName(unsigned int index) { - if (index < PyTrackViewGetNumSequences()) + if (static_cast(index) < PyTrackViewGetNumSequences()) { const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager(); return pSequenceManager->GetSequenceByIndex(index)->GetName(); @@ -378,7 +378,7 @@ namespace } CTrackViewAnimNodeBundle foundNodes = pParentDirector->GetAllAnimNodes(); - if (index < 0 || index >= foundNodes.GetCount()) + if (index < 0 || index >= static_cast(foundNodes.GetCount())) { throw std::runtime_error("Invalid node index"); } diff --git a/Code/Editor/TrackView/TrackViewSequence.cpp b/Code/Editor/TrackView/TrackViewSequence.cpp index 3647c554dc..28279be0e3 100644 --- a/Code/Editor/TrackView/TrackViewSequence.cpp +++ b/Code/Editor/TrackView/TrackViewSequence.cpp @@ -455,7 +455,7 @@ void CTrackViewSequence::OnNodeChanged(CTrackViewNode* node, ITrackViewSequenceL // Make sure to deselect any keys CTrackViewKeyBundle keys = node->GetAllKeys(); - for (int key = 0; key < keys.GetKeyCount(); key++) + for (unsigned int key = 0; key < keys.GetKeyCount(); key++) { CTrackViewKeyHandle keyHandle = keys.GetKey(key); if (keyHandle.IsSelected()) @@ -1249,7 +1249,7 @@ void CTrackViewSequence::DeselectAllKeys() CTrackViewSequenceNotificationContext context(this); CTrackViewKeyBundle selectedKeys = GetSelectedKeys(); - for (int i = 0; i < selectedKeys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < selectedKeys.GetKeyCount(); ++i) { CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(i); keyHandle.Select(false); diff --git a/Code/Editor/TrackView/TrackViewSequenceManager.cpp b/Code/Editor/TrackView/TrackViewSequenceManager.cpp index 277483691a..780c8f04ce 100644 --- a/Code/Editor/TrackView/TrackViewSequenceManager.cpp +++ b/Code/Editor/TrackView/TrackViewSequenceManager.cpp @@ -227,7 +227,7 @@ void CTrackViewSequenceManager::AddTrackViewSequence(CTrackViewSequence* sequenc //////////////////////////////////////////////////////////////////////////// void CTrackViewSequenceManager::DeleteSequence(CTrackViewSequence* sequence) { - const int numSequences = m_sequences.size(); + const int numSequences = static_cast(m_sequences.size()); for (int sequenceIndex = 0; sequenceIndex < numSequences; ++sequenceIndex) { if (m_sequences[sequenceIndex].get() == sequence) @@ -246,7 +246,7 @@ void CTrackViewSequenceManager::DeleteSequence(CTrackViewSequence* sequence) { AZ::ComponentTypeList requiredComponents; AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(requiredComponents, &AzToolsFramework::EditorEntityContextRequestBus::Events::GetRequiredComponentTypes); - const int numComponentToDeleteEntity = requiredComponents.size() + 1; + const int numComponentToDeleteEntity = static_cast(requiredComponents.size() + 1); AZ::Entity::ComponentArrayType entityComponents = entity->GetComponents(); if (entityComponents.size() == numComponentToDeleteEntity) @@ -413,9 +413,9 @@ void CTrackViewSequenceManager::OnDataBaseItemEvent([[maybe_unused]] IDataBaseIt { if (event != EDataBaseItemEvent::EDB_ITEM_EVENT_ADD) { - const uint numSequences = m_sequences.size(); + const size_t numSequences = m_sequences.size(); - for (uint i = 0; i < numSequences; ++i) + for (size_t i = 0; i < numSequences; ++i) { m_sequences[i]->UpdateDynamicParams(); } diff --git a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp index c21403d1f5..4911297985 100644 --- a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp +++ b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp @@ -706,7 +706,7 @@ void CTrackViewSplineCtrl::mouseMoveEvent(QMouseEvent* event) QString tipText; bool boFoundTheSelectedKey(false); - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; CTrackViewTrack* pTrack = m_tracks[splineIndex]; @@ -796,7 +796,7 @@ void CTrackViewSplineCtrl::AdjustTCB(float d_tension, float d_continuity, float SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; CTrackViewTrack* pTrack = m_tracks[splineIndex]; @@ -892,7 +892,7 @@ void CTrackViewSplineCtrl::OnUserCommand(UINT cmd) bool CTrackViewSplineCtrl::IsUnifiedKeyCurrentlySelected() const { - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; diff --git a/Code/Editor/TrackView/TrackViewUndo.cpp b/Code/Editor/TrackView/TrackViewUndo.cpp index d0b85762a2..c9cdc62bc3 100644 --- a/Code/Editor/TrackView/TrackViewUndo.cpp +++ b/Code/Editor/TrackView/TrackViewUndo.cpp @@ -70,7 +70,7 @@ CTrackViewTrack* CUndoComponentEntityTrackObject::FindTrack(CTrackViewSequence* CTrackViewTrack* track = nullptr; CTrackViewTrackBundle allTracks = sequence->GetAllTracks(); - for (int trackIndex = 0; trackIndex < allTracks.GetCount(); trackIndex++) + for (unsigned int trackIndex = 0; trackIndex < allTracks.GetCount(); trackIndex++) { CTrackViewTrack* curTrack = allTracks.GetTrack(trackIndex); if (curTrack->GetAnimNode() && curTrack->GetAnimNode()->GetComponentId() == m_trackComponentId) diff --git a/Code/Editor/TrackViewNewSequenceDialog.cpp b/Code/Editor/TrackViewNewSequenceDialog.cpp index 0efc7a932e..287f69df47 100644 --- a/Code/Editor/TrackViewNewSequenceDialog.cpp +++ b/Code/Editor/TrackViewNewSequenceDialog.cpp @@ -78,7 +78,7 @@ void CTVNewSequenceDialog::OnOK() return; } - for (int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k) + for (unsigned int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k) { CTrackViewSequence* pSequence = GetIEditor()->GetSequenceManager()->GetSequenceByIndex(k); QString fullname = pSequence->GetName(); diff --git a/Code/Editor/Undo/Undo.cpp b/Code/Editor/Undo/Undo.cpp index 6af141b9e7..b49c6ea567 100644 --- a/Code/Editor/Undo/Undo.cpp +++ b/Code/Editor/Undo/Undo.cpp @@ -49,7 +49,7 @@ public: } void Undo(bool bUndo) override { - for (int i = m_undoSteps.size() - 1; i >= 0; i--) + for (size_t i = m_undoSteps.size() - 1; i >= 0; i--) { m_undoSteps[i]->Undo(bUndo); } @@ -624,13 +624,13 @@ void CUndoManager::SuperCancel() ////////////////////////////////////////////////////////////////////////// int CUndoManager::GetUndoStackLen() const { - return m_undoStack.size(); + return static_cast(m_undoStack.size()); } ////////////////////////////////////////////////////////////////////////// int CUndoManager::GetRedoStackLen() const { - return m_redoStack.size(); + return static_cast(m_redoStack.size()); } ////////////////////////////////////////////////////////////////////////// @@ -817,7 +817,7 @@ void CUndoManager::SignalNumUndoRedoToListeners() { for (IUndoManagerListener* listener : m_listeners) { - listener->SignalNumUndoRedo(m_undoStack.size(), m_redoStack.size()); + listener->SignalNumUndoRedo(static_cast(m_undoStack.size()), static_cast(m_redoStack.size())); } } diff --git a/Code/Editor/UndoDropDown.cpp b/Code/Editor/UndoDropDown.cpp index fbe18d5d52..6bf807ebf4 100644 --- a/Code/Editor/UndoDropDown.cpp +++ b/Code/Editor/UndoDropDown.cpp @@ -68,7 +68,7 @@ public: return 0; } - return m_stackNames.size(); + return static_cast(m_stackNames.size()); } QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override @@ -101,13 +101,13 @@ public: if (fresh.size() < m_stackNames.size()) { - beginRemoveRows(createIndex(-1, -1), fresh.size(), m_stackNames.size() - 1); + beginRemoveRows(createIndex(-1, -1), static_cast(fresh.size()), static_cast(m_stackNames.size() - 1)); m_stackNames = fresh; endRemoveRows(); } else { - beginInsertRows(createIndex(-1, -1), m_stackNames.size(), fresh.size() - 1); + beginInsertRows(createIndex(-1, -1), static_cast(m_stackNames.size()), static_cast(fresh.size() - 1)); m_stackNames = fresh; endInsertRows(); } diff --git a/Code/Editor/Util/FileUtil.cpp b/Code/Editor/Util/FileUtil.cpp index f26ffa60ec..e39adcca82 100644 --- a/Code/Editor/Util/FileUtil.cpp +++ b/Code/Editor/Util/FileUtil.cpp @@ -1228,7 +1228,7 @@ bool CFileUtil::CreatePath(const QString& strPath) nTotalPathQueueElements = cstrDirectoryQueue.size(); for (nCurrentPathQueue = 0; nCurrentPathQueue < nTotalPathQueueElements; ++nCurrentPathQueue) { - strCurrentDirectoryPath += cstrDirectoryQueue[nCurrentPathQueue]; + strCurrentDirectoryPath += cstrDirectoryQueue[static_cast(nCurrentPathQueue)]; strCurrentDirectoryPath += "\\"; // The value which will go out of this loop is the result of the attempt to create the // last directory, only. @@ -1368,8 +1368,8 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory return eCopyResult; } - QString sourceName = sourceDir.absoluteFilePath(cFiles[nCurrent]); - QString targetName = targetDir.absoluteFilePath(cFiles[nCurrent]); + QString sourceName = sourceDir.absoluteFilePath(cFiles[static_cast(nCurrent)]); + QString targetName = targetDir.absoluteFilePath(cFiles[static_cast(nCurrent)]); if (boConfirmOverwrite) { @@ -1387,7 +1387,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm file overwrite?"), QObject::tr("There is already a file named \"%1\" in the target folder. Do you want to move this file anyway replacing the old one?") - .arg(cFiles[nCurrent]), + .arg(cFiles[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1448,8 +1448,8 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory bool bnLastDirectoryWasCreated(false); - QString sourceName = sourceDir.absoluteFilePath(cDirectories[nCurrent]); - QString targetName = targetDir.absoluteFilePath(cDirectories[nCurrent]); + QString sourceName = sourceDir.absoluteFilePath(cDirectories[static_cast(nCurrent)]); + QString targetName = targetDir.absoluteFilePath(cDirectories[static_cast(nCurrent)]); bnLastDirectoryWasCreated = QDir().mkpath(targetName); @@ -1473,7 +1473,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm directory overwrite?"), QObject::tr("There is already a folder named \"%1\" in the target folder. Do you want to move this folder anyway?") - .arg(cDirectories[nCurrent]), + .arg(cDirectories[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1742,8 +1742,8 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto } bool bnLastFileWasCopied(false); - QString sourceName(sourceDir.absoluteFilePath(cFiles[nCurrent])); - QString targetName(targetDir.absoluteFilePath(cFiles[nCurrent])); + QString sourceName(sourceDir.absoluteFilePath(cFiles[static_cast(nCurrent)])); + QString targetName(targetDir.absoluteFilePath(cFiles[static_cast(nCurrent)])); if (boConfirmOverwrite) { @@ -1761,7 +1761,7 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm file overwrite?"), QObject::tr("There is already a file named \"%1\" in the target folder. Do you want to move this file anyway replacing the old one?") - .arg(cFiles[nCurrent]), + .arg(cFiles[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1822,8 +1822,8 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto return eCopyResult; } - QString sourceName(sourceDir.absoluteFilePath(cDirectories[nCurrent])); - QString targetName(targetDir.absoluteFilePath(cDirectories[nCurrent])); + QString sourceName(sourceDir.absoluteFilePath(cDirectories[static_cast(nCurrent)])); + QString targetName(targetDir.absoluteFilePath(cDirectories[static_cast(nCurrent)])); bnLastDirectoryWasCreated = QDir().mkdir(targetName); @@ -1847,7 +1847,7 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm directory overwrite?"), QObject::tr("There is already a folder named \"%1\" in the target folder. Do you want to move this folder anyway?") - .arg(cDirectories[nCurrent]), + .arg(cDirectories[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { diff --git a/Code/Editor/Util/ImageASC.cpp b/Code/Editor/Util/ImageASC.cpp index 11dad7b696..8a63ebdc6a 100644 --- a/Code/Editor/Util/ImageASC.cpp +++ b/Code/Editor/Util/ImageASC.cpp @@ -55,9 +55,9 @@ bool CImageASC::Save(const QString& fileName, const CFloatImage& image) fprintf(file, fileHeader.c_str()); // Then print all the pixels. - for (int y = 0; y < height; y++) + for (uint32 y = 0; y < height; y++) { - for (int x = 0; x < width; x++) + for (uint32 x = 0; x < width; x++) { fprintf(file, "%.7f ", pixels[x + y * width]); } diff --git a/Code/Editor/Util/ImageGif.cpp b/Code/Editor/Util/ImageGif.cpp index 2c07fc9acb..383319a666 100644 --- a/Code/Editor/Util/ImageGif.cpp +++ b/Code/Editor/Util/ImageGif.cpp @@ -185,7 +185,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage) CLogFile::FormatLine("File not found %s", fileName.toUtf8().data()); return false; } - long filesize = file.GetLength(); + long filesize = static_cast(file.GetLength()); data.resize(filesize); uint8* ptr = &data[0]; diff --git a/Code/Editor/Util/ImageTIF.cpp b/Code/Editor/Util/ImageTIF.cpp index 654b24f857..6544b93c6a 100644 --- a/Code/Editor/Util/ImageTIF.cpp +++ b/Code/Editor/Util/ImageTIF.cpp @@ -119,7 +119,7 @@ bool CImageTIF::Load(const QString& fileName, CImageEx& outImage) std::vector data; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; @@ -210,7 +210,7 @@ bool CImageTIF::Load(const QString& fileName, CFloatImage& outImage) std::vector data; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; @@ -460,7 +460,7 @@ const char* CImageTIF::GetPreset(const QString& fileName) MemImage memImage; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; diff --git a/Code/Editor/Util/ImageUtil.cpp b/Code/Editor/Util/ImageUtil.cpp index 5753e0a138..00e33162cf 100644 --- a/Code/Editor/Util/ImageUtil.cpp +++ b/Code/Editor/Util/ImageUtil.cpp @@ -106,9 +106,9 @@ bool CImageUtil::SavePGM(const QString& fileName, const CImageEx& image) fprintf(file, fileHeader.c_str()); // Then print all the pixels. - for (int32 y = 0; y < height; y++) + for (uint32 y = 0; y < height; y++) { - for (int32 x = 0; x < width; x++) + for (uint32 x = 0; x < width; x++) { fprintf(file, "%d ", pixels[x + (y * width)]); } @@ -478,7 +478,7 @@ unsigned char CImageUtil::GetBilinearFilteredAt(const int iniX256, const int ini DWORD x = (DWORD)(iniX256) >> 8; DWORD y = (DWORD)(iniY256) >> 8; - if (x >= image.GetWidth() - 1 || y >= image.GetHeight() - 1) + if (x >= static_cast(image.GetWidth() - 1) || y >= static_cast(image.GetHeight() - 1)) { return image.ValueAt(x, y); // border is not filtered, 255 to get in range 0..1 } diff --git a/Code/Editor/Util/KDTree.cpp b/Code/Editor/Util/KDTree.cpp index 4547149e9b..182b9b8eb1 100644 --- a/Code/Editor/Util/KDTree.cpp +++ b/Code/Editor/Util/KDTree.cpp @@ -190,7 +190,7 @@ bool SearchForBestSplitPos(CKDTree::ESplitAxis axis, const std::vector(indices.size()); for (int i = 0; i < nSizeOfIndices; ++i) { @@ -329,7 +329,7 @@ bool CKDTree::Build(IStatObj* pStatObj) entireBoundBox.Reset(); std::vector indices; - for (int i = 0, iStatObjSize(m_StatObjectList.size()); i < iStatObjSize; ++i) + for (int i = 0, iStatObjSize = static_cast(m_StatObjectList.size()); i < iStatObjSize; ++i) { IIndexedMesh* pMesh = m_StatObjectList[i].pStatObj->GetIndexedMesh(true); if (pMesh == nullptr) diff --git a/Code/Editor/Util/NamedData.cpp b/Code/Editor/Util/NamedData.cpp index 240d71f58d..67e69a0392 100644 --- a/Code/Editor/Util/NamedData.cpp +++ b/Code/Editor/Util/NamedData.cpp @@ -158,7 +158,7 @@ bool CNamedData::Serialize(CArchive& ar) { if (ar.IsStoring()) { - int iSize = m_blocks.size(); + int iSize = static_cast(m_blocks.size()); ar << iSize; for (TBlocks::iterator it = m_blocks.begin(); it != m_blocks.end(); it++) @@ -286,7 +286,7 @@ bool CNamedData::Load(const QString& levelPath, [[maybe_unused]] CPakFile& pakFi CCryFile cfile; if (cfile.Open(Path::Make(levelPath, filename).toUtf8().data(), "rb")) { - int fileSize = cfile.GetLength(); + int fileSize = static_cast(cfile.GetLength()); if (fileSize > 0) { QString key = Path::GetFileName(filename); @@ -307,7 +307,7 @@ bool CNamedData::Load(const QString& levelPath, [[maybe_unused]] CPakFile& pakFi CCryFile cfile; if (cfile.Open(Path::Make(levelPath, filename).toUtf8().data(), "rb")) { - int fileSize = cfile.GetLength(); + int fileSize = static_cast(cfile.GetLength()); if (fileSize > 0) { // Read uncompressed data size. diff --git a/Code/Editor/Util/Variable.cpp b/Code/Editor/Util/Variable.cpp index 97c2a1e8af..3d7c35ac1c 100644 --- a/Code/Editor/Util/Variable.cpp +++ b/Code/Editor/Util/Variable.cpp @@ -511,7 +511,7 @@ CVarGlobalEnumList::CVarGlobalEnumList(const QString& enumName) //! Get the name of specified value in enumeration. QString CVarGlobalEnumList::GetItemName(uint index) { - if (!m_pEnum || index >= m_pEnum->strings.size()) + if (!m_pEnum || index >= static_cast(m_pEnum->strings.size())) { return QString(); } diff --git a/Code/Editor/Util/XmlArchive.cpp b/Code/Editor/Util/XmlArchive.cpp index ca399632d4..e6bc93fdf4 100644 --- a/Code/Editor/Util/XmlArchive.cpp +++ b/Code/Editor/Util/XmlArchive.cpp @@ -120,7 +120,7 @@ bool CXmlArchive::SaveToPak([[maybe_unused]] const QString& levelPath, CPakFile& // Save xml file. QString xmlFilename = "Level.editor_xml"; - pakFile.UpdateFile(xmlFilename.toUtf8().data(), (void*)pXmlStrData->GetString(), pXmlStrData->GetStringLength()); + pakFile.UpdateFile(xmlFilename.toUtf8().data(), (void*)pXmlStrData->GetString(), static_cast(pXmlStrData->GetStringLength())); if (pakFile.GetArchive()) { diff --git a/Code/Editor/WipFeatureManager.cpp b/Code/Editor/WipFeatureManager.cpp index f6fbc7ac93..4fb9ed1d93 100644 --- a/Code/Editor/WipFeatureManager.cpp +++ b/Code/Editor/WipFeatureManager.cpp @@ -189,7 +189,7 @@ bool CWipFeatureManager::Load(const char* pFilename, bool bClearExisting) for (size_t i = 0, iCount = root->getChildCount(); i < iCount; ++i) { SWipFeatureInfo wf; - XmlNodeRef node = root->getChild(i); + XmlNodeRef node = root->getChild(static_cast(i)); XmlString str; node->getAttr("id", wf.m_id); diff --git a/Code/Editor/WipFeaturesDlg.cpp b/Code/Editor/WipFeaturesDlg.cpp index 0d0a179539..bc4372d7fb 100644 --- a/Code/Editor/WipFeaturesDlg.cpp +++ b/Code/Editor/WipFeaturesDlg.cpp @@ -35,7 +35,7 @@ public: int rowCount(const QModelIndex& parent = QModelIndex()) const override { - return parent.isValid() ? 0 : CWipFeatureManager::Instance()->GetFeatures().size(); + return parent.isValid() ? 0 : static_cast(CWipFeatureManager::Instance()->GetFeatures().size()); } int columnCount(const QModelIndex& parent = QModelIndex()) const override