diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index b69bfa78f3..3673367c12 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -1883,11 +1883,6 @@ void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove) ////////////////////////////////////////////////////////////////////////// void CCryEditApp::LoadFile(QString fileName) { - //CEditCommandLineInfo cmdLine; - //ProcessCommandLine(cmdinfo); - - //bool bBuilding = false; - //CString file = cmdLine.SpanExcluding() if (GetIEditor()->GetViewManager()->GetViewCount() == 0) { return; diff --git a/Code/Editor/CryEditPy.cpp b/Code/Editor/CryEditPy.cpp index 6abaf933fe..7e07d5553d 100644 --- a/Code/Editor/CryEditPy.cpp +++ b/Code/Editor/CryEditPy.cpp @@ -210,7 +210,7 @@ namespace const char* PyGetCurrentLevelName() { // Using static member to capture temporary data - static AZStd::string tempLevelName; + static AZStd::fixed_string tempLevelName; tempLevelName = GetIEditor()->GetGameEngine()->GetLevelName().toUtf8().data(); return tempLevelName.c_str(); } @@ -218,7 +218,7 @@ namespace const char* PyGetCurrentLevelPath() { // Using static member to capture temporary data - static AZStd::string tempLevelPath; + static AZStd::fixed_string tempLevelPath; tempLevelPath = GetIEditor()->GetGameEngine()->GetLevelPath().toUtf8().data(); return tempLevelPath.c_str(); } diff --git a/Code/Editor/GenericSelectItemDialog.cpp b/Code/Editor/GenericSelectItemDialog.cpp index ef109336ef..59c7986a68 100644 --- a/Code/Editor/GenericSelectItemDialog.cpp +++ b/Code/Editor/GenericSelectItemDialog.cpp @@ -91,20 +91,6 @@ void CGenericSelectItemDialog::ReloadTree() QTreeWidgetItem* hSelected = nullptr; - /* - std::vector::const_iterator iter = m_items.begin(); - while (iter != m_items.end()) - { - const CString& itemName = *iter; - HTREEITEM hItem = m_tree.InsertItem(itemName, 0, 0, TVI_ROOT, TVI_SORT); - if (!m_preselect.IsEmpty() && m_preselect.CompareNoCase(itemName) == 0) - { - hSelected = hItem; - } - ++iter; - } - */ - std::map items; QRegularExpression sep(QStringLiteral("[\\/.") + m_treeSeparator + QStringLiteral("]+")); diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 76c6f34181..56e91a6806 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -572,9 +572,6 @@ void CLogFile::OnWriteToConsole(const char* sText, bool bNewLine) } if (bNewLine) { - //str = CString("\r\n") + str.TrimLeft(); - //str = CString("\r\n") + str; - //str = CString("\r") + str; str = QString("\r\n") + str; str = str.trimmed(); } diff --git a/Code/Editor/QtUtil.h b/Code/Editor/QtUtil.h index a9aaadc491..380f4dfa4a 100644 --- a/Code/Editor/QtUtil.h +++ b/Code/Editor/QtUtil.h @@ -34,7 +34,6 @@ public: namespace QtUtil { - // Replacement for CString::trimRight() inline QString trimRight(const QString& str) { // We prepend a char, so that the left doesn't get trimmed, then we remove it after trimming diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp index 8f86c74b25..ae4fa75d41 100644 --- a/Code/Editor/Settings.cpp +++ b/Code/Editor/Settings.cpp @@ -656,22 +656,6 @@ void SEditorSettings::Save() ////////////////////////////////////////////////////////////////////////// SaveValue("Settings\\Slices", "DynamicByDefault", sliceSettings.dynamicByDefault); - /* - ////////////////////////////////////////////////////////////////////////// - // Save paths. - ////////////////////////////////////////////////////////////////////////// - for (int id = 0; id < EDITOR_PATH_LAST; id++) - { - for (int i = 0; i < searchPaths[id].size(); i++) - { - CString path = searchPaths[id][i]; - CString key; - key.Format( "Paths","Path_%.2d_%.2d",id,i ); - SaveValue( "Paths",key,path ); - } - } - */ - s_editorSettings()->sync(); // --- Settings Registry values diff --git a/Code/Editor/Util/EditorUtils.cpp b/Code/Editor/Util/EditorUtils.cpp index 8f56e4d956..9f42a5da83 100644 --- a/Code/Editor/Util/EditorUtils.cpp +++ b/Code/Editor/Util/EditorUtils.cpp @@ -30,30 +30,6 @@ void HeapCheck::Check([[maybe_unused]] const char* file, [[maybe_unused]] int li _ASSERTE(_CrtCheckMemory()); #endif - /* - int heapstatus = _heapchk(); - switch( heapstatus ) - { - case _HEAPOK: - break; - case _HEAPEMPTY: - break; - case _HEAPBADBEGIN: - { - CString str; - str.Format( "Bad Start of Heap, at file %s line:%d",file,line ); - MessageBox( NULL,str,"Heap Check",MB_OK ); - } - break; - case _HEAPBADNODE: - { - CString str; - str.Format( "Bad Node in Heap, at file %s line:%d",file,line ); - MessageBox( NULL,str,"Heap Check",MB_OK ); - } - break; - } - */ #endif } diff --git a/Code/Editor/Util/PathUtil.cpp b/Code/Editor/Util/PathUtil.cpp index 2f99f42188..22c638e289 100644 --- a/Code/Editor/Util/PathUtil.cpp +++ b/Code/Editor/Util/PathUtil.cpp @@ -245,8 +245,8 @@ namespace Path /// Get the data folder AZStd::string GetEditingGameDataFolder() { - static AZStd::string s_currentModName; - // query the editor root. The bus exists in case we want tools to be able to override this. + // Define here the mod name + static AZStd::fixed_string s_currentModName; if (s_currentModName.empty()) { diff --git a/Code/Legacy/CryCommon/CryTypeInfo.cpp b/Code/Legacy/CryCommon/CryTypeInfo.cpp index ffadc732b0..5f0cb47b63 100644 --- a/Code/Legacy/CryCommon/CryTypeInfo.cpp +++ b/Code/Legacy/CryCommon/CryTypeInfo.cpp @@ -131,7 +131,8 @@ const CTypeInfo&PtrTypeInfo() // bool AZStd::string ToString(bool const& val) { - static AZStd::string sTrue = "true", sFalse = "false"; + static AZStd::fixed_string sTrue = "true"; + static AZStd::fixed_string sFalse = "false"; return val ? sTrue : sFalse; } diff --git a/Code/Legacy/CrySystem/SystemWin32.cpp b/Code/Legacy/CrySystem/SystemWin32.cpp index 66be2a2ca5..b114c9bf12 100644 --- a/Code/Legacy/CrySystem/SystemWin32.cpp +++ b/Code/Legacy/CrySystem/SystemWin32.cpp @@ -173,7 +173,7 @@ int CSystem::GetApplicationInstance() AZStd::wstring suffix; for (int instance = 0;; ++instance) { - suffix = AZStd::wstring::format(L"LumberyardApplication(%d)", instance); + suffix = AZStd::wstring::format(L"O3DEApplication(%d)", instance); CreateMutexW(NULL, TRUE, suffix.c_str()); // search for duplicates @@ -222,25 +222,6 @@ struct CryDbgModule }; #ifdef WIN32 -////////////////////////////////////////////////////////////////////////// -class CStringOrder -{ -public: - bool operator () (const char* szLeft, const char* szRight) const {return azstricmp(szLeft, szRight) < 0; } -}; -typedef std::map StringToSizeMap; -void AddSize (StringToSizeMap& mapSS, const char* szString, unsigned nSize) -{ - StringToSizeMap::iterator it = mapSS.find (szString); - if (it == mapSS.end()) - { - mapSS.insert (StringToSizeMap::value_type(szString, nSize)); - } - else - { - it->second += nSize; - } -} ////////////////////////////////////////////////////////////////////////// const char* GetModuleGroup (const char* szString) diff --git a/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp b/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp index 55fab84286..e74b457191 100644 --- a/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp +++ b/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp @@ -15,7 +15,7 @@ #define TAG_SCRIPT_TYPE "t" #define TAG_SCRIPT_NAME "n" -//#define LOG_SERIALIZE_STACK(tag,szName) CryLogAlways( "<%s> %s/%s",tag,GetStackInfo(),szName ); +//#define LOG_SERIALIZE_STACK(tag,szName) CryLogAlways( "<%s> %s/%s",tag,GetStackInfo().c_str(), szName); #define LOG_SERIALIZE_STACK(tag, szName) CSerializeXMLReaderImpl::CSerializeXMLReaderImpl(const XmlNodeRef& nodeRef) @@ -175,10 +175,9 @@ void CSerializeXMLReaderImpl::EndGroup() } ////////////////////////////////////////////////////////////////////////// -const char* CSerializeXMLReaderImpl::GetStackInfo() const +AZStd::string CSerializeXMLReaderImpl::GetStackInfo() const { - static AZStd::string str; - str.assign(""); + AZStd::string str; for (int i = 0; i < (int)m_nodeStack.size(); i++) { const char* name = m_nodeStack[i].m_node->getAttr(TAG_SCRIPT_NAME); @@ -195,7 +194,7 @@ const char* CSerializeXMLReaderImpl::GetStackInfo() const str += "/"; } } - return str.c_str(); + return str; } void CSerializeXMLReaderImpl::GetMemoryUsage(ICrySizer* pSizer) const diff --git a/Code/Legacy/CrySystem/XML/SerializeXMLReader.h b/Code/Legacy/CrySystem/XML/SerializeXMLReader.h index 177db0ffaa..f87350d3fe 100644 --- a/Code/Legacy/CrySystem/XML/SerializeXMLReader.h +++ b/Code/Legacy/CrySystem/XML/SerializeXMLReader.h @@ -88,7 +88,7 @@ public: void BeginGroup(const char* szName); bool BeginOptionalGroup(const char* szName, bool condition); void EndGroup(); - const char* GetStackInfo() const; + AZStd::string GetStackInfo() const; void GetMemoryUsage(ICrySizer* pSizer) const; diff --git a/Code/Legacy/CrySystem/XML/SerializeXMLWriter.cpp b/Code/Legacy/CrySystem/XML/SerializeXMLWriter.cpp index 26007eb229..ce3fbcc2b1 100644 --- a/Code/Legacy/CrySystem/XML/SerializeXMLWriter.cpp +++ b/Code/Legacy/CrySystem/XML/SerializeXMLWriter.cpp @@ -64,14 +64,14 @@ void CSerializeXMLWriterImpl::BeginGroup(const char* szName) if (strchr(szName, ' ') != 0) { assert(0 && "Spaces in group name not supported"); - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Spaces in group name not supported: %s/%s", GetStackInfo(), szName); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Spaces in group name not supported: %s/%s", GetStackInfo().c_str(), szName); } XmlNodeRef node = CreateNodeNamed(szName); CurNode()->addChild(node); m_nodeStack.push_back(node); if (m_nodeStack.size() > MAX_NODE_STACK_DEPTH) { - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Too Deep Node Stack:\r\n%s", GetStackInfo()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Too Deep Node Stack:\r\n%s", GetStackInfo().c_str()); } } @@ -112,10 +112,9 @@ void CSerializeXMLWriterImpl::GetMemoryUsage(ICrySizer* pSizer) const } ////////////////////////////////////////////////////////////////////////// -const char* CSerializeXMLWriterImpl::GetStackInfo() const +AZStd::string CSerializeXMLWriterImpl::GetStackInfo() const { - static AZStd::string str; - str.assign(""); + AZStd::string str; for (int i = 0; i < (int)m_nodeStack.size(); i++) { const char* name = m_nodeStack[i]->getAttr(TAG_SCRIPT_NAME); @@ -132,14 +131,13 @@ const char* CSerializeXMLWriterImpl::GetStackInfo() const str += "/"; } } - return str.c_str(); + return str; } ////////////////////////////////////////////////////////////////////////// -const char* CSerializeXMLWriterImpl::GetLuaStackInfo() const +AZStd::string CSerializeXMLWriterImpl::GetLuaStackInfo() const { - static AZStd::string str; - str.assign(""); + AZStd::string str; for (int i = 0; i < (int)m_luaSaveStack.size(); i++) { const char* name = m_luaSaveStack[i]; @@ -149,5 +147,5 @@ const char* CSerializeXMLWriterImpl::GetLuaStackInfo() const str += "."; } } - return str.c_str(); + return str; } diff --git a/Code/Legacy/CrySystem/XML/SerializeXMLWriter.h b/Code/Legacy/CrySystem/XML/SerializeXMLWriter.h index 41dbe3dd7b..5f3e9f2c53 100644 --- a/Code/Legacy/CrySystem/XML/SerializeXMLWriter.h +++ b/Code/Legacy/CrySystem/XML/SerializeXMLWriter.h @@ -77,7 +77,7 @@ private: if (strchr(name, ' ') != 0) { assert(0 && "Spaces in Value name not supported"); - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Spaces in Value name not supported: %s in Group %s", name, GetStackInfo()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Spaces in Value name not supported: %s in Group %s", name, GetStackInfo().c_str()); return; } if (GetISystem()->IsDevMode() && CurNode()) @@ -86,7 +86,7 @@ private: if (CurNode()->haveAttr(name)) { assert(0); - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Duplicate tag Value( \"%s\" ) in Group %s", name, GetStackInfo()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Duplicate tag Value( \"%s\" ) in Group %s", name, GetStackInfo().c_str()); } } @@ -115,8 +115,8 @@ private: } // Used for printing currebnt stack info for warnings. - const char* GetStackInfo() const; - const char* GetLuaStackInfo() const; + AZStd::string GetStackInfo() const; + AZStd::string GetLuaStackInfo() const; ////////////////////////////////////////////////////////////////////////// // Check For Defaults. diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryNode.h b/Code/Legacy/CrySystem/XML/XMLBinaryNode.h index cd9ce04e6c..34e0ca22ce 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryNode.h +++ b/Code/Legacy/CrySystem/XML/XMLBinaryNode.h @@ -189,8 +189,6 @@ public: bool getAttr(const char* key, Vec3d& value) const; bool getAttr(const char* key, Quat& value) const; bool getAttr(const char* key, ColorB& value) const; - // bool getAttr( const char *key,CString &value ) const { XmlString v; if (getAttr(key,v)) { value = (const char*)v; return true; } else return false; } - private: ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Tools/SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h b/Code/Tools/SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h index d3b31913dd..b759fea158 100644 --- a/Code/Tools/SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h +++ b/Code/Tools/SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h @@ -18,7 +18,8 @@ namespace AZ { namespace DataTypes { - const static AZStd::string s_advancedDisabledString = "Disabled"; + const static AZStd::fixed_string s_advancedDisabledString = "Disabled"; + class IMeshAdvancedRule : public IRule { diff --git a/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.cpp b/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.cpp index cf0f0a6f56..e41e39dd0a 100644 --- a/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.cpp +++ b/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.cpp @@ -18,10 +18,10 @@ namespace AZ { namespace DataTypes = AZ::SceneAPI::DataTypes; - const AZStd::string MaterialData::s_DiffuseMapName = "Diffuse"; - const AZStd::string MaterialData::s_SpecularMapName = "Specular"; - const AZStd::string MaterialData::s_BumpMapName = "Bump"; - const AZStd::string MaterialData::s_emptyString = ""; + const AZStd::fixed_string<8> MaterialData::s_DiffuseMapName = "Diffuse"; + const AZStd::fixed_string<9> MaterialData::s_SpecularMapName = "Specular"; + const AZStd::fixed_string<5> MaterialData::s_BumpMapName = "Bump"; + const AZStd::fixed_string<1> MaterialData::s_emptyString = ""; MaterialData::MaterialData() : m_isNoDraw(false) diff --git a/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.h b/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.h index 8cc9de8352..8c8f8bd66e 100644 --- a/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.h +++ b/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.h @@ -96,10 +96,10 @@ namespace AZ bool m_isNoDraw; - const static AZStd::string s_DiffuseMapName; - const static AZStd::string s_SpecularMapName; - const static AZStd::string s_BumpMapName; - const static AZStd::string s_emptyString; + const static AZStd::fixed_string<8> s_DiffuseMapName; + const static AZStd::fixed_string<9> s_SpecularMapName; + const static AZStd::fixed_string<5> s_BumpMapName; + const static AZStd::fixed_string<1> s_emptyString; // A unique id which is used to identify a material in a fbx. // This is the same as the ID in the fbx file's FbxNode diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Editor/EditorCommon.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Editor/EditorCommon.cpp index 9938d55502..8ce8b2d487 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Editor/EditorCommon.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Editor/EditorCommon.cpp @@ -57,10 +57,10 @@ namespace ImageProcessingAtomEditor static double mb = kb * 1024.0; static double gb = mb * 1024.0; - static AZStd::string byteStr = "B"; - static AZStd::string kbStr = "KB"; - static AZStd::string mbStr = "MB"; - static AZStd::string gbStr = "GB"; + static AZStd::fixed_string<2> byteStr = "B"; + static AZStd::fixed_string<3> kbStr = "KB"; + static AZStd::fixed_string<3> mbStr = "MB"; + static AZStd::fixed_string<3> gbStr = "GB"; #if AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX kb = 1000.0; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.cpp index 2d3a8b9eda..cfdcd704c5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.cpp @@ -284,8 +284,7 @@ namespace EMStudio fpsNumFrames = 0; } - static AZStd::string perfTempString; - perfTempString = AZStd::string::format("%d FPS (%.1f ms)", lastFPS, renderTime); + const AZStd::string perfTempString = AZStd::string::format("%d FPS (%.1f ms)", lastFPS, renderTime); // initialize the painter and get the font metrics //painter.setBrush( Qt::NoBrush );