diff --git a/Code/Framework/AzCore/AzCore/Console/Console.cpp b/Code/Framework/AzCore/AzCore/Console/Console.cpp index 8bb50f77e0..0166e964b8 100644 --- a/Code/Framework/AzCore/AzCore/Console/Console.cpp +++ b/Code/Framework/AzCore/AzCore/Console/Console.cpp @@ -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()) diff --git a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl index 4e8356b436..a6d41b0ef8 100644 --- a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl +++ b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl @@ -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(left.size()) - aznumeric_cast(right.size()) + ? aznumeric_cast(aznumeric_cast(left.size()) - aznumeric_cast(right.size())) : charCompareResult; } } diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp index f358370be5..3d8cbc7480 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp @@ -38,7 +38,7 @@ namespace AZ break; } - u32 cacheSize = m_cacheSizeMib * 1_mib; + u32 cacheSize = static_cast(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). " diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp index 6ec3fb295c..e0e512e21f 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp @@ -36,7 +36,7 @@ namespace AZ break; } - u32 cacheSize = m_cacheSizeMib * 1_mib; + u32 cacheSize = static_cast(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). " diff --git a/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp b/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp index da7a78e1b3..d4f874c667 100644 --- a/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp +++ b/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -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(tolower(stripCharacter)); + const char upper = azlossy_cast(toupper(stripCharacter)); if (lower != upper) { combinedStripCharacters.push_back(lower); diff --git a/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp b/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp index bf0a1023ab..fc707c9751 100644 --- a/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp +++ b/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp @@ -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(row), static_cast(col)); return os; }; diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp index be06e76f68..c971535f0b 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp @@ -32,12 +32,12 @@ namespace JsonSerializationTests AZStd::shared_ptr CreateDefaultInstance() override { - return AZStd::make_shared(0); + return AZStd::make_shared(NumberType(0)); } AZStd::shared_ptr CreateFullySetInstance() override { - return AZStd::make_shared(4); + return AZStd::make_shared(NumberType(4)); } AZStd::string_view GetJsonForFullySetInstance() override diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp index baabfb35cc..d74f69e27b 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp @@ -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(r > 9 ? (r - 10) + 'a' : '0' + r); } szBuf[i] = '\0'; return szBuf; diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp index 445bba63f4..b3b2328222 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp @@ -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( ((t->tm_year - 80) << 9) | (t->tm_mon << 5) - | t->tm_mday; + | t->tm_mday); } uint16_t DOSTime(tm* t) { - return + return static_cast( ((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(nCompressionMethod); } uint64_t FileEntry::GetModificationTime() diff --git a/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp b/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp index dc4b31c9be..fcda5d351a 100644 --- a/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp +++ b/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp @@ -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(currentTick)); // Check if the requested directory name is available and re-generate if it already exists diff --git a/Code/Framework/Crcfix/crcfix.cpp b/Code/Framework/Crcfix/crcfix.cpp index 778b9e2185..c788d2a0c6 100644 --- a/Code/Framework/Crcfix/crcfix.cpp +++ b/Code/Framework/Crcfix/crcfix.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -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(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(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(lastchar); int c = fgetc(infile); if (c == '"') @@ -435,11 +436,11 @@ int CRCfix::Fix(Filename srce) do { - token[i++] = c; + token[i++] = azlossy_cast(c); c = fgetc(infile); } while (c != '"'); - token[i++] = c; + token[i++] = azlossy_cast(c); c = fgetc(infile); int oldcrc = 0, newcrc;