Code/Framework fixes

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
pappeste
2021-06-24 19:05:30 -07:00
committed by Esteban Papp
parent e648dbcf08
commit 81d26d322d
11 changed files with 26 additions and 24 deletions
@@ -182,7 +182,7 @@ namespace AZ
ConsoleFunctorBase* Console::FindCommand(const char* command)
{
CVarFixedString lowerName(command);
AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); });
AZStd::to_lower(lowerName.begin(), lowerName.end());
CommandMap::iterator iter = m_commands.find(lowerName);
if (iter != m_commands.end())
@@ -270,7 +270,7 @@ namespace AZ
}
CVarFixedString lowerName = functor->GetName();
AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); });
AZStd::to_lower(lowerName.begin(), lowerName.end());
CommandMap::iterator iter = m_commands.find(lowerName);
if (iter != m_commands.end())
{
@@ -313,7 +313,7 @@ namespace AZ
}
CVarFixedString lowerName = functor->GetName();
AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); });
AZStd::to_lower(lowerName.begin(), lowerName.end());
CommandMap::iterator iter = m_commands.find(lowerName);
if (iter != m_commands.end())
{
@@ -389,7 +389,7 @@ namespace AZ
ConsoleFunctorFlags flags = ConsoleFunctorFlags::Null;
CVarFixedString lowerName(command);
AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); });
AZStd::to_lower(lowerName.begin(), lowerName.end());
CommandMap::iterator iter = m_commands.find(lowerName);
if (iter != m_commands.end())
@@ -221,7 +221,7 @@ namespace AZ::IO::Internal
? strncmp(left.data(), right.data(), maxCharsToCompare)
: azstrnicmp(left.data(), right.data(), maxCharsToCompare);
return charCompareResult == 0
? aznumeric_cast<ptrdiff_t>(left.size()) - aznumeric_cast<ptrdiff_t>(right.size())
? aznumeric_cast<int>(aznumeric_cast<ptrdiff_t>(left.size()) - aznumeric_cast<ptrdiff_t>(right.size()))
: charCompareResult;
}
}
@@ -38,7 +38,7 @@ namespace AZ
break;
}
u32 cacheSize = m_cacheSizeMib * 1_mib;
u32 cacheSize = static_cast<AZ::u32>(m_cacheSizeMib * 1_mib);
if (blockSize * 2 > cacheSize)
{
AZ_Warning("Streamer", false, "Size (%u) for BlockCache isn't big enough to hold at least two cache blocks of size (%zu). "
@@ -36,7 +36,7 @@ namespace AZ
break;
}
u32 cacheSize = m_cacheSizeMib * 1_mib;
u32 cacheSize = static_cast<AZ::u32>(m_cacheSizeMib * 1_mib);
if (blockSize > cacheSize)
{
AZ_Warning("Streamer", false, "Size (%u) for DedicatedCache isn't big enough to hold at least one cache blocks of size (%zu). "
@@ -11,6 +11,7 @@
#include <AzCore/std/string/conversions.h>
#include <AzCore/std/containers/array.h>
#include <AzCore/std/containers/fixed_vector.h>
#include <AzCore/Casting/lossy_cast.h>
#include <AzCore/Memory/Memory.h>
#include <AzCore/Memory/OSAllocator.h>
#include <AzCore/Memory/SystemAllocator.h>
@@ -342,8 +343,8 @@ namespace AZ::StringFunc::Internal
{
for (const char stripCharacter : stripCharacters)
{
const char lower = tolower(stripCharacter);
const char upper = toupper(stripCharacter);
const char lower = azlossy_cast<char>(tolower(stripCharacter));
const char upper = azlossy_cast<char>(toupper(stripCharacter));
if (lower != upper)
{
combinedStripCharacters.push_back(lower);
@@ -95,7 +95,7 @@ namespace AZ
auto printElement = [&os, &mat](int64_t row, int64_t col) -> std::ostream&
{
const std::streamsize width = 10;
os << std::setw(width) << std::fixed << mat.GetElement(row, col);
os << std::setw(width) << std::fixed << mat.GetElement(static_cast<int32_t>(row), static_cast<int32_t>(col));
return os;
};
@@ -32,12 +32,12 @@ namespace JsonSerializationTests
AZStd::shared_ptr<NumberType> CreateDefaultInstance() override
{
return AZStd::make_shared<NumberType>(0);
return AZStd::make_shared<NumberType>(NumberType(0));
}
AZStd::shared_ptr<NumberType> CreateFullySetInstance() override
{
return AZStd::make_shared<NumberType>(4);
return AZStd::make_shared<NumberType>(NumberType(4));
}
AZStd::string_view GetJsonForFullySetInstance() override
@@ -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;
@@ -832,18 +832,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 +872,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()
@@ -30,7 +30,7 @@ namespace AZ
while (maxAttempts > 0)
{
// Use the system's tick count to base the folder name
DWORD currentTick = GetTickCount64();
ULONGLONG currentTick = GetTickCount64();
azsnprintf(workingTempPathBuffer, bufferSize, "%sUnitTest-%X", tempDir, aznumeric_cast<unsigned int>(currentTick));
// Check if the requested directory name is available and re-generate if it already exists
+6 -5
View File
@@ -14,6 +14,7 @@
#include <AzCore/std/chrono/chrono.h>
#include <AzCore/std/string/conversions.h>
#include <AzCore/Utils/Utils.h>
#include <AzCore/Casting/lossy_cast.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
@@ -284,7 +285,7 @@ char* CRCfix::GetToken(FILE* infile, FILE* outfile)
{
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '#' || c == '_')
{
token[i++] = c;
token[i++] = azlossy_cast<char>(c);
continue;
}
else
@@ -375,7 +376,7 @@ void CRCfix::GetPreviousCRC(char* token, FILE* infile)
int c;
while ((c = fgetc(infile)) != ')')
{
*token++ = c;
*token++ = azlossy_cast<char>(c);
}
*token = 0;
}
@@ -426,7 +427,7 @@ int CRCfix::Fix(Filename srce)
if (strcmp(token, "AZ_CRC") == 0 && lastchar == '(')
{
size_t i = strlen(token);
token[i++] = lastchar;
token[i++] = azlossy_cast<char>(lastchar);
int c = fgetc(infile);
if (c == '"')
@@ -435,11 +436,11 @@ int CRCfix::Fix(Filename srce)
do
{
token[i++] = c;
token[i++] = azlossy_cast<char>(c);
c = fgetc(infile);
} while (c != '"');
token[i++] = c;
token[i++] = azlossy_cast<char>(c);
c = fgetc(infile);
int oldcrc = 0, newcrc;