Merge branch 'development' into redcode/crythread-2nd-pass

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
AMZN-ScottR
2021-08-11 20:31:58 -07:00
1650 changed files with 39333 additions and 62370 deletions
+31 -70
View File
@@ -12,6 +12,7 @@
#include "platform.h" // Note: This should be first to get consistent debugging definitions
#include <CryCommon/ISystem.h>
#include <CryAssert.h>
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -29,7 +30,7 @@
#include AZ_RESTRICTED_FILE(WinBase_cpp)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
#include <signal.h>
#endif
@@ -38,6 +39,7 @@
#include <sys/types.h>
#include <fcntl.h>
#include <AzCore/IO/SystemFile.h>
#include <AzCore/std/string/conversions.h>
#ifdef APPLE
#include <mach/mach.h>
@@ -77,8 +79,6 @@ unsigned int g_EnableMultipleAssert = 0;//set to something else than 0 if to ena
#include <AzFramework/Utils/SystemUtilsApple.h>
#endif
#include "StringUtils.h"
#if AZ_TRAIT_COMPILER_DEFINE_FS_ERRNO_TYPE
typedef int FS_ERRNO_TYPE;
#if AZ_TRAIT_COMPILER_DEFINE_FS_STAT_TYPE
@@ -349,23 +349,23 @@ void _makepath(char* path, const char* drive, const char* dir, const char* filen
}
if (dir && dir[0])
{
cry_strcat(tmp, dir);
azstrcat(tmp, MAX_PATH, dir);
ch = tmp[strlen(tmp) - 1];
if (ch != '/' && ch != '\\')
{
cry_strcat(tmp, "\\");
azstrcat(tmp, MAX_PATH, "\\");
}
}
if (filename && filename[0])
{
cry_strcat(tmp, filename);
azstrcat(tmp, MAX_PATH, filename);
if (ext && ext[0])
{
if (ext[0] != '.')
{
cry_strcat(tmp, ".");
azstrcat(tmp, MAX_PATH, ".");
}
cry_strcat(tmp, ext);
azstrcat(tmp, MAX_PATH, ext);
}
}
azstrcpy(path, strlen(tmp) + 1, tmp);
@@ -486,12 +486,12 @@ void _splitpath(const char* inpath, char* drv, char* dir, char* fname, char* ext
drv[0] = 0;
}
typedef CryStackStringT<char, AZ_MAX_PATH_LEN> path_stack_string;
typedef AZStd::fixed_string<AZ_MAX_PATH_LEN> path_stack_string;
const path_stack_string inPath(inpath);
string::size_type s = inPath.rfind('/', inPath.size());//position of last /
AZStd::string::size_type s = inPath.rfind('/', inPath.size());//position of last /
path_stack_string fName;
if (s == string::npos)
if (s == AZStd::string::npos)
{
if (dir)
{
@@ -503,9 +503,9 @@ void _splitpath(const char* inpath, char* drv, char* dir, char* fname, char* ext
{
if (dir)
{
azstrcpy(dir, AZ_MAX_PATH_LEN, (inPath.substr((string::size_type)0, (string::size_type)(s + 1))).c_str()); //assign directory
azstrcpy(dir, AZ_MAX_PATH_LEN, (inPath.substr((AZStd::string::size_type)0, (AZStd::string::size_type)(s + 1))).c_str()); //assign directory
}
fName = inPath.substr((string::size_type)(s + 1)); //assign remaining string as rest
fName = inPath.substr((AZStd::string::size_type)(s + 1)); //assign remaining string as rest
}
if (fName.size() == 0)
{
@@ -521,8 +521,8 @@ void _splitpath(const char* inpath, char* drv, char* dir, char* fname, char* ext
else
{
//dir and drive are now set
s = fName.find(".", (string::size_type)0);//position of first .
if (s == string::npos)
s = fName.find(".", (AZStd::string::size_type)0);//position of first .
if (s == AZStd::string::npos)
{
if (ext)
{
@@ -547,7 +547,7 @@ void _splitpath(const char* inpath, char* drv, char* dir, char* fname, char* ext
}
else
{
azstrcpy(fname, AZ_MAX_PATH_LEN, (fName.substr((string::size_type)0, s)).c_str()); //assign filename
azstrcpy(fname, AZ_MAX_PATH_LEN, (fName.substr((AZStd::string::size_type)0, s)).c_str()); //assign filename
}
}
}
@@ -779,17 +779,17 @@ BOOL SystemTimeToFileTime(const SYSTEMTIME* syst, LPFILETIME ft)
return TRUE;
}
void adaptFilenameToLinux(string& rAdjustedFilename)
void adaptFilenameToLinux(AZStd::string& rAdjustedFilename)
{
//first replace all \\ by /
string::size_type loc = 0;
while ((loc = rAdjustedFilename.find("\\", loc)) != string::npos)
AZStd::string::size_type loc = 0;
while ((loc = rAdjustedFilename.find("\\", loc)) != AZStd::string::npos)
{
rAdjustedFilename.replace(loc, 1, "/");
}
loc = 0;
//remove /./
while ((loc = rAdjustedFilename.find("/./", loc)) != string::npos)
while ((loc = rAdjustedFilename.find("/./", loc)) != AZStd::string::npos)
{
rAdjustedFilename.replace(loc, 3, "/");
}
@@ -798,16 +798,16 @@ void adaptFilenameToLinux(string& rAdjustedFilename)
void replaceDoublePathFilename(char* szFileName)
{
//replace "\.\" by "\"
string s(szFileName);
string::size_type loc = 0;
AZStd::string s(szFileName);
AZStd::string::size_type loc = 0;
//remove /./
while ((loc = s.find("/./", loc)) != string::npos)
while ((loc = s.find("/./", loc)) != AZStd::string::npos)
{
s.replace(loc, 3, "/");
}
loc = 0;
//remove "\.\"
while ((loc = s.find("\\.\\", loc)) != string::npos)
while ((loc = s.find("\\.\\", loc)) != AZStd::string::npos)
{
s.replace(loc, 3, "\\");
}
@@ -817,8 +817,8 @@ void replaceDoublePathFilename(char* szFileName)
const int comparePathNames(const char* cpFirst, const char* cpSecond, unsigned int len)
{
//create two strings and replace the \\ by / and /./ by /
string first(cpFirst);
string second(cpSecond);
AZStd::string first(cpFirst);
AZStd::string second(cpSecond);
adaptFilenameToLinux(first);
adaptFilenameToLinux(second);
if (strlen(cpFirst) < len || strlen(cpSecond) < len)
@@ -1127,20 +1127,6 @@ void CrySleep(unsigned int dwMilliseconds)
Sleep(dwMilliseconds);
}
//////////////////////////////////////////////////////////////////////////
void CryLowLatencySleep(unsigned int dwMilliseconds)
{
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION WINBASE_CPP_SECTION_6
#include AZ_RESTRICTED_FILE(WinBase_cpp)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
CrySleep(dwMilliseconds);
#endif
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
@@ -1284,14 +1270,6 @@ int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
#endif
}
//////////////////////////////////////////////////////////////////////////
short CryGetAsyncKeyState(int vKey)
{
//TODO: implement
CRY_ASSERT_MESSAGE(0, "CryGetAsyncKeyState not implemented yet");
return 0;
}
#if defined(LINUX) || defined(APPLE)
threadID CryGetCurrentThreadId()
@@ -1299,10 +1277,6 @@ threadID CryGetCurrentThreadId()
return GetCurrentThreadId();
}
void CryDebugBreak()
{
__builtin_trap();
}
#endif//LINUX APPLE
#if defined(APPLE) || defined(LINUX)
@@ -1315,11 +1289,6 @@ DLL_EXPORT void OutputDebugString(const char* outputString)
#endif
}
DLL_EXPORT void DebugBreak()
{
CryDebugBreak();
}
#endif
// This code does not have a long life span and will be replaced soon
@@ -1516,14 +1485,16 @@ const bool GetFilenameNoCase
return true;
}
DWORD GetFileAttributes(LPCSTR lpFileName)
DWORD GetFileAttributes(LPCWSTR lpFileNameW)
{
AZStd::string lpFileName;
AZStd::to_string(lpFileName, lpFileNameW);
struct stat fileStats;
const int success = stat(lpFileName, &fileStats);
const int success = stat(lpFileName.c_str(), &fileStats);
if (success == -1)
{
char adjustedFilename[MAX_PATH];
GetFilenameNoCase(lpFileName, adjustedFilename);
GetFilenameNoCase(lpFileName.c_str(), adjustedFilename);
if (stat(adjustedFilename, &fileStats) == -1)
{
return (DWORD)INVALID_FILE_ATTRIBUTES;
@@ -1543,16 +1514,6 @@ DWORD GetFileAttributes(LPCSTR lpFileName)
return (ret == 0) ? FILE_ATTRIBUTE_NORMAL : ret;//return file attribute normal as the default value, must only be set if no other attributes have been found
}
uint32 CryGetFileAttributes(const char* lpFileName)
{
string fn = lpFileName;
adaptFilenameToLinux(fn);
const char* buffer = fn.c_str();
return GetFileAttributes(buffer);
}
__finddata64_t::~__finddata64_t()
{
if (m_Dir != FS_DIR_NULL)