diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp index 54bf38aaa0..6badd2fe1e 100644 --- a/Code/Legacy/CryCommon/platform_impl.cpp +++ b/Code/Legacy/CryCommon/platform_impl.cpp @@ -10,13 +10,14 @@ #include #include #include -#include #include #include #include #include #include +#include +#include // Section dictionary #if defined(AZ_RESTRICTED_PLATFORM) @@ -245,18 +246,23 @@ int CryMessageBox([[maybe_unused]] const char* lpText, [[maybe_unused]] const ch { return 0; } - return MessageBox(NULL, lpText, lpCaption, uType); + AZStd::wstring lpTextW; + AZStd::to_wstring(lpTextW, lpText); + AZStd::wstring lpCaptionW; + AZStd::to_wstring(lpCaptionW, lpCaption); + return MessageBoxW(NULL, lpTextW.c_str(), lpCaptionW.c_str(), uType); #else return 0; #endif } // Initializes root folder of the game, optionally returns exe and path name. -void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], [[maybe_unused]] uint nRootSize) +void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], uint nRootSize) { - WCHAR szPath[_MAX_PATH]; - size_t nLen = GetModuleFileNameW(GetModuleHandle(NULL), szPath, _MAX_PATH); - assert(nLen < _MAX_PATH && "The path to the current executable exceeds the expected length"); + char szPath[_MAX_PATH]; + AZ::Utils::GetExecutablePathReturnType ret = AZ::Utils::GetExecutablePath(szPath, _MAX_PATH); + AZ_Assert(ret.m_pathStored == AZ::Utils::ExecutablePathResult::Success, "The path to the current executable exceeds the expected length"); + const size_t nLen = strnlen(szPath, _MAX_PATH); // Find path above exe name and deepest folder. bool firstIteration = true; @@ -271,25 +277,27 @@ void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], [[ma // Return exe path if (szExeRootName) { - Unicode::Convert(szExeRootName, n+1, szPath); + azstrncpy(szExeRootName, nRootSize, szPath + n + 1, nLen - n - 1); } // Return exe name if (szExeFileName) { - Unicode::Convert(szExeFileName, nExeSize, szPath + n); + azstrncpy(szExeFileName, nExeSize, szPath + n, nLen - n); } firstIteration = false; } // Check if the engineroot exists - wcscat_s(szPath, L"\\engine.json"); + azstrcat(szPath, "\\engine.json"); WIN32_FILE_ATTRIBUTE_DATA data; - BOOL res = GetFileAttributesExW(szPath, GetFileExInfoStandard, &data); + AZStd::wstring szPathW; + AZStd::to_wstring(szPathW, szPath); + BOOL res = GetFileAttributesExW(szPathW.c_str(), GetFileExInfoStandard, &data); if (res != 0 && data.dwFileAttributes != INVALID_FILE_ATTRIBUTES) { // Found file szPath[n] = 0; - SetCurrentDirectoryW(szPath); + SetCurrentDirectoryW(szPathW.c_str()); break; } } @@ -423,7 +431,9 @@ uint32 CryGetFileAttributes(const char* lpFileName) #if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED) #undef AZ_RESTRICTED_SECTION_IMPLEMENTED #else - res = GetFileAttributesEx(lpFileName, GetFileExInfoStandard, &data); + AZStd::wstring lpFileNameW; + AZStd::to_wstring(lpFileNameW, lpFileName); + res = GetFileAttributesExW(lpFileNameW.c_str(), GetFileExInfoStandard, &data); #endif return res ? data.dwFileAttributes : -1; } @@ -438,7 +448,9 @@ bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes) #if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED) #undef AZ_RESTRICTED_SECTION_IMPLEMENTED #else - return SetFileAttributes(lpFileName, dwFileAttributes) != 0; + AZStd::wstring lpFileNameW; + AZStd::to_wstring(lpFileNameW, lpFileName); + return SetFileAttributes(lpFileNameW.c_str(), dwFileAttributes) != 0; #endif } diff --git a/Code/Legacy/CrySystem/ConsoleHelpGen.cpp b/Code/Legacy/CrySystem/ConsoleHelpGen.cpp index ff86577258..661487a299 100644 --- a/Code/Legacy/CrySystem/ConsoleHelpGen.cpp +++ b/Code/Legacy/CrySystem/ConsoleHelpGen.cpp @@ -6,13 +6,13 @@ * */ +#if defined(WIN32) || defined(WIN64) #include "CrySystem_precompiled.h" -#if defined(WIN32) || defined(WIN64) - #include "ConsoleHelpGen.h" #include "System.h" +#include @@ -132,7 +132,7 @@ void CConsoleHelpGen::LogVersion(FILE* f) const char s[1024]; { - GetModuleFileName(NULL, s, sizeof(s)); + AZ::Utils::GetExecutablePath(s, 1024); char fdir[_MAX_PATH]; char fdrive[_MAX_PATH]; diff --git a/Code/Legacy/CrySystem/DebugCallStack.cpp b/Code/Legacy/CrySystem/DebugCallStack.cpp index c5d932429c..289d4070ff 100644 --- a/Code/Legacy/CrySystem/DebugCallStack.cpp +++ b/Code/Legacy/CrySystem/DebugCallStack.cpp @@ -18,6 +18,7 @@ #include #include +#include #define VS_VERSION_INFO 1 #define IDD_CRITICAL_ERROR 101 @@ -400,7 +401,11 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex) timeStamp = tempBuffer; AZStd::string backupFileName = backupPath + timeStamp + " error.log"; - CopyFile(fileName.c_str(), backupFileName.c_str(), true); + AZStd::wstring fileNameW; + AZStd::to_wstring(fileNameW, fileName.c_str()); + AZStd::wstring backupFileNameW; + AZStd::to_wstring(backupFileNameW, backupFileName.c_str()); + CopyFileW(fileNameW.c_str(), backupFileNameW.c_str(), true); } } @@ -594,7 +599,11 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex) } AZStd::string backupFileName = backupPath + timeStamp + " error.dmp"; - CopyFile(fileName.c_str(), backupFileName.c_str(), true); + AZStd::wstring fileNameW; + AZStd::to_wstring(fileNameW, fileName.c_str()); + AZStd::wstring backupFileNameW; + AZStd::to_wstring(backupFileNameW, backupFileName.c_str()); + CopyFileW(fileNameW.c_str(), backupFileNameW.c_str(), true); } CryEngineExceptionFilterMiniDump(pex, fileName.c_str(), mdumpValue); @@ -635,11 +644,11 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex) { if (SaveCurrentLevel()) { - MessageBox(NULL, "Level has been successfully saved!\r\nPress Ok to terminate Editor.", "Save", MB_OK); + MessageBoxW(NULL, L"Level has been successfully saved!\r\nPress Ok to terminate Editor.", L"Save", MB_OK); } else { - MessageBox(NULL, "Error saving level.\r\nPress Ok to terminate Editor.", "Save", MB_OK | MB_ICONWARNING); + MessageBoxW(NULL, L"Error saving level.\r\nPress Ok to terminate Editor.", L"Save", MB_OK | MB_ICONWARNING); } } } @@ -855,7 +864,7 @@ void DebugCallStack::GetProcNameForAddr(void* addr, AZStd::string& procName, voi AZStd::string DebugCallStack::GetCurrentFilename() { char fullpath[MAX_PATH_LENGTH + 1]; - GetModuleFileName(NULL, fullpath, MAX_PATH_LENGTH); + AZ::Utils::GetExecutablePath(fullpath, MAX_PATH_LENGTH); return fullpath; } diff --git a/Code/Legacy/CrySystem/IDebugCallStack.cpp b/Code/Legacy/CrySystem/IDebugCallStack.cpp index ff43f6e56f..bee43b237b 100644 --- a/Code/Legacy/CrySystem/IDebugCallStack.cpp +++ b/Code/Legacy/CrySystem/IDebugCallStack.cpp @@ -187,7 +187,7 @@ AZ_PUSH_DISABLE_WARNING(4996, "-Wunknown-warning-option") azstrcat(str, length, "\n"); #if AZ_LEGACY_CRYSYSTEM_TRAIT_DEBUGCALLSTACK_APPEND_MODULENAME - GetModuleFileNameA(NULL, s, sizeof(s)); + AZ::Utils::GetExecutablePath(s, sizeof(s)); // Log EXE filename only if possible (not full EXE path which could contain sensitive info) AZStd::string exeName; diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index e3ccb22f88..42bdb3afef 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -25,6 +25,7 @@ #include #include +#include #define MAX_CELL_COUNT 32 @@ -2329,12 +2330,11 @@ bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, AZStd::strin } } -template -void InternalFormatStringMessage(StringClass& outString, const StringClass& sString, const CharType** sParams, int nParams) +void InternalFormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char** sParams, int nParams) { - static const CharType token = (CharType) '%'; - static const CharType tokens1[2] = { token, (CharType) '\0' }; - static const CharType tokens2[3] = { token, token, (CharType) '\0' }; + static const char token = '%'; + static const char tokens1[2] = { token, '\0' }; + static const char tokens2[3] = { token, token, '\0' }; int maxArgUsed = 0; int lastPos = 0; @@ -2342,8 +2342,8 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr const int sourceLen = sString.length(); while (true) { - int foundPos = sString.find(token, curPos); - if (foundPos != string::npos) + auto foundPos = sString.find(token, curPos); + if (foundPos != AZStd::string::npos) { if (foundPos + 1 < sourceLen) { @@ -2360,8 +2360,8 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr } else { - StringClass tmp (sString); - tmp.replace(tokens1, tokens2); + AZStd::string tmp(sString); + AZ::StringFunc::Replace(tmp, tokens1, tokens2); if constexpr (sizeof(*tmp.c_str()) == sizeof(char)) { CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "Parameter for argument %d is missing. [%s]", nArg + 1, (const char*)tmp.c_str()); @@ -2391,11 +2391,10 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr } } -template -void InternalFormatStringMessage(StringClass& outString, const StringClass& sString, const CharType* param1, const CharType* param2 = 0, const CharType* param3 = 0, const CharType* param4 = 0) +void InternalFormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0) { static const int MAX_PARAMS = 4; - const CharType* params[MAX_PARAMS] = { param1, param2, param3, param4 }; + const char* params[MAX_PARAMS] = { param1, param2, param3, param4 }; int nParams = 0; while (nParams < MAX_PARAMS && params[nParams]) { @@ -2677,7 +2676,7 @@ void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool localtime_s(&thetime, &t); t = gEnv->pTimer->DateToSecondsUTC(thetime); } - outTimeString.resize(0); + outTimeString.clear(); LCID lcID = g_currentLanguageID.lcID ? g_currentLanguageID.lcID : LOCALE_USER_DEFAULT; DWORD flags = bShowSeconds == false ? TIME_NOSECONDS : 0; SYSTEMTIME systemTime; @@ -2689,7 +2688,7 @@ void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool AZStd::fixed_wstring<256> tmpString; tmpString.resize(len); ::GetTimeFormatW(lcID, flags, &systemTime, 0, (wchar_t*) tmpString.c_str(), len); - Unicode::Convert(outTimeString, tmpString); + AZStd::to_string(outTimeString, tmpString.data()); } } @@ -2719,7 +2718,7 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool tmpString.resize(len); ::GetDateFormatW(lcID, 0, &systemTime, L"ddd", (wchar_t*) tmpString.c_str(), len); AZStd::string utf8; - Unicode::Convert(utf8, tmpString); + AZStd::to_string(utf8, tmpString.data()); outDateString.append(utf8); outDateString.append(" "); } @@ -2732,7 +2731,7 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool tmpString.resize(len); ::GetDateFormatW(lcID, flags, &systemTime, 0, (wchar_t*) tmpString.c_str(), len); AZStd::string utf8; - Unicode::Convert(utf8, tmpString); + AZStd::to_string(utf8, tmpString.data()); outDateString.append(utf8); } } diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index c23ed6e264..6ee6af6c22 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -18,7 +18,6 @@ #include #include "System.h" #include "CryPath.h" // PathUtil::ReplaceExtension() -#include "UnicodeFunctions.h" #include #include @@ -1052,13 +1051,7 @@ void CLog::LogStringToFile(const char* szString, ELogType logType, bool bAdd, [[ #if !defined(_RELEASE) if (queueState == MessageQueueState::NotQueued) { - // Note: OutputDebugString(A) only accepts current ANSI code-page, and the W variant will call the A variant internally. - // Here we replace non-ASCII characters with '?', which is the same as OutputDebugStringW will do for non-ANSI. - // Thus, we discard slightly more characters (ie, those inside the current ANSI code-page, but outside ASCII). - // In exchange, we save double-converting that would have happened otherwise (UTF-8 -> UTF-16 -> ANSI). - LogStringType asciiString; - Unicode::ConvertSafe(asciiString, tempString); - OutputDebugString(asciiString.c_str()); + AZ::Debug::Platform::OutputToDebugger(nullptr, tempString.c_str()); } if (!bIsMainThread) @@ -1224,8 +1217,8 @@ void CLog::CreateBackupFile() const AZStd::string sFileWithoutExt = PathUtil::GetFileName(m_szFilename); { - assert(::strstr(sFileWithoutExt, ":") == 0); - assert(::strstr(sFileWithoutExt, "\\") == 0); + assert(::strstr(sFileWithoutExt.c_str(), ":") == 0); + assert(::strstr(sFileWithoutExt.c_str(), "\\") == 0); } PathUtil::RemoveExtension(sFileWithoutExt); @@ -1255,11 +1248,9 @@ void CLog::CreateBackupFile() const if (sName.find("BackupNameAttachment=") == AZStd::string::npos) { -#ifdef WIN32 - OutputDebugString("Log::CreateBackupFile ERROR '"); - OutputDebugString(sName.c_str()); - OutputDebugString("' not recognized \n"); -#endif + AZ::Debug::Platform::OutputToDebugger("CrySystem Log", "Log::CreateBackupFile ERROR '"); + AZ::Debug::Platform::OutputToDebugger(nullptr, sName.c_str()); + AZ::Debug::Platform::OutputToDebugger(nullptr, "' not recognized \n"); assert(0); // broken log file? - first line should include this name - written by LogVersion() return; } diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index 9c2e1b1129..8c42c4a027 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -1148,7 +1148,7 @@ void CSystem::WarningV(EValidatorModule module, EValidatorSeverity severity, int if (sModuleFilter && *sModuleFilter != 0) { const char* sModule = ValidatorModuleToString(module); - if (strlen(sModule) > 1 || CryStringUtils::stristr(sModule, sModuleFilter) == 0) + if (strlen(sModule) > 1 || AZ::StringFunc::Find(sModule, sModuleFilter) == AZStd::string::npos) { // Filter out warnings from other modules. return; @@ -1215,13 +1215,13 @@ void CSystem::GetLocalizedPath(const char* sLanguage, AZStd::string& sLocalizedP } else { - if (sLocalizationFolder.compareNoCase("Languages") != 0) - { - sLocalizedPath = sLocalizationFolder + "/" + sLanguage + "_xml.pak"; - } - else - { - sLocalizedPath = AZStd::string("Localized/") + sLanguage + "_xml.pak"; + if (AZ::StringFunc::Equal(sLocalizationFolder, "Languages", false)) + { + sLocalizedPath = sLocalizationFolder + "/" + sLanguage + "_xml.pak"; + } + else + { + sLocalizedPath = AZStd::string("Localized/") + sLanguage + "_xml.pak"; } } } @@ -1233,7 +1233,7 @@ void CSystem::GetLocalizedAudioPath(const char* sLanguage, AZStd::string& sLocal AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder()); sLocalizationFolder.pop_back(); - if (sLocalizationFolder.compareNoCase("Languages") != 0) + if (AZ::StringFunc::Equal(sLocalizationFolder, "Languages", false)) { sLocalizedPath = sLocalizationFolder + "/" + sLanguage + ".pak"; } diff --git a/Code/Legacy/CrySystem/SystemCFG.cpp b/Code/Legacy/CrySystem/SystemCFG.cpp index 062713c015..4d193c72a5 100644 --- a/Code/Legacy/CrySystem/SystemCFG.cpp +++ b/Code/Legacy/CrySystem/SystemCFG.cpp @@ -114,20 +114,22 @@ void CSystem::QueryVersionInfo() char ver[1024 * 8]; - GetModuleFileName(NULL, moduleName, _MAX_PATH); //retrieves the PATH for the current module + AZ::Utils::GetExecutablePath(moduleName, _MAX_PATH); //retrieves the PATH for the current module #ifdef AZ_MONOLITHIC_BUILD - GetModuleFileName(NULL, moduleName, _MAX_PATH); //retrieves the PATH for the current module + AZ::Utils::GetExecutablePath(moduleName, _MAX_PATH); //retrieves the PATH for the current module #else // AZ_MONOLITHIC_BUILD azstrcpy(moduleName, AZ_ARRAY_SIZE(moduleName), "CrySystem.dll"); // we want to version from the system dll #endif // AZ_MONOLITHIC_BUILD - int verSize = GetFileVersionInfoSize(moduleName, &dwHandle); + AZStd::wstring moduleNameW; + AZStd::to_wstring(moduleNameW, moduleName); + int verSize = GetFileVersionInfoSizeW(moduleNameW.c_str(), &dwHandle); if (verSize > 0) { - GetFileVersionInfo(moduleName, dwHandle, 1024 * 8, ver); + GetFileVersionInfoW(moduleNameW.c_str(), dwHandle, 1024 * 8, ver); VS_FIXEDFILEINFO* vinfo; - VerQueryValue(ver, "\\", (void**)&vinfo, &len); + VerQueryValueW(ver, L"\\", (void**)&vinfo, &len); const uint32 verIndices[4] = {0, 1, 2, 3}; m_fileVersion.v[verIndices[0]] = m_productVersion.v[verIndices[0]] = vinfo->dwFileVersionLS & 0xFFFF; @@ -143,14 +145,14 @@ void CSystem::QueryVersionInfo() }* lpTranslate; UINT count = 0; - char path[256]; + wchar_t path[256]; char* version = NULL; - VerQueryValue(ver, "\\VarFileInfo\\Translation", (LPVOID*)&lpTranslate, &count); + VerQueryValueW(ver, L"\\VarFileInfo\\Translation", (LPVOID*)&lpTranslate, &count); if (lpTranslate != NULL) { - azsnprintf(path, sizeof(path), "\\StringFileInfo\\%04x%04x\\InternalName", lpTranslate[0].wLanguage, lpTranslate[0].wCodePage); - VerQueryValue(ver, path, (LPVOID*)&version, &count); + azsnwprintf(path, sizeof(path), L"\\StringFileInfo\\%04x%04x\\InternalName", lpTranslate[0].wLanguage, lpTranslate[0].wCodePage); + VerQueryValueW(ver, path, (LPVOID*)&version, &count); if (version) { m_buildVersion.Set(version); @@ -211,7 +213,7 @@ void CSystem::LogVersion() CryLogAlways("Running 64 bit Mac version"); #endif #if AZ_LEGACY_CRYSYSTEM_TRAIT_SYSTEMCFG_MODULENAME - GetModuleFileName(NULL, s, sizeof(s)); + AZ::Utils::GetExecutablePath(s, sizeof(s)); // Log EXE filename only if possible (not full EXE path which could contain sensitive info) AZStd::string exeName; @@ -448,25 +450,24 @@ bool CSystemConfiguration::ParseSystemConfig() } AZStd::string strLine = s; + AZ::StringFunc::TrimWhiteSpace(strLine, true, true); // detect groups e.g. "[General]" should set strGroup="General" { - AZStd::string strTrimmedLine(RemoveWhiteSpaces(strLine)); - size_t size = strTrimmedLine.size(); + size_t size = strLine.size(); if (size >= 3) { - if (strTrimmedLine[0] == '[' && strTrimmedLine[size - 1] == ']') // currently no comments are allowed to be behind groups + if (strLine[0] == '[' && strLine[size - 1] == ']') // currently no comments are allowed to be behind groups { - strGroup = &strTrimmedLine[1]; - strGroup.resize(size - 2); // remove [ and ] + strGroup = &strLine[1]; + strGroup.resize(size - 2); // remove [ and ] continue; // next line } } } //trim all whitespace characters at the beginning and the end of the current line and store its size - AZ::StringFunc::TrimWhiteSpace(strLine, true, true); size_t strLineSize = strLine.size(); //skip comments, comments start with ";" or "--" but may have preceding whitespace characters @@ -491,8 +492,9 @@ bool CSystemConfiguration::ParseSystemConfig() AZStd::string::size_type posEq(strLine.find("=", 0)); if (AZStd::string::npos != posEq) { - AZStd::string stemp(strLine, 0, posEq); - AZStd::string strKey(RemoveWhiteSpaces(stemp)); + AZStd::string stemp; + AZStd::string strKey(strLine, 0, posEq); + AZ::StringFunc::TrimWhiteSpace(strKey, true, true); { // extract value @@ -507,8 +509,8 @@ bool CSystemConfiguration::ParseSystemConfig() } else { - AZStd::string strTmp(strLine, posEq + 1, strLine.size() - (posEq + 1)); - strValue = RemoveWhiteSpaces(strTmp); + strValue = AZStd::string(strLine, posEq + 1, strLine.size() - (posEq + 1)); + AZ::StringFunc::TrimWhiteSpace(strValue, true, true); } { diff --git a/Code/Legacy/CrySystem/SystemCFG.h b/Code/Legacy/CrySystem/SystemCFG.h index cfaefd2e45..7ec6f1231b 100644 --- a/Code/Legacy/CrySystem/SystemCFG.h +++ b/Code/Legacy/CrySystem/SystemCFG.h @@ -25,12 +25,6 @@ public: CSystemConfiguration(const AZStd::string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing = true); ~CSystemConfiguration(); - AZStd::string RemoveWhiteSpaces(AZStd::string& s) - { - s.Trim(); - return s; - } - bool IsError() const { return m_bError; } private: // ---------------------------------------- diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index ae177a9974..0c1411e649 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -451,7 +451,7 @@ AZStd::unique_ptr CSystem::LoadDLL(const char* dllName) ////////////////////////////////////////////////////////////////////////// // After loading DLL initialize it by calling ModuleInitISystem ////////////////////////////////////////////////////////////////////////// - string moduleName = PathUtil::GetFileName(dllName); + AZStd::string moduleName = PathUtil::GetFileName(dllName); typedef void*(*PtrFunc_ModuleInitISystem)(ISystem* pSystem, const char* moduleName); PtrFunc_ModuleInitISystem pfnModuleInitISystem = handle->GetFunction(DLL_MODULE_INIT_ISYSTEM); @@ -523,7 +523,7 @@ void CSystem::ShutdownModuleLibraries() ///////////////////////////////////////////////////////////////////////////////// #if defined(WIN32) || defined(WIN64) -wstring GetErrorStringUnsupportedGPU(const char* gpuName, unsigned int gpuVendorId, unsigned int gpuDeviceId) +AZStd::wstring GetErrorStringUnsupportedGPU(const char* gpuName, unsigned int gpuVendorId, unsigned int gpuDeviceId) { const size_t fullLangID = (size_t) GetKeyboardLayout(0); const size_t primLangID = fullLangID & 0x3FF; @@ -877,19 +877,19 @@ void CSystem::InitLocalization() languageID = ILocalizationManager::EPlatformIndependentLanguageID::ePILID_English_US; } - string language = m_pLocalizationManager->LangNameFromPILID(languageID); + AZStd::string language = m_pLocalizationManager->LangNameFromPILID(languageID); m_pLocalizationManager->SetLanguage(language.c_str()); if (m_pLocalizationManager->GetLocalizationFormat() == 1) { - string translationsListXML = LOCALIZATION_TRANSLATIONS_LIST_FILE_NAME; - m_pLocalizationManager->InitLocalizationData(translationsListXML); + AZStd::string translationsListXML = LOCALIZATION_TRANSLATIONS_LIST_FILE_NAME; + m_pLocalizationManager->InitLocalizationData(translationsListXML.c_str()); m_pLocalizationManager->LoadAllLocalizationData(); } else { // if the language value cannot be found, let's default to the english pak - OpenLanguagePak(language); + OpenLanguagePak(language.c_str()); } if (auto console = AZ::Interface::Get(); console != nullptr) @@ -907,7 +907,7 @@ void CSystem::InitLocalization() } } } - OpenLanguageAudioPak(language); + OpenLanguageAudioPak(language.c_str()); } void CSystem::OpenBasicPaks() @@ -971,10 +971,10 @@ void CSystem::OpenLanguagePak(const char* sLanguage) // Initialize languages. // Omit the trailing slash! - string sLocalizationFolder = PathUtil::GetLocalizationFolder(); + AZStd::string sLocalizationFolder = PathUtil::GetLocalizationFolder(); // load xml pak with full filenames to perform wildcard searches. - string sLocalizedPath; + AZStd::string sLocalizedPath; GetLocalizedPath(sLanguage, sLocalizedPath); if (!m_env.pCryPak->OpenPacks({ sLocalizationFolder.c_str(), sLocalizationFolder.size() }, { sLocalizedPath.c_str(), sLocalizedPath.size() }, 0)) { @@ -1001,15 +1001,15 @@ void CSystem::OpenLanguageAudioPak([[maybe_unused]] const char* sLanguage) int nPakFlags = 0; // Omit the trailing slash! - string sLocalizationFolder(string().assign(PathUtil::GetLocalizationFolder(), 0, PathUtil::GetLocalizationFolder().size() - 1)); + AZStd::string sLocalizationFolder(AZStd::string().assign(PathUtil::GetLocalizationFolder(), 0, PathUtil::GetLocalizationFolder().size() - 1)); - if (sLocalizationFolder.compareNoCase("Languages") == 0) + if (!AZ::StringFunc::Equal(sLocalizationFolder, "Languages", false)) { sLocalizationFolder = "@assets@"; } // load localized pak with crc32 filenames on consoles to save memory. - string sLocalizedPath = "loc.pak"; + AZStd::string sLocalizedPath = "loc.pak"; if (!m_env.pCryPak->OpenPacks(sLocalizationFolder.c_str(), sLocalizedPath.c_str(), nPakFlags)) { @@ -1019,10 +1019,10 @@ void CSystem::OpenLanguageAudioPak([[maybe_unused]] const char* sLanguage) } -string GetUniqueLogFileName(string logFileName) +AZStd::string GetUniqueLogFileName(AZStd::string logFileName) { - string logFileNamePrefix = logFileName; - if ((logFileNamePrefix[0] != '@') && (AzFramework::StringFunc::Path::IsRelative(logFileNamePrefix))) + AZStd::string logFileNamePrefix = logFileName; + if ((logFileNamePrefix[0] != '@') && (AzFramework::StringFunc::Path::IsRelative(logFileNamePrefix.c_str()))) { logFileNamePrefix = "@log@/"; logFileNamePrefix += logFileName; @@ -1038,9 +1038,9 @@ string GetUniqueLogFileName(string logFileName) return logFileNamePrefix; } - string logFileExtension; + AZStd::string logFileExtension; size_t extensionIndex = logFileName.find_last_of('.'); - if (extensionIndex != string::npos) + if (extensionIndex != AZStd::string::npos) { logFileExtension = logFileName.substr(extensionIndex, logFileName.length() - extensionIndex); logFileNamePrefix = logFileName.substr(0, extensionIndex); @@ -1214,7 +1214,7 @@ bool CSystem::Init(const SSystemInitParams& startupParams) osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); AZ_PUSH_DISABLE_WARNING(4996, "-Wunknown-warning-option") - GetVersionExA(&osvi); + GetVersionExW(&osvi); AZ_POP_DISABLE_WARNING bool bIsWindowsXPorLater = osvi.dwMajorVersion > 5 || (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 1); @@ -1309,7 +1309,7 @@ AZ_POP_DISABLE_WARNING } else if (startupParams.sLogFileName) //otherwise see if the startup params has a log file name, if so use it { - const string sUniqueLogFileName = GetUniqueLogFileName(startupParams.sLogFileName); + const AZStd::string sUniqueLogFileName = GetUniqueLogFileName(startupParams.sLogFileName); m_env.pLog->SetFileName(sUniqueLogFileName.c_str(), startupParams.autoBackupLogs); } else//use the default log name @@ -1657,20 +1657,20 @@ static void LoadConfigurationCmd(IConsoleCmdArgs* pParams) return; } - GetISystem()->LoadConfiguration(string("Config/") + pParams->GetArg(1)); + GetISystem()->LoadConfiguration((AZStd::string("Config/") + pParams->GetArg(1)).c_str()); } // -------------------------------------------------------------------------------------------------------------------------- -static string ConcatPath(const char* szPart1, const char* szPart2) +static AZStd::string ConcatPath(const char* szPart1, const char* szPart2) { if (szPart1[0] == 0) { return szPart2; } - string ret; + AZStd::string ret; ret.reserve(strlen(szPart1) + 1 + strlen(szPart2)); @@ -2134,12 +2134,12 @@ void CSystem::CreateAudioVars() } ///////////////////////////////////////////////////////////////////// -void CSystem::AddCVarGroupDirectory(const string& sPath) +void CSystem::AddCVarGroupDirectory(const AZStd::string& sPath) { CryLog("creating CVarGroups from directory '%s' ...", sPath.c_str()); INDENT_LOG_DURING_SCOPE(); - AZ::IO::ArchiveFileIterator handle = gEnv->pCryPak->FindFirst(ConcatPath(sPath, "*.cfg").c_str()); + AZ::IO::ArchiveFileIterator handle = gEnv->pCryPak->FindFirst(ConcatPath(sPath.c_str(), "*.cfg").c_str()); if (!handle) { @@ -2152,16 +2152,9 @@ void CSystem::AddCVarGroupDirectory(const string& sPath) { if (handle.m_filename != "." && handle.m_filename != "..") { - AddCVarGroupDirectory(ConcatPath(sPath, handle.m_filename.data())); + AddCVarGroupDirectory(ConcatPath(sPath.c_str(), handle.m_filename.data())); } } - else - { - string sFilePath = ConcatPath(sPath, handle.m_filename.data()); - - string sCVarName = sFilePath; - PathUtil::RemoveExtension(sCVarName); - } } while (handle = gEnv->pCryPak->FindNext(handle)); gEnv->pCryPak->FindClose(handle); diff --git a/Code/Legacy/CrySystem/SystemWin32.cpp b/Code/Legacy/CrySystem/SystemWin32.cpp index a4be0e5054..9fd01f1905 100644 --- a/Code/Legacy/CrySystem/SystemWin32.cpp +++ b/Code/Legacy/CrySystem/SystemWin32.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include // for AZ_MAX_PATH_LEN #include @@ -127,7 +126,7 @@ const char* CSystem::GetUserName() DWORD dwSize = iNameBufferSize; wchar_t nameW[iNameBufferSize]; ::GetUserNameW(nameW, &dwSize); - azstrcpy(szNameBuffer, CryStringUtils::WStrToUTF8(nameW)); + AZStd::to_string(szNameBuffer, iNameBufferSize, nameW, dwSize); return szNameBuffer; #else #if defined(LINUX) @@ -171,12 +170,12 @@ int CSystem::GetApplicationInstance() // this code below essentially "locks" an instance of the USER folder to a specific running application if (m_iApplicationInstance == -1) { - string suffix; + AZStd::wstring suffix; for (int instance = 0;; ++instance) { - suffix.Format("(%d)", instance); + suffix = AZStd::wstring::format(L"LumberyardApplication(%d)", instance); - CreateMutex(NULL, TRUE, "LumberyardApplication" + suffix); + CreateMutexW(NULL, TRUE, suffix.c_str()); // search for duplicates if (GetLastError() != ERROR_ALREADY_EXISTS) { @@ -195,13 +194,13 @@ int CSystem::GetApplicationInstance() int CSystem::GetApplicationLogInstance([[maybe_unused]] const char* logFilePath) { #if AZ_TRAIT_OS_USE_WINDOWS_MUTEX - string suffix; + AZStd::wstring suffix; int instance = 0; for (;; ++instance) { - suffix.Format("(%d)", instance); + suffix = AZStd::wstring::format(L"%s(%d)", logFilePath, instance); - CreateMutex(NULL, TRUE, logFilePath + suffix); + CreateMutexW(NULL, TRUE, suffix.c_str()); if (GetLastError() != ERROR_ALREADY_EXISTS) { break; @@ -218,7 +217,7 @@ struct CryDbgModule { HANDLE heap; WIN_HMODULE handle; - string name; + AZStd::string name; DWORD dwSize; }; @@ -343,12 +342,15 @@ void CSystem::FatalError(const char* format, ...) assert(szBuffer[0] >= ' '); // strcpy(szBuffer,szBuffer+1); // remove verbosity tag since it is not supported by ::MessageBox - OutputDebugString(szBuffer); + AZ::Debug::Platform::OutputToDebugger("CrySystem", szBuffer); + #ifdef WIN32 OnFatalError(szBuffer); if (!g_cvars.sys_no_crash_dialog) { - ::MessageBox(NULL, szBuffer, "Open 3D Engine Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); + AZStd::wstring szBufferW; + AZStd::to_wstring(szBufferW, szBuffer); + ::MessageBoxW(NULL, szBufferW.c_str(), L"Open 3D Engine Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); } // Dump callstack. @@ -461,20 +463,20 @@ bool CSystem::ReLaunchMediaCenter() } // Get the path to Media Center - char szExpandedPath[AZ_MAX_PATH_LEN]; - if (!ExpandEnvironmentStrings("%SystemRoot%\\ehome\\ehshell.exe", szExpandedPath, AZ_MAX_PATH_LEN)) + wchar_t szExpandedPath[AZ_MAX_PATH_LEN]; + if (!ExpandEnvironmentStringsW(L"%SystemRoot%\\ehome\\ehshell.exe", szExpandedPath, AZ_MAX_PATH_LEN)) { return false; } // Skip if ehshell.exe doesn't exist - if (GetFileAttributes(szExpandedPath) == 0xFFFFFFFF) + if (GetFileAttributesW(szExpandedPath) == 0xFFFFFFFF) { return false; } // Launch ehshell.exe - INT_PTR result = (INT_PTR)ShellExecute(NULL, TEXT("open"), szExpandedPath, NULL, NULL, SW_SHOWNORMAL); + INT_PTR result = (INT_PTR)ShellExecuteW(NULL, TEXT("open"), szExpandedPath, NULL, NULL, SW_SHOWNORMAL); return (result > 32); } #else @@ -491,7 +493,7 @@ bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize) bool bSucceeded = false; // check Vista and later OS first - HMODULE shell32 = LoadLibraryA("Shell32.dll"); + HMODULE shell32 = LoadLibraryW(L"Shell32.dll"); if (shell32) { typedef long (__stdcall * T_SHGetKnownFolderPath)(REFKNOWNFOLDERID rfid, unsigned long dwFlags, void* hToken, wchar_t** ppszPath); @@ -505,7 +507,7 @@ bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize) if (bSucceeded) { // Convert from UNICODE to UTF-8 - azstrcpy(szMyDocumentsPath, maxPathSize, CryStringUtils::WStrToUTF8(wMyDocumentsPath)); + AZStd::to_string(szMyDocumentsPath, maxPathSize, wMyDocumentsPath); CoTaskMemFree(wMyDocumentsPath); } } @@ -519,7 +521,7 @@ bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize) bSucceeded = SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, wMyDocumentsPath)); if (bSucceeded) { - azstrcpy(szMyDocumentsPath, maxPathSize, CryStringUtils::WStrToUTF8(wMyDocumentsPath)); + AZStd::to_string(szMyDocumentsPath, maxPathSize, wMyDocumentsPath); } } @@ -547,7 +549,7 @@ void CSystem::DetectGameFolderAccessRights() BOOL bAccessStatus = FALSE; // Get a pointer to the existing DACL. - dwRes = GetNamedSecurityInfo(".", SE_FILE_OBJECT, + dwRes = GetNamedSecurityInfoW(L".", SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, &pSD); diff --git a/Code/Legacy/CrySystem/WindowsErrorReporting.cpp b/Code/Legacy/CrySystem/WindowsErrorReporting.cpp index a02f55b69e..d467923c74 100644 --- a/Code/Legacy/CrySystem/WindowsErrorReporting.cpp +++ b/Code/Legacy/CrySystem/WindowsErrorReporting.cpp @@ -66,7 +66,9 @@ LONG WINAPI CryEngineExceptionFilterMiniDump(struct _EXCEPTION_POINTERS* pExcept return EXCEPTION_CONTINUE_SEARCH; } - HANDLE hFile = ::CreateFile(szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + AZStd::wstring szDumpPathW; + AZStd::to_wstring(szDumpPathW, szDumpPath); + HANDLE hFile = ::CreateFileW(szDumpPathW.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { CryLogAlways("Failed to record DMP file: could not open file '%s' for writing - error code: %d", szDumpPath, GetLastError()); diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index a69d86e8b7..f5e946be43 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -15,9 +15,6 @@ #include "XConsoleVariable.h" #include "System.h" #include "ConsoleBatchFile.h" -#include "StringUtils.h" -#include "UnicodeFunctions.h" -#include "UnicodeIterator.h" #include #include @@ -88,11 +85,13 @@ inline int GetCharPrio(char x) } } // case sensitive -inline bool less_CVar(const char* left, const char* right) +inline bool less_CVar(const AZStd::string& left, const AZStd::string& right) { + AZStd::string_view leftView(left); + AZStd::string_view rightView(right); for (;; ) { - uint32 l = GetCharPrio(*left), r = GetCharPrio(*right); + uint32 l = GetCharPrio(leftView.front()), r = GetCharPrio(rightView.front()); if (l < r) { @@ -103,13 +102,13 @@ inline bool less_CVar(const char* left, const char* right) return false; } - if (*left == 0 || *right == 0) + if (leftView.front() == 0 || rightView.front() == 0) { break; } - ++left; - ++right; + leftView.remove_prefix(1); + rightView.remove_prefix(1); } return false; @@ -149,7 +148,7 @@ void Bind(IConsoleCmdArgs* cmdArgs) { if (cmdArgs->GetArgCount() >= 3) { - string arg; + AZStd::string arg; for (int i = 2; i < cmdArgs->GetArgCount(); ++i) { arg += cmdArgs->GetArg(i); @@ -414,9 +413,7 @@ void CXConsole::Init(ISystem* pSystem) void CXConsole::LogChangeMessage(const char* name, const bool isConst, const bool isCheat, const bool isReadOnly, const bool isDeprecated, const char* oldValue, const char* newValue, [[maybe_unused]] const bool isProcessingGroup, const bool allowChange) { - string logMessage; - - logMessage.Format + AZStd::string logMessage = AZStd::string::format ("[CVARS]: [%s] variable [%s] from [%s] to [%s]%s; Marked as%s%s%s%s", (allowChange) ? "CHANGED" : "IGNORED CHANGE", name, @@ -452,7 +449,7 @@ void CXConsole::RegisterVar(ICVar* pCVar, ConsoleVarFunc pChangeFunc) bool isReadOnly = ((pCVar->GetFlags() & VF_READONLY) != 0); bool isDeprecated = ((pCVar->GetFlags() & VF_DEPRECATED) != 0); - ConfigVars::iterator it = m_configVars.find(CONST_TEMP_STRING(pCVar->GetName())); + ConfigVars::iterator it = m_configVars.find(pCVar->GetName()); if (it != m_configVars.end()) { SConfigVar& var = it->second; @@ -906,7 +903,7 @@ void CXConsole::DumpKeyBinds(IKeyBindDumpSink* pCallback) //////////////////////////////////////////////////////////////////////////////////////////////////////////////// const char* CXConsole::FindKeyBind(const char* sCmd) const { - ConsoleBindsMap::const_iterator it = m_mapBinds.find(CONST_TEMP_STRING(sCmd)); + ConsoleBindsMap::const_iterator it = m_mapBinds.find(sCmd); if (it != m_mapBinds.end()) { @@ -1263,9 +1260,7 @@ bool CXConsole::ProcessInput(const AzFramework::InputChannel& inputChannel) if (m_nCursorPos) { const char* pCursor = m_sInputBuffer.c_str() + m_nCursorPos; - Unicode::CIterator pUnicode(pCursor); - --pUnicode; // Note: This moves back one UCS code-point, but doesn't necessarily match one displayed character (ie, combining diacritics) - pCursor = pUnicode.GetPosition(); + pCursor -= Utf8::Internal::sequence_length(pCursor); // Note: This moves back one UCS code-point, but doesn't necessarily match one displayed character (ie, combining diacritics) m_nCursorPos = pCursor - m_sInputBuffer.c_str(); } return true; @@ -1275,9 +1270,7 @@ bool CXConsole::ProcessInput(const AzFramework::InputChannel& inputChannel) if (m_nCursorPos < (int)(m_sInputBuffer.length())) { const char* pCursor = m_sInputBuffer.c_str() + m_nCursorPos; - Unicode::CIterator pUnicode(pCursor); - ++pUnicode; // Note: This moves forward one UCS code-point, but doesn't necessarily match one displayed character (ie, combining diacritics) - pCursor = pUnicode.GetPosition(); + pCursor += Utf8::Internal::sequence_length(pCursor); // Note: This moves forward one UCS code-point, but doesn't necessarily match one displayed character (ie, combining diacritics) m_nCursorPos = pCursor - m_sInputBuffer.c_str(); } return true; @@ -1446,7 +1439,7 @@ bool CXConsole::GetLineNo(const int indwLineNo, char* outszBuffer, const int ind { buf++; // to jump over verbosity level character } - cry_strcpy(outszBuffer, indwBufferSize, buf); + azstrcpy(outszBuffer, indwBufferSize, buf); return true; } @@ -1558,27 +1551,27 @@ const char* CXConsole::GetFlagsString(const uint32 dwFlags) if (dwFlags & VF_READONLY) { - cry_strcat(sFlags, "READONLY, "); + azstrcat(sFlags, "READONLY, "); } if (dwFlags & VF_DEPRECATED) { - cry_strcat(sFlags, "DEPRECATED, "); + azstrcat(sFlags, "DEPRECATED, "); } if (dwFlags & VF_DUMPTODISK) { - cry_strcat(sFlags, "DUMPTODISK, "); + azstrcat(sFlags, "DUMPTODISK, "); } if (dwFlags & VF_REQUIRE_LEVEL_RELOAD) { - cry_strcat(sFlags, "REQUIRE_LEVEL_RELOAD, "); + azstrcat(sFlags, "REQUIRE_LEVEL_RELOAD, "); } if (dwFlags & VF_REQUIRE_APP_RESTART) { - cry_strcat(sFlags, "REQUIRE_APP_RESTART, "); + azstrcat(sFlags, "REQUIRE_APP_RESTART, "); } if (dwFlags & VF_RESTRICTEDMODE) { - cry_strcat(sFlags, "RESTRICTEDMODE, "); + azstrcat(sFlags, "RESTRICTEDMODE, "); } if (sFlags[0] != 0) @@ -1794,7 +1787,7 @@ void CXConsole::DisplayHelp(const char* help, const char* name) char* start, * pos; for (pos = strstr((char*)help, "\n"), start = (char*)help; pos; start = ++pos) { - string s = start; + AZStd::string s = start; s.resize(pos - start); ConsoleLogInputResponse(" $3%s", s.c_str()); pos = strstr(pos, "\n"); @@ -1816,11 +1809,12 @@ void CXConsole::ExecuteString(const char* command, const bool bSilentMode, const // Store the string commands into a list and defer the execution for later. // The commands will be processed in CXConsole::Update() - string str(command); - str.TrimLeft(); + AZStd::string str(command); + AZ::StringFunc::TrimWhiteSpace(str, true, false); // Unroll the exec command - bool unroll = (0 == str.Left(strlen("exec")).compareNoCase("exec")); + + bool unroll = (0 == AZ::StringFunc::Find(str, "exec", 0, false, false)); if (unroll) { @@ -1858,10 +1852,10 @@ void CXConsole::ResetCVarsToDefaults() } -void CXConsole::SplitCommands(const char* line, std::list& split) +void CXConsole::SplitCommands(const char* line, std::list& split) { const char* start = line; - string working; + AZStd::string working; while (true) { @@ -1881,7 +1875,7 @@ void CXConsole::SplitCommands(const char* line, std::list& split) case '\0': { working.assign(start, line - 1); - working.Trim(); + AZ::StringFunc::TrimWhiteSpace(working, true, true); if (!working.empty()) { @@ -1931,15 +1925,15 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso ConsoleCommandsMapItor itrCmd; ConsoleVariablesMapItor itrVar; - std::list lineCommands; + std::list lineCommands; SplitCommands(command, lineCommands); - string sTemp; - string sCommand, sLineCommand; + AZStd::string sTemp; + AZStd::string sCommand, sLineCommand; while (!lineCommands.empty()) { - string::size_type nPos; + AZStd::string::size_type nPos; { sTemp = lineCommands.front(); @@ -1951,17 +1945,17 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso { if (GetStatus()) { - AddLine(sTemp); + AddLine(sTemp.c_str()); } } nPos = sTemp.find_first_of('='); - if (nPos != string::npos) + if (nPos != AZStd::string::npos) { sCommand = sTemp.substr(0, nPos); } - else if ((nPos = sTemp.find_first_of(' ')) != string::npos) + else if ((nPos = sTemp.find_first_of(' ')) != AZStd::string::npos) { sCommand = sTemp.substr(0, nPos); } @@ -1970,7 +1964,7 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso sCommand = sTemp; } - sCommand.Trim(); + AZ::StringFunc::TrimWhiteSpace(sCommand, true, true); ////////////////////////////////////////// // Search for CVars @@ -2005,7 +1999,7 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso ////////////////////////////////////////// //Check if is a variable - itrVar = m_mapVariables.find(sCommand); + itrVar = m_mapVariables.find(sCommand.c_str()); if (itrVar != m_mapVariables.end()) { ICVar* pCVar = itrVar->second; @@ -2017,10 +2011,10 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso m_blockCounter++; } - if (nPos != string::npos) + if (nPos != AZStd::string::npos) { sTemp = sTemp.substr(nPos + 1); // remove the command from sTemp - sTemp.Trim(" \t\r\n\"\'"); + AZ::StringFunc::StripEnds(sTemp, " \t\r\n\"\'"); if (sTemp == "?") { @@ -2094,12 +2088,12 @@ void CXConsole::ExecuteDeferredCommands() } ////////////////////////////////////////////////////////////////////////// -void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDevMode) +void CXConsole::ExecuteCommand(CConsoleCommand& cmd, AZStd::string& str, bool bIgnoreDevMode) { CryLog ("[CONSOLE] Executing console command '%s'", str.c_str()); INDENT_LOG_DURING_SCOPE(); - std::vector args; + std::vector args; size_t t; { @@ -2118,7 +2112,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe { ; } - args.push_back(string(start + 1, commandLine - 1)); + args.push_back(AZStd::string(start + 1, commandLine - 1)); start = commandLine; break; } @@ -2129,7 +2123,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe { if ((*commandLine == ' ') || !*commandLine) { - args.push_back(string(start, commandLine)); + args.push_back(AZStd::string(start, commandLine)); start = commandLine + 1; } } @@ -2139,7 +2133,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe if (args.size() >= 2 && args[1] == "?") { - DisplayHelp(cmd.m_sHelp, cmd.m_sName.c_str()); + DisplayHelp(cmd.m_sHelp.c_str(), cmd.m_sName.c_str()); return; } @@ -2166,13 +2160,13 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe return; } - string buf; + AZStd::string buf; { // only do this for commands with script implementation for (;; ) { t = str.find_first_of("\\", t); - if (t == string::npos) + if (t == AZStd::string::npos) { break; } @@ -2183,7 +2177,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe for (t = 1;; ) { t = str.find_first_of("\"", t); - if (t == string::npos) + if (t == AZStd::string::npos) { break; } @@ -2194,9 +2188,9 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe buf = cmd.m_sCommand; size_t pp = buf.find("%%"); - if (pp != string::npos) + if (pp != AZStd::string::npos) { - string list = ""; + AZStd::string list = ""; for (unsigned int i = 1; i < args.size(); i++) { list += "\"" + args[i] + "\""; @@ -2207,9 +2201,9 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe } buf.replace(pp, 2, list); } - else if ((pp = buf.find("%line")) != string::npos) + else if ((pp = buf.find("%line")) != AZStd::string::npos) { - string tmp = "\"" + str.substr(str.find(" ") + 1) + "\""; + AZStd::string tmp = "\"" + str.substr(str.find(" ") + 1) + "\""; if (args.size() > 1) { buf.replace(pp, 5, tmp); @@ -2226,7 +2220,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe char pat[10]; azsprintf(pat, "%%%d", i); size_t pos = buf.find(pat); - if (pos == string::npos) + if (pos == AZStd::string::npos) { if (i != args.size()) { @@ -2241,7 +2235,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe ConsoleWarning("Not enough arguments for: %s", cmd.m_sName.c_str()); return; } - string arg = "\"" + args[i] + "\""; + AZStd::string arg = "\"" + args[i] + "\""; buf.replace(pos, strlen(pat), arg); } } @@ -2340,15 +2334,15 @@ const char* CXConsole::ProcessCompletion(const char* szInputBuffer) } //try to search in command list bool bArgumentAutoComplete = false; - std::vector matches; + std::vector matches; - if (m_sPrevTab.find(' ') != string::npos) + if (m_sPrevTab.find(' ') != AZStd::string::npos) { bool bProcessAutoCompl = true; // Find command. - string sVar = m_sPrevTab.substr(0, m_sPrevTab.find(' ')); - ICVar* pCVar = GetCVar(sVar); + AZStd::string sVar = m_sPrevTab.substr(0, m_sPrevTab.find(' ')); + ICVar* pCVar = GetCVar(sVar.c_str()); if (pCVar) { if (!(pCVar->GetFlags() & VF_RESTRICTEDMODE) && con_restricted) // in restricted mode we allow only VF_RESTRICTEDMODE CVars&CCmd @@ -2376,7 +2370,7 @@ const char* CXConsole::ProcessCompletion(const char* szInputBuffer) int nMatches = pArgumentAutoComplete->GetCount(); for (int i = 0; i < nMatches; i++) { - string cmd = string(sVar) + " " + pArgumentAutoComplete->GetValue(i); + AZStd::string cmd = AZStd::string(sVar) + " " + pArgumentAutoComplete->GetValue(i); if (_strnicmp(m_sPrevTab.c_str(), cmd.c_str(), m_sPrevTab.length()) == 0) { { @@ -2436,10 +2430,10 @@ const char* CXConsole::ProcessCompletion(const char* szInputBuffer) { ConsoleLogInput(" "); // empty line before auto completion - for (std::vector::iterator i = matches.begin(); i != matches.end(); ++i) + for (std::vector::iterator i = matches.begin(); i != matches.end(); ++i) { // List matching variables - const char* sVar = *i; + const char* sVar = i->c_str(); ICVar* pVar = GetCVar(sVar); if (pVar) @@ -2453,7 +2447,7 @@ const char* CXConsole::ProcessCompletion(const char* szInputBuffer) } } - for (std::vector::iterator i = matches.begin(); i != matches.end(); ++i) + for (std::vector::iterator i = matches.begin(); i != matches.end(); ++i) { if (m_nTabCount <= nMatch) { @@ -2485,8 +2479,8 @@ void CXConsole::DisplayVarValue(ICVar* pVar) const char* sFlagsString = GetFlagsString(pVar->GetFlags()); - string sValue = (pVar->GetFlags() & VF_INVISIBLE) ? "" : pVar->GetString(); - string sVar = pVar->GetName(); + AZStd::string sValue = (pVar->GetFlags() & VF_INVISIBLE) ? "" : pVar->GetString(); + AZStd::string sVar = pVar->GetName(); char szRealState[40] = ""; @@ -2623,12 +2617,8 @@ void CXConsole::AddLine(const char* inputStr) void CXConsole::PostLine(const char* lineOfText, size_t len) { - string line; - - { - line = string(lineOfText, len); - m_dqConsoleBuffer.push_back(line); - } + AZStd::string line = AZStd::string(lineOfText, len); + m_dqConsoleBuffer.push_back(line); int nBufferSize = con_line_buffer_size; @@ -2701,7 +2691,7 @@ void CXConsole::RemoveOutputPrintSink(IOutputPrintSink* inpSink) ////////////////////////////////////////////////////////////////////////// void CXConsole::AddLinePlus(const char* inputStr) { - string str, tmpStr; + AZStd::string str, tmpStr; { if (!m_dqConsoleBuffer.size()) @@ -2717,13 +2707,13 @@ void CXConsole::AddLinePlus(const char* inputStr) str.resize(str.size() - 1); } - string::size_type nPos; - while ((nPos = str.find('\n')) != string::npos) + AZStd::string::size_type nPos; + while ((nPos = str.find('\n')) != AZStd::string::npos) { str.replace(nPos, 1, 1, ' '); } - while ((nPos = str.find('\r')) != string::npos) + while ((nPos = str.find('\r')) != AZStd::string::npos) { str.replace(nPos, 1, 1, ' '); } @@ -2783,7 +2773,7 @@ void CXConsole::AddInputUTF8(const AZStd::string& textUTF8) ////////////////////////////////////////////////////////////////////////// void CXConsole::ExecuteInputBuffer() { - string sTemp = m_sInputBuffer; + AZStd::string sTemp = m_sInputBuffer; if (m_sInputBuffer.empty()) { return; @@ -2814,9 +2804,7 @@ void CXConsole::RemoveInputChar(bool bBackSpace) const char* const pBase = m_sInputBuffer.c_str(); const char* pCursor = pBase + m_nCursorPos; const char* const pEnd = pCursor; - Unicode::CIterator pUnicode(pCursor); - pUnicode--; // Remove one UCS code-point, doesn't account for combining diacritics - pCursor = pUnicode.GetPosition(); + pCursor -= Utf8::Internal::sequence_length(pCursor); // Remove one UCS code-point, doesn't account for combining diacritics size_t length = pEnd - pCursor; m_sInputBuffer.erase(pCursor - pBase, length); m_nCursorPos -= length; @@ -2829,9 +2817,7 @@ void CXConsole::RemoveInputChar(bool bBackSpace) const char* const pBase = m_sInputBuffer.c_str(); const char* pCursor = pBase + m_nCursorPos; const char* const pBegin = pCursor; - Unicode::CIterator pUnicode(pCursor); - pUnicode--; // Remove one UCS code-point, doesn't account for combining diacritics - pCursor = pUnicode.GetPosition(); + pCursor -= Utf8::Internal::sequence_length(pCursor); // Remove one UCS code-point, doesn't account for combining diacritics size_t length = pCursor - pBegin; m_sInputBuffer.erase(pBegin - pBase, length); } @@ -2905,28 +2891,29 @@ void CXConsole::Paste() #if defined(AZ_PLATFORM_WINDOWS) if (OpenClipboard(NULL) != 0) { - wstring data; + AZStd::string data; const HANDLE wideData = GetClipboardData(CF_UNICODETEXT); if (wideData) { const LPCWSTR pWideData = (LPCWSTR)GlobalLock(wideData); if (pWideData) { - // Note: This conversion is just to make sure we discard malicious or malformed data - Unicode::ConvertSafe(data, pWideData); + AZStd::to_string(data, pWideData); GlobalUnlock(wideData); } } CloseClipboard(); - for (Unicode::CIterator it(data.begin(), data.end()); it != data.end(); ++it) + Utf8::Unchecked::octet_iterator end(data.end()); + for (Utf8::Unchecked::octet_iterator it(data.begin()); it != end; ++it) { const uint32 cp = *it; if (cp != '\r') { // Convert UCS code-point into UTF-8 string - char utf8_buf[5]; - Unicode::Convert(utf8_buf, cp); + char utf8_buf[5] = {0}; + size_t size = 5; + it.to_utf8_sequence(cp, utf8_buf, size); AddInputUTF8(utf8_buf); } } @@ -3030,7 +3017,7 @@ void CXConsole::AddCVarsToHash(ConsoleVariablesVector::const_iterator begin, Con { // add name & variable to string. We add both since adding only the value could cause // many collisions with variables all having value 0 or all 1. - string hashStr = it->first; + AZStd::string hashStr = it->first; runningNameCrc32.Add(hashStr.c_str(), hashStr.length()); hashStr += it->second->GetDataProbeString(); @@ -3281,7 +3268,7 @@ void CXConsole::FindVar(const char* substr) for (size_t i = 0; i < cmdCount; i++) { - if (CryStringUtils::stristr(cmds[i], substr)) + if (AZ::StringFunc::Find(cmds[i], substr) != AZStd::string::npos) { ICVar* pCvar = gEnv->pConsole->GetCVar(cmds[i]); if (pCvar) @@ -3399,7 +3386,7 @@ const char* CXConsole::AutoCompletePrev(const char* substr) } ////////////////////////////////////////////////////////////////////////// -inline size_t sizeOf (const string& str) +inline size_t sizeOf (const AZStd::string& str) { return str.capacity() + 1; } diff --git a/Code/Legacy/CrySystem/XConsole.h b/Code/Legacy/CrySystem/XConsole.h index f09c8e5ad7..b141a88e52 100644 --- a/Code/Legacy/CrySystem/XConsole.h +++ b/Code/Legacy/CrySystem/XConsole.h @@ -95,26 +95,12 @@ private: struct string_nocase_lt { - bool operator()(const char* s1, const char* s2) const + bool operator()(const AZStd::string& s1, const AZStd::string& s2) const { - return azstricmp(s1, s2) < 0; + return azstricmp(s1.c_str(), s2.c_str()) < 0; } }; -/* - very dangerous to use with STL containers -struct string_nocase_lt -{ - bool operator()( const char *s1,const char *s2 ) const - { - return _stricmp(s1,s2) < 0; - } - bool operator()( const string &s1,const string &s2 ) const - { - return _stricmp(s1.c_str(),s2.c_str()) < 0; - } -}; -*/ - //forward declarations class ITexture; struct IRenderer; diff --git a/Code/Legacy/CrySystem/XConsoleVariable.cpp b/Code/Legacy/CrySystem/XConsoleVariable.cpp index 370931088f..ab6ed0b078 100644 --- a/Code/Legacy/CrySystem/XConsoleVariable.cpp +++ b/Code/Legacy/CrySystem/XConsoleVariable.cpp @@ -286,7 +286,7 @@ void CXConsoleVariableCVarGroup::OnLoadConfigurationEntry_End() { if (!m_sDefaultValue.empty()) { - gEnv->pConsole->LoadConfigVar(GetName(), m_sDefaultValue); + gEnv->pConsole->LoadConfigVar(GetName(), m_sDefaultValue.c_str()); m_sDefaultValue.clear(); } } @@ -299,9 +299,9 @@ CXConsoleVariableCVarGroup::CXConsoleVariableCVarGroup(CXConsole* pConsole, cons } -string CXConsoleVariableCVarGroup::GetDetailedInfo() const +AZStd::string CXConsoleVariableCVarGroup::GetDetailedInfo() const { - string sRet = GetName(); + AZStd::string sRet = GetName(); sRet += " ["; @@ -326,11 +326,11 @@ string CXConsoleVariableCVarGroup::GetDetailedInfo() const sRet += "/default] [current]:\n"; - std::map::const_iterator it, end = m_CVarGroupDefault.m_KeyValuePair.end(); + std::map::const_iterator it, end = m_CVarGroupDefault.m_KeyValuePair.end(); for (it = m_CVarGroupDefault.m_KeyValuePair.begin(); it != end; ++it) { - const string& rKey = it->first; + const AZStd::string& rKey = it->first; sRet += " ... "; sRet += rKey; @@ -344,7 +344,7 @@ string CXConsoleVariableCVarGroup::GetDetailedInfo() const sRet += "/"; } sRet += GetValueSpec(rKey); - ICVar* pCVar = gEnv->pConsole->GetCVar(rKey); + ICVar* pCVar = gEnv->pConsole->GetCVar(rKey.c_str()); if (pCVar) { sRet += " ["; @@ -369,7 +369,7 @@ const char* CXConsoleVariableCVarGroup::GetHelp() } // create help on demand - string sRet = "Console variable group to apply settings to multiple variables\n\n"; + AZStd::string sRet = "Console variable group to apply settings to multiple variables\n\n"; sRet += GetDetailedInfo(); @@ -545,12 +545,12 @@ bool CXConsoleVariableCVarGroup::TestCVars(const SCVarGroup* pGroup, const ICVar bool CXConsoleVariableCVarGroup::TestCVars(const SCVarGroup& rGroup, const ICVar::EConsoleLogMode mode, const SCVarGroup* pExclude) const { bool bRet = true; - std::map::const_iterator it, end = rGroup.m_KeyValuePair.end(); + std::map::const_iterator it, end = rGroup.m_KeyValuePair.end(); for (it = rGroup.m_KeyValuePair.begin(); it != end; ++it) { - const string& rKey = it->first; - const string& rValue = it->second; + const AZStd::string& rKey = it->first; + const AZStd::string& rValue = it->second; if (pExclude) { @@ -674,7 +674,7 @@ bool CXConsoleVariableCVarGroup::TestCVars(const SCVarGroup& rGroup, const ICVar -string CXConsoleVariableCVarGroup::GetValueSpec(const string& sKey, const int* pSpec) const +AZStd::string CXConsoleVariableCVarGroup::GetValueSpec(const AZStd::string& sKey, const int* pSpec) const { if (pSpec) { @@ -685,7 +685,7 @@ string CXConsoleVariableCVarGroup::GetValueSpec(const string& sKey, const int* p const SCVarGroup* pGrp = itGrp->second; // check in spec - std::map::const_iterator it = pGrp->m_KeyValuePair.find(sKey); + std::map::const_iterator it = pGrp->m_KeyValuePair.find(sKey); if (it != pGrp->m_KeyValuePair.end()) { @@ -695,7 +695,7 @@ string CXConsoleVariableCVarGroup::GetValueSpec(const string& sKey, const int* p } // check in default - std::map::const_iterator it = m_CVarGroupDefault.m_KeyValuePair.find(sKey); + std::map::const_iterator it = m_CVarGroupDefault.m_KeyValuePair.find(sKey); if (it != m_CVarGroupDefault.m_KeyValuePair.end()) { @@ -708,14 +708,14 @@ string CXConsoleVariableCVarGroup::GetValueSpec(const string& sKey, const int* p void CXConsoleVariableCVarGroup::ApplyCVars(const SCVarGroup& rGroup, const SCVarGroup* pExclude) { - std::map::const_iterator it, end = rGroup.m_KeyValuePair.end(); + std::map::const_iterator it, end = rGroup.m_KeyValuePair.end(); bool wasProcessingGroup = m_pConsole->GetIsProcessingGroup(); m_pConsole->SetProcessingGroup(true); for (it = rGroup.m_KeyValuePair.begin(); it != end; ++it) { - const string& rKey = it->first; + const AZStd::string& rKey = it->first; if (pExclude) { @@ -728,7 +728,7 @@ void CXConsoleVariableCVarGroup::ApplyCVars(const SCVarGroup& rGroup, const SCVa // Useful for debugging cvar groups //CryLogAlways("[CVARS]: [APPLY] ([%s]) [%s] = [%s]", GetName(), rKey.c_str(), it->second.c_str()); - m_pConsole->LoadConfigVar(rKey, it->second); + m_pConsole->LoadConfigVar(rKey.c_str(), it->second.c_str()); } m_pConsole->SetProcessingGroup(wasProcessingGroup); diff --git a/Code/Legacy/CrySystem/XConsoleVariable.h b/Code/Legacy/CrySystem/XConsoleVariable.h index 0dd05cdb07..e4f9c14355 100644 --- a/Code/Legacy/CrySystem/XConsoleVariable.h +++ b/Code/Legacy/CrySystem/XConsoleVariable.h @@ -16,6 +16,7 @@ #include "SFunctor.h" class CXConsole; +typedef AZStd::fixed_string<512> stack_string; inline int64 TextToInt64(const char* s, int64 nCurrent, bool bBitfield) { @@ -184,13 +185,13 @@ public: // interface ICVar -------------------------------------------------------------------------------------- - virtual int GetIVal() const { return atoi(m_sValue); } - virtual int64 GetI64Val() const { return _atoi64(m_sValue); } - virtual float GetFVal() const { return (float)atof(m_sValue); } - virtual const char* GetString() const { return m_sValue; } + virtual int GetIVal() const { return atoi(m_sValue.c_str()); } + virtual int64 GetI64Val() const { return _atoi64(m_sValue.c_str()); } + virtual float GetFVal() const { return (float)atof(m_sValue.c_str()); } + virtual const char* GetString() const { return m_sValue.c_str(); } virtual void ResetImpl() { - Set(m_sDefault); + Set(m_sDefault.c_str()); } virtual void Set(const char* s) { @@ -219,8 +220,7 @@ public: virtual void Set(float f) { - stack_string s; - s.Format("%g", f); + stack_string s = stack_string::format("%g", f); if ((m_sValue == s.c_str()) && (m_nFlags & VF_ALWAYSONCHANGE) == 0) { @@ -233,8 +233,7 @@ public: virtual void Set(int i) { - stack_string s; - s.Format("%d", i); + stack_string s = stack_string::format("%d", i); if ((m_sValue == s.c_str()) && (m_nFlags & VF_ALWAYSONCHANGE) == 0) { @@ -248,8 +247,8 @@ public: virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); } private: // -------------------------------------------------------------------------------------------- - string m_sValue; - string m_sDefault; //!< + AZStd::string m_sValue; + AZStd::string m_sDefault; //!< }; @@ -296,8 +295,7 @@ public: return; } - stack_string s; - s.Format("%d", i); + stack_string s = stack_string::format("%d", i); if (m_pConsole->OnBeforeVarChange(this, s.c_str())) { @@ -364,8 +362,7 @@ public: return; } - stack_string s; - s.Format("%lld", i); + stack_string s = stack_string::format("%lld", i); if (m_pConsole->OnBeforeVarChange(this, s.c_str())) { @@ -442,8 +439,7 @@ public: return; } - stack_string s; - s.Format("%g", f); + stack_string s = stack_string::format("%g", f); if (m_pConsole->OnBeforeVarChange(this, s.c_str())) { @@ -718,7 +714,7 @@ public: { return m_sValue.c_str(); } - virtual void ResetImpl() { Set(m_sDefault); } + virtual void ResetImpl() { Set(m_sDefault.c_str()); } virtual void Set(const char* s) { if ((m_sValue == s) && (m_nFlags & VF_ALWAYSONCHANGE) == 0) @@ -740,14 +736,12 @@ public: } virtual void Set(float f) { - stack_string s; - s.Format("%g", f); + stack_string s = stack_string::format("%g", f); Set(s.c_str()); } virtual void Set(int i) { - stack_string s; - s.Format("%d", i); + stack_string s = stack_string::format("%d", i); Set(s.c_str()); } virtual int GetType() { return CVAR_STRING; } @@ -755,8 +749,8 @@ public: virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); } private: // -------------------------------------------------------------------------------------------- - string m_sValue; - string m_sDefault; + AZStd::string m_sValue; + AZStd::string m_sDefault; const char*& m_userPtr; //!< }; @@ -778,7 +772,7 @@ public: // Returns: // part of the help string - useful to log out detailed description without additional help text - string GetDetailedInfo() const; + AZStd::string GetDetailedInfo() const; // interface ICVar ----------------------------------------------------------------------------------- @@ -809,7 +803,7 @@ private: // -------------------------------------------------------------------- struct SCVarGroup { - std::map m_KeyValuePair; // e.g. m_KeyValuePair["r_fullscreen"]="0" + std::map m_KeyValuePair; // e.g. m_KeyValuePair["r_fullscreen"]="0" void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(m_KeyValuePair); @@ -818,15 +812,15 @@ private: // -------------------------------------------------------------------- SCVarGroup m_CVarGroupDefault; typedef std::map TCVarGroupStateMap; - TCVarGroupStateMap m_CVarGroupStates; - string m_sDefaultValue; // used by OnLoadConfigurationEntry_End() + TCVarGroupStateMap m_CVarGroupStates; + AZStd::string m_sDefaultValue; // used by OnLoadConfigurationEntry_End() void ApplyCVars(const SCVarGroup& rGroup, const SCVarGroup* pExclude = 0); // Arguments: // sKey - must exist, at least in default // pSpec - can be 0 - string GetValueSpec(const string& sKey, const int* pSpec = 0) const; + AZStd::string GetValueSpec(const AZStd::string& sKey, const int* pSpec = 0) const; // should only be used by TestCVars() // Returns: