More windows/linux fixes

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-03 18:56:46 -07:00
parent e28602dbbb
commit 82c5f80fbd
5 changed files with 22 additions and 22 deletions
+10 -10
View File
@@ -71,7 +71,7 @@
// note: for cross-platform compatibility, do not use the return value of azfopen. On Windows, it's an errno_t and 0 indicates success. On other platforms, the return value is a FILE*, and a 0 value indicates failure.
# define azfopen(_fp, _filename, _attrib) fopen_s(_fp, _filename, _attrib)
# define azfscanf fscanf_s
# define azfscanf fscanf_s
# define azsprintf(_buffer, ...) sprintf_s(_buffer, AZ_ARRAY_SIZE(_buffer), __VA_ARGS__)
# define azstrlwr _strlwr_s
@@ -118,19 +118,19 @@
# define azfopen(_fp, _filename, _attrib) *(_fp) = fopen(_filename, _attrib)
# define azfscanf fscanf
# define azsprintf sprintf
# define azstrlwr(_buffer, _size) strlwr(_buffer)
# define azvsprintf vsprintf
# define azwcscpy(_dest, _size, _buffer) wcscpy(_dest, _buffer)
# define azstrtime _strtime
# define azstrdate _strdate
# define azlocaltime localtime_r
# define azsprintf sprintf
# define azstrlwr(_buffer, _size) strlwr(_buffer)
# define azvsprintf vsprintf
# define azwcscpy(_dest, _size, _buffer) wcscpy(_dest, _buffer)
# define azstrtime _strtime
# define azstrdate _strdate
# define azlocaltime localtime_r
#endif
#if AZ_TRAIT_USE_POSIX_STRERROR_R
# define azstrerror_s(_dst, _num, _err) strerror_r(_err, _dst, _num)
# define azstrerror_s(_dst, _num, _err) strerror_r(_err, _dst, _num)
#else
# define azstrerror_s strerror_s
# define azstrerror_s strerror_s
#endif
#define AZ_INVALID_POINTER reinterpret_cast<void*>(0x0badf00dul)
+2 -2
View File
@@ -56,7 +56,7 @@ namespace UnitTest
int isFoundModule = 0;
char expectedNameBuffer[AZ_ARRAY_SIZE(SymbolStorage::ModuleInfo::m_modName)];
#if defined(AZCORETEST_DLL_NAME)
azstrncpy(expectedNameBuffer, AZCORETEST_DLL_NAME, AZ_ARRAY_SIZE(expectedNameBuffer));
azstrncpy(expectedNameBuffer, AZ_ARRAY_SIZE(expectedNameBuffer), AZCORETEST_DLL_NAME, AZ_ARRAY_SIZE(expectedNameBuffer));
#else
azstrncpy(expectedNameBuffer, "azcoretests.dll", AZ_ARRAY_SIZE(expectedNameBuffer));
#endif
@@ -65,7 +65,7 @@ namespace UnitTest
for (u32 i = 0; i < SymbolStorage::GetNumLoadedModules(); ++i)
{
char nameBuffer[AZ_ARRAY_SIZE(SymbolStorage::ModuleInfo::m_modName)];
azstrncpy(nameBuffer, SymbolStorage::GetModuleInfo(i)->m_fileName, AZ_ARRAY_SIZE(nameBuffer));
azstrncpy(nameBuffer, AZ_ARRAY_SIZE(nameBuffer), SymbolStorage::GetModuleInfo(i)->m_fileName, AZ_ARRAY_SIZE(nameBuffer));
AZStd::to_lower(nameBuffer, nameBuffer + AZ_ARRAY_SIZE(nameBuffer));
if (strstr(nameBuffer, expectedNameBuffer))
+1 -1
View File
@@ -288,7 +288,7 @@ void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], uint
firstIteration = false;
}
// Check if the engineroot exists
azstrcat(szPath, "\\engine.json");
azstrcat(szPath, AZ_ARRAY_SIZE(szPath), "\\engine.json");
WIN32_FILE_ATTRIBUTE_DATA data;
AZStd::wstring szPathW;
AZStd::to_wstring(szPathW, szPath);
+8 -8
View File
@@ -419,8 +419,8 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
char versionbuf[1024];
azstrcpy(versionbuf, AZ_ARRAY_SIZE(versionbuf), "");
PutVersion(versionbuf, AZ_ARRAY_SIZE(versionbuf));
azstrcat(errorString, versionbuf);
azstrcat(errorString, "\n");
azstrcat(errorString, AZ_ARRAY_SIZE(errorString), versionbuf);
azstrcat(errorString, AZ_ARRAY_SIZE(errorString), "\n");
char excCode[MAX_WARNING_LENGTH];
char excAddr[80];
@@ -486,7 +486,7 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
excCode, excAddr, m_excModule, excName, desc);
azstrcat(errs, "\nCall Stack Trace:\n");
azstrcat(errs, AZ_ARRAY_SIZE(errs), "\nCall Stack Trace:\n");
std::vector<AZStd::string> funcs;
{
@@ -509,15 +509,15 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
{
char temp[s_iCallStackSize];
sprintf_s(temp, "%2zd) %s", funcs.size() - i, (const char*)funcs[i].c_str());
azstrcat(str, temp);
azstrcat(str, "\r\n");
azstrcat(errs, temp);
azstrcat(errs, "\n");
azstrcat(str, AZ_ARRAY_SIZE(str), temp);
azstrcat(str, AZ_ARRAY_SIZE(str), "\r\n");
azstrcat(errs, AZ_ARRAY_SIZE(errs), temp);
azstrcat(errs, AZ_ARRAY_SIZE(errs), "\n");
}
azstrcpy(m_excCallstack, AZ_ARRAY_SIZE(m_excCallstack), str);
}
azstrcat(errorString, errs);
azstrcat(errorString, AZ_ARRAY_SIZE(errorString), errs);
if (f)
{
@@ -1512,7 +1512,7 @@ int CUiAnimViewNodesCtrl::GetMatNameAndSubMtlIndexFromName(QString& matName, con
if (const char* pCh = strstr(nodeName, ".["))
{
char matPath[MAX_PATH];
azstrncpy(matPath, nodeName, (size_t)(pCh - nodeName));
azstrncpy(matPath, AZ_ARRAY_SIZE(matPath), nodeName, (size_t)(pCh - nodeName));
matName = matPath;
pCh += 2;
if ((*pCh) != 0)