Merge branch 'development' into cmake/AddressSanitizer

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-19 12:25:41 -07:00
429 changed files with 1447 additions and 1830 deletions
@@ -236,7 +236,7 @@ namespace AZ::IO::ArchiveInternal
return 0;
}
if (nReadBytes != nTotal)
if (static_cast<size_t>(nReadBytes) != nTotal)
{
AZ_Warning("Archive", false, "FRead did not read expected number of byte from file, only %zu of %lld bytes read", nTotal, nReadBytes);
nTotal = (size_t)nReadBytes;
@@ -348,17 +348,12 @@ namespace AZ::IO::ArchiveInternal
return EOF;
}
int c = EOF;
int i;
for (i = 0; i < 1; i++)
if (m_nCurSeek == GetFileSize())
{
if (i + m_nCurSeek == GetFileSize())
{
return c;
}
c = pData[i + m_nCurSeek];
break;
return c;
}
m_nCurSeek += i + 1;
c = pData[m_nCurSeek];
m_nCurSeek += 1;
return c;
}
}
@@ -1792,11 +1787,11 @@ namespace AZ::IO
AZ_Assert(m_pZip, "ZipFile is nullptr");
AZ_Assert(m_pFileEntry && m_pZip->IsOwnerOf(m_pFileEntry), "ZipFile is not owner of m_pFileEntry");
if (nDataSize != m_pFileEntry->desc.lSizeUncompressed && bDecompress)
if (static_cast<uint32_t>(nDataSize) != m_pFileEntry->desc.lSizeUncompressed && bDecompress)
{
return false;
}
else if (nDataSize != m_pFileEntry->desc.lSizeCompressed && !bDecompress)
else if (static_cast<uint32_t>(nDataSize) != m_pFileEntry->desc.lSizeCompressed && !bDecompress)
{
return false;
}
@@ -75,7 +75,7 @@ namespace AZ::IO::ZipDir
for (i = 0; i < AZ_ARRAY_SIZE(szBuf) - 1; ++i)
{
int r = distrib(gen);
szBuf[i] = r > 9 ? (r - 10) + 'a' : '0' + r;
szBuf[i] = static_cast<char>(r > 9 ? (r - 10) + 'a' : '0' + r);
}
szBuf[i] = '\0';
return szBuf;
@@ -104,7 +104,7 @@ namespace AZ::IO::ZipDir::ZipDirStructuresInternal
if (*pReturnCode == Z_BUF_ERROR)
{
// As long as we consumed something, keep going. Only fail permanently if we've stalled.
if (nAvailIn != pZStream->avail_in || nAvailOut != pZStream->avail_out)
if (nAvailIn != static_cast<int>(pZStream->avail_in) || nAvailOut != static_cast<int>(pZStream->avail_out))
{
*pReturnCode = Z_OK;
}
@@ -338,14 +338,15 @@ namespace AZ::IO::ZipDir
else
{
AZ::IO::HandleType realFileHandle = m_fileHandle;
size_t nFileSize = ~0;
AZ::u64 fileSize = 0;
if (!m_fileIOBase->Size(realFileHandle, fileSize))
{
goto error;
// Error
m_nSize = 0;
return;
}
nFileSize = static_cast<size_t>(fileSize);
const size_t nFileSize = static_cast<size_t>(fileSize);
m_pInMemoryData = ZipDirStructuresInternal::CreateMemoryBlock(nFileSize, szUsage);
@@ -353,16 +354,18 @@ namespace AZ::IO::ZipDir
if (!m_fileIOBase->Seek(realFileHandle, 0, AZ::IO::SeekType::SeekFromStart))
{
goto error;
// Error
m_nSize = 0;
return;
}
if (!m_fileIOBase->Read(realFileHandle, m_pInMemoryData->m_address.get(), nFileSize, true))
{
goto error;
// Error
m_nSize = 0;
return;
}
return;
error:
m_nSize = 0;
}
}
}
@@ -832,18 +835,18 @@ namespace AZ::IO::ZipDir
// conversion routines for the date/time fields used in Zip
uint16_t DOSDate(tm* t)
{
return
return static_cast<uint16_t>(
((t->tm_year - 80) << 9)
| (t->tm_mon << 5)
| t->tm_mday;
| t->tm_mday);
}
uint16_t DOSTime(tm* t)
{
return
return static_cast<uint16_t>(
((t->tm_hour) << 11)
| ((t->tm_min) << 5)
| ((t->tm_sec) >> 1);
| ((t->tm_sec) >> 1));
}
// sets the current time to modification time
@@ -872,7 +875,7 @@ namespace AZ::IO::ZipDir
// we'll need CRC32 of the file to pack it
this->desc.lCRC32 = AZ::Crc32(pUncompressed, nSize);
this->nMethod = nCompressionMethod;
this->nMethod = static_cast<uint16_t>(nCompressionMethod);
}
uint64_t FileEntry::GetModificationTime()
@@ -57,7 +57,7 @@ namespace AzPhysics
//! A handle to a Scene within the physics simulation.
//! A SceneHandle is a tuple of a Crc of the scenes name and the index in the Scene list.
using SceneHandle = AZStd::tuple<AZ::Crc32, SceneIndex>;
static constexpr SceneHandle InvalidSceneHandle = { AZ::Crc32(), -1 };
static constexpr SceneHandle InvalidSceneHandle = { AZ::Crc32(), SceneIndex(-1) };
//! Ease of use type for referencing a List of SceneHandle objects.
using SceneHandleList = AZStd::vector<SceneHandle>;
@@ -357,26 +357,23 @@ namespace AzFramework
}
}
#pragma warning( push )
#pragma warning( disable : 4505 ) // StackDump is useful to debug the lua stack. Disable warning about this method being unused.
//=========================================================================
// DebugPrintStack
// Prints the Lua stack starting from the bottom.
//=========================================================================
static void DebugPrintStack(lua_State* lua, const AZStd::string& prefix = "")
{
AZStd::string dump = prefix;
const int stackSize = lua_gettop(lua);
for (int stackIdx = 1; stackIdx <= stackSize; ++stackIdx)
{
dump += PrintLuaValue(lua, stackIdx);
dump += " "; // add separator
}
AZ_Warning("ScriptComponent", false, "Stack Dump: '%s'", dump.c_str());
}
#pragma warning( pop )
// DO NOT DELETE StackDump is useful to debug the lua stack.
//static void DebugPrintStack(lua_State* lua, const AZStd::string& prefix = "")
//{
// AZStd::string dump = prefix;
// const int stackSize = lua_gettop(lua);
// for (int stackIdx = 1; stackIdx <= stackSize; ++stackIdx)
// {
// dump += PrintLuaValue(lua, stackIdx);
// dump += " "; // add separator
// }
//
// AZ_Warning("ScriptComponent", false, "Stack Dump: '%s'", dump.c_str());
//}
//=========================================================================
// Properties__IndexFindSubtable
@@ -791,8 +791,8 @@ namespace AzFramework
AZ_Assert(position, "Expected PositionData2D but found nullptr");
return CursorEvent{ ScreenPoint(
position->m_normalizedPosition.GetX() * windowSize.m_width,
position->m_normalizedPosition.GetY() * windowSize.m_height) };
static_cast<int>(position->m_normalizedPosition.GetX() * windowSize.m_width),
static_cast<int>(position->m_normalizedPosition.GetY() * windowSize.m_height)) };
}
else if (inputChannelId == InputDeviceMouse::Movement::X)
{