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
@@ -198,7 +198,7 @@ namespace AZ
ConsoleFunctorBase* Console::FindCommand(AZStd::string_view 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())
@@ -284,7 +284,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())
{
@@ -327,7 +327,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())
{
@@ -403,7 +403,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())
@@ -222,7 +222,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())
? static_cast<int>(aznumeric_cast<ptrdiff_t>(left.size()) - aznumeric_cast<ptrdiff_t>(right.size()))
: charCompareResult;
}
}
@@ -39,7 +39,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). "
@@ -189,7 +189,7 @@ namespace AZ
s32 numAvailableSlots = CalculateAvailableRequestSlots();
status.m_numAvailableSlots = AZStd::min(status.m_numAvailableSlots, numAvailableSlots);
status.m_isIdle = status.m_isIdle &&
numAvailableSlots == m_numBlocks &&
static_cast<u32>(numAvailableSlots) == m_numBlocks &&
m_delayedSections.empty();
}
@@ -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). "
@@ -13,11 +13,6 @@
#include <AzCore/std/parallel/spin_mutex.h>
#ifdef AZ_COMPILER_MSVC
# pragma warning(push)
# pragma warning(disable: 4355) // 'this' : used in base member initializer list
#endif
// A reasonable define for a stack allocator size for the high level jobs.
#define AZ_JOBS_DEFAULT_STACK_ALLOCATOR_SIZE AZStd::GetMax<unsigned>(2048,512 * AZStd::thread::hardware_concurrency())
@@ -769,9 +764,5 @@ namespace AZ
}
}
#ifdef AZ_COMPILER_MSVC
# pragma warning(pop)
#endif
#endif
#pragma once
@@ -10,12 +10,9 @@
#include <AzCore/Math/Internal/SimdMathCommon_scalar.inl>
#ifdef _MSC_VER
// Unity builds on windows using the scalar backend are tripping some really strange warning behavior..
// Disable the warning so we can test the scalar implementation with unity on windows
# pragma warning (push)
# pragma warning (disable: 4723) // Potential divide by zero
#endif
AZ_PUSH_DISABLE_WARNING(4723, "-Wunknown-warning-option") // Potential divide by zero
namespace AZ
{
@@ -1049,6 +1046,4 @@ namespace AZ
}
}
#ifdef _MSC_VER
# pragma warning (pop)
#endif
AZ_POP_DISABLE_WARNING
@@ -57,7 +57,7 @@ namespace AZ
float GetPerspectiveMatrixFOV(const Matrix4x4& m)
{
return 2.0 * AZStd::atan(1.0f / m.GetElement(1, 1));
return 2.0f * AZStd::atan(1.0f / m.GetElement(1, 1));
}
Matrix4x4* MakeFrustumMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth)
@@ -246,10 +246,6 @@ namespace AZ
//! Takes the absolute value of each component of the quaternion.
Quaternion GetAbs() const;
#ifdef AZ_COMPILER_MSVC
# pragma warning(push)
# pragma warning(disable:4201) // anonymous union
#endif
union
{
Simd::Vec4::FloatType m_value;
@@ -263,9 +259,6 @@ namespace AZ
float m_w;
};
};
#ifdef AZ_COMPILER_MSVC
# pragma warning(pop)
#endif
};
//! Non-member functionality belonging to the AZ namespace
@@ -281,10 +281,6 @@ namespace AZ
private:
#ifdef AZ_COMPILER_MSVC
# pragma warning(push)
# pragma warning(disable:4201) // anonymous union
#endif
union
{
Simd::Vec2::FloatType m_value;
@@ -296,9 +292,6 @@ namespace AZ
float m_y;
};
};
#ifdef AZ_COMPILER_MSVC
# pragma warning(pop)
#endif
};
//! Allows pre-multiplying by a float.
@@ -312,10 +312,6 @@ namespace AZ
private:
#ifdef AZ_COMPILER_MSVC
# pragma warning(push)
# pragma warning(disable:4201) // anonymous union
#endif
union
{
Simd::Vec3::FloatType m_value;
@@ -328,9 +324,6 @@ namespace AZ
float m_z;
};
};
#ifdef AZ_COMPILER_MSVC
# pragma warning(pop)
#endif
};
//! Non member functionality belonging to the AZ namespace.
@@ -283,11 +283,6 @@ namespace AZ
Simd::Vec4::FloatType GetSimdValue() const;
protected:
#ifdef AZ_COMPILER_MSVC
# pragma warning(push)
# pragma warning(disable:4201) // anonymous union
#endif
union
{
Simd::Vec4::FloatType m_value;
@@ -301,9 +296,6 @@ namespace AZ
float m_w;
};
};
#ifdef AZ_COMPILER_MSVC
# pragma warning(pop)
#endif
};
}
@@ -1294,14 +1294,6 @@ int mspace_mallopt(int, int);
/*------------------------------ internal #includes ---------------------- */
#ifdef WIN32
#pragma warning(push)
#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
# ifdef AZ_PLATFORM_WINDOWS
# pragma warning( disable : 4267 )
# endif
#endif /* WIN32 */
#include <stdio.h> /* for printing in malloc_stats */
#ifndef LACKS_ERRNO_H
@@ -2170,7 +2162,7 @@ typedef unsigned int flag_t; /* The type of various bit flag sets */
#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A)))
/* Bounds on request (not chunk) sizes. */
#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2)
#define MAX_REQUEST ((~MIN_CHUNK_SIZE + 1) << 2)
#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
/* pad request bytes into a usable size */
@@ -2881,10 +2873,10 @@ static size_t traverse_and_check(mstate m);
#define treemap_is_marked(M, i) ((M)->treemap & idx2bit(i))
/* isolate the least set bit of a bitmap */
#define least_bit(x) ((x) & - (x))
#define least_bit(x) ((x) & (~(x)+1))
/* mask with all bits to left of least bit of x on */
#define left_bits(x) ((x << 1) | -(x << 1))
#define left_bits(x) ((x << 1) | (~(x << 1)+1))
/* mask with all bits to left of or equal to least bit of x on */
#define same_or_left_bits(x) ((x) | -(x))
@@ -4528,7 +4520,7 @@ static int sys_trim(mstate m, size_t pad)
static void* tmalloc_large(mstate m, size_t nb)
{
tchunkptr v = 0;
size_t rsize = -nb; /* Unsigned negation */
size_t rsize = ~nb+1; /* Unsigned negation */
tchunkptr t;
bindex_t idx;
compute_tree_index(nb, idx);
@@ -4807,7 +4799,7 @@ static void* internal_memalign(mstate m, size_t alignment, size_t bytes)
char* br = (char*)mem2chunk((size_t)(((size_t)(mem +
alignment -
SIZE_T_ONE)) &
- alignment));
(~alignment+1)));
char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE) ?
br : br + alignment;
mchunkptr newp = (mchunkptr)pos;
@@ -5489,7 +5481,7 @@ postaction:
size_t msize;
ensure_initialization();
msize = pad_request(sizeof(struct malloc_state));
if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size))
if (capacity < (~(msize + TOP_FOOT_SIZE + mparams.page_size)+1))
{
size_t rs = ((capacity == 0) ? mparams.granularity :
(capacity + TOP_FOOT_SIZE + msize));
@@ -5512,7 +5504,7 @@ postaction:
ensure_initialization();
msize = pad_request(sizeof(struct malloc_state));
if (capacity > msize + TOP_FOOT_SIZE &&
capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size))
capacity < (~(msize + TOP_FOOT_SIZE + mparams.page_size)+1))
{
m = init_user_mstate((char*)base, capacity);
m->seg.sflags = EXTERN_BIT;
@@ -6367,6 +6359,3 @@ postaction:
*/
#ifdef WIN32
#pragma warning(pop)
#endif /* WIN32 */
@@ -87,9 +87,6 @@
#define AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_POP_DISABLE_WARNING
# define AZ_FORCE_INLINE __forceinline
#if !defined(_DEBUG)
# pragma warning(disable:4714) //warning C4714 marked as __forceinline not inlined. Sadly this happens when LTCG during linking. We tried to NOT use force inline but VC 2012 is bad at inlining.
#endif
/// Aligns a declaration.
# define AZ_ALIGN(_decl, _alignment) \
@@ -24,11 +24,6 @@
#include <AzCore/Outcome/Outcome.h>
#include <AzCore/Script/ScriptContextAttributes.h>
#if defined(AZ_COMPILER_MSVC)
# pragma warning(push)
# pragma warning(disable: 4127) // conditional expression is constant
#endif
namespace AZStd
{
template <typename T>
@@ -4507,7 +4502,7 @@ namespace AZ
params.resize(sizeof...(Args) + eBehaviorBusForwarderEventIndices::ParameterFirst);
SetParameters<R>(&params[eBehaviorBusForwarderEventIndices::Result], nullptr);
SetParameters<void*>(&params[eBehaviorBusForwarderEventIndices::UserData], nullptr);
if (sizeof...(Args) > 0)
if constexpr (sizeof...(Args) > 0)
{
SetParameters<Args...>(&params[eBehaviorBusForwarderEventIndices::ParameterFirst], nullptr);
}
@@ -4872,10 +4867,6 @@ namespace AZ
} // namespace Internal
} // namespace AZ
#if defined(AZ_COMPILER_MSVC)
# pragma warning(pop)
#endif
// pull AzStd on demand reflection
#include <AzCore/RTTI/AzStdOnDemandPrettyName.inl>
#include <AzCore/RTTI/AzStdOnDemandReflection.inl>
@@ -656,26 +656,25 @@ namespace AZ
using ElementType = typename AZStd::Utils::if_c<AZStd::is_enum<typename ElementTypeInfo::Type>::value, typename ElementTypeInfo::Type, typename ElementTypeInfo::ElementType>::type;
AZ_Assert(m_classData->m_typeId == AzTypeInfo<typename ElementTypeInfo::ClassType>::Uuid(), "Data element (%s) belongs to a different class!", AzTypeInfo<typename ElementTypeInfo::ValueType>::Name());
#if defined(AZ_COMPILER_MSVC)
# pragma warning(push)
# pragma warning(disable: 4127) // conditional expression is constant
#endif
const SerializeContext::ClassData* classData = m_context->m_serializeContext.FindClassData(AzTypeInfo<typename ElementTypeInfo::ValueType>::Uuid());
if (classData && classData->m_editData)
{
return DataElement<T>(uiId, memberVariable, classData->m_editData->m_name, classData->m_editData->m_description);
}
else if (AZStd::is_enum<ElementType>::value && AzTypeInfo<ElementType>::Name() != nullptr)
else
{
auto enumIter = m_context->m_enumData.find(AzTypeInfo<ElementType>::Uuid());
if (enumIter != m_context->m_enumData.end())
if constexpr (AZStd::is_enum<ElementType>::value)
{
return DataElement<T>(uiId, memberVariable, enumIter->second.m_name, enumIter->second.m_description);
if (AzTypeInfo<ElementType>::Name() != nullptr)
{
auto enumIter = m_context->m_enumData.find(AzTypeInfo<ElementType>::Uuid());
if (enumIter != m_context->m_enumData.end())
{
return DataElement<T>(uiId, memberVariable, enumIter->second.m_name, enumIter->second.m_description);
}
}
}
}
#if defined(AZ_COMPILER_MSVC)
# pragma warning(pop)
#endif
const char* typeName = AzTypeInfo<typename ElementTypeInfo::ValueType>::Name();
return DataElement<T>(uiId, memberVariable, typeName, typeName);
@@ -342,8 +342,8 @@ namespace AZ::StringFunc::Internal
{
for (const char stripCharacter : stripCharacters)
{
const char lower = tolower(stripCharacter);
const char upper = toupper(stripCharacter);
const char lower = static_cast<char>(tolower(stripCharacter));
const char upper = static_cast<char>(toupper(stripCharacter));
if (lower != upper)
{
combinedStripCharacters.push_back(lower);
@@ -41,7 +41,7 @@ namespace AZ
{
Task& task = m_tasks[i];
task.m_graph = this;
task.m_successorOffset = cursor - m_successors.data();
task.m_successorOffset = static_cast<uint32_t>(cursor - m_successors.data());
cursor += task.m_outboundLinkCount;
AZ_Assert(task.m_outboundLinkCount == links[i].size(), "Task outbound link information mismatch");
@@ -78,7 +78,7 @@ namespace AZ
return remaining;
}
if (m_waitEvent && remaining == (m_parent ? 1 : 0))
if (m_waitEvent && remaining == (m_parent ? 1u : 0u))
{
m_waitEvent->Signal();
}
@@ -259,7 +259,7 @@ namespace AZ
}
bool isRetained = task->m_graph->m_parent != nullptr;
if (task->m_graph->Release() == (isRetained ? 1 : 0))
if (task->m_graph->Release() == (isRetained ? 1u : 0u))
{
m_executor->ReleaseGraph();
}
@@ -291,9 +291,7 @@ namespace AZStd
template <>
struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2* sizeof(int) >
{
#if defined(AZ_COMPILER_MSVC)
# pragma warning(push)
# pragma warning(disable: 4121) // alignment of a member was sensitive to packing
AZ_PUSH_DISABLE_WARNING(4121, "-Wunknown-warning-option") // alignment of a member was sensitive to packing
// GenericClass* (X::*ProbeFunc) changes it's size. From Microsoft:
// Jason Shirk [MSFT]
// This is a known bug/issue. Unfortunately, we can't fix it in X86 product
@@ -302,7 +300,6 @@ namespace AZStd
// We have addressed the issue for all future platforms (including IA64) where
// binary compatibility isn't yet an issue.
// We can fix this warning by adding forward decl class __single_inheritance CLASS; if the XFuncType is member function.
#endif
template <class X, class XFuncType, class GenericMemFuncType>
inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind, GenericMemFuncType& bound_func)
{
@@ -330,11 +327,7 @@ namespace AZStd
u.s.codeptr = u2.s.codeptr;
return (pthis->*u.ProbeFunc)();
}
#if defined(AZ_COMPILER_MSVC)
# pragma warning(default: 4121) // alignment of a member was sensitive to packing
# pragma warning(pop)
#endif
AZ_POP_DISABLE_WARNING
};
// Nasty hack for Microsoft and Intel (IA32 and Itanium)
@@ -20,13 +20,6 @@
#include <AzCore/std/typetraits/remove_cvref.h>
#include <AzCore/std/createdestroy.h>
#if defined(AZ_COMPILER_MSVC)
# pragma warning( push )
# pragma warning( disable : 4793 ) // complaint about native code generation
# pragma warning( disable : 4127 ) // "conditional expression is constant"
# pragma warning( disable : 4275 ) // non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_cast'
#endif
#define AZSTD_FUNCTION_TARGET_FIX(x)
#define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t<!std::is_integral_v<Functor>, Type>
@@ -796,12 +789,5 @@ namespace AZStd
//#undef aztypeid
//#undef aztypeid_cmp
#if defined(AZ_COMPILER_MSVC)
# pragma warning( default : 4793 ) // complaint about native code generation
# pragma warning( default : 4127 ) // "conditional expression is constant"
# pragma warning( default : 4275 ) // non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_cast'
# pragma warning( pop )
#endif
#endif // AZSTD_FUNCTION_BASE_HEADER
#pragma once
@@ -13,11 +13,6 @@
#include <AzCore/std/typetraits/remove_cvref.h>
#include <AzCore/std/allocator.h>
#if defined(AZ_COMPILER_MSVC)
# pragma warning( push )
# pragma warning( disable : 4127 ) // "conditional expression is constant"
#endif
namespace AZStd
{
namespace Internal
@@ -689,7 +684,3 @@ namespace AZStd
}
};
} // end namespace AZStd
#if defined(AZ_COMPILER_MSVC)
# pragma warning( pop )
#endif
@@ -489,24 +489,26 @@ namespace AZStd
{
return;
}
float loadFactor = (float)m_numElements.load(memory_order_acquire) / (float)m_storage.get_num_buckets();
if (loadFactor > max_load_factor())
else
{
acquire_all();
//check the load factor again, as another thread may have beaten us to the rehash
size_type numElements = m_numElements.load(memory_order_acquire);
float maxLoadFactor = max_load_factor();
size_type numBuckets = m_storage.get_num_buckets();
loadFactor = (float)numElements / (float)numBuckets;
if (loadFactor > maxLoadFactor)
float loadFactor = (float)m_numElements.load(memory_order_acquire) / (float)m_storage.get_num_buckets();
if (loadFactor > max_load_factor())
{
size_type minNumBuckets = (size_type)((float)numElements / maxLoadFactor);
m_storage.rehash(this, minNumBuckets);
}
acquire_all();
release_all();
// check the load factor again, as another thread may have beaten us to the rehash
size_type numElements = m_numElements.load(memory_order_acquire);
float maxLoadFactor = max_load_factor();
size_type numBuckets = m_storage.get_num_buckets();
loadFactor = (float)numElements / (float)numBuckets;
if (loadFactor > maxLoadFactor)
{
size_type minNumBuckets = (size_type)((float)numElements / maxLoadFactor);
m_storage.rehash(this, minNumBuckets);
}
release_all();
}
}
}
@@ -192,9 +192,5 @@ namespace AZStd
}
} // namespace AZStd
/*#ifdef AZ_COMPILER_MSVC
# pragma warning(pop)
#endif */
#endif // #ifndef AZSTD_SMART_PTR_WEAK_PTR_H
#pragma once
@@ -22,11 +22,6 @@
// used for std::pointer_traits \note do an AZStd version
#include <memory>
#if defined(AZ_COMPILER_MSVC)
# pragma warning(push)
# pragma warning(disable: 6011 28198)
#endif // AZ_COMPILER_MSVC
#ifndef AZ_REGEX_MAX_COMPLEXITY_COUNT
#define AZ_REGEX_MAX_COMPLEXITY_COUNT 10000000L /* set to 0 to disable */
#endif /* AZ_REGEX_MAX_COMPLEXITY_COUNT */
@@ -4766,7 +4761,3 @@ namespace AZStd
Trans();
}
} // namespace AZStd
#if defined(AZ_COMPILER_MSVC)
# pragma warning(pop)
#endif // AZ_COMPILER_MSVC
@@ -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;
};
+1 -1
View File
@@ -1736,7 +1736,7 @@ namespace Benchmark
std::numeric_limits<AZ::s8>::max());
std::generate(m_randomPriorities.begin(), m_randomPriorities.end(), [&randomPriorityDistribution, &randomPriorityGenerator]()
{
return randomPriorityDistribution(randomPriorityGenerator);
return static_cast<AZ::s8>(randomPriorityDistribution(randomPriorityGenerator));
});
// Generate some random depths
@@ -94,7 +94,7 @@ namespace UnitTest
float testStoreValues[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
VectorType::StoreUnaligned(testStoreValues, result);
for (int32_t i = 0; i < VectorType::ElementCount; ++i)
for (uint32_t i = 0; i < VectorType::ElementCount; ++i)
{
if (i == replaceIndex)
{
@@ -297,7 +297,7 @@ AZ_POP_DISABLE_WARNING
// the overflow guard is generated out of rand, so we set a fixed seed before doing the allocation
// to get a deterministic guard
srand(0);
const unsigned char expectedInitialGuard = rand();
const unsigned char expectedInitialGuard = static_cast<unsigned char>(rand());
srand(0);
TestClass<16>* someObject = aznew TestClass<16>();
@@ -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
@@ -225,7 +225,6 @@ namespace JsonSerializationTests
static_assert((RowCount >= 3 && RowCount <= 4) && (ColumnCount >= 3 && ColumnCount <= 4),
"Only matrix 3x3, 3x4 or 4x4 are supported by this test.");
}
return "{}";
}
void ConfigureFeatures(JsonSerializerConformityTestDescriptorFeatures& features) override
@@ -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)
{
@@ -176,7 +176,7 @@ namespace AzNetworking
//! Takes a quantized integral value and stores the floating point representation.
void DecodeQuantizedValues();
AZ_PUSH_DISABLE_WARNING(4201 4324, "-Wunknown-warning-option") // anonymous union, structure was padded due to alignment
AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") // structure was padded due to alignment
union
{
float m_quantizedValues[NUM_ELEMENTS];
@@ -218,14 +218,7 @@ namespace AzNetworking
{
SerializeType serializedValue = static_cast<SerializeType>(m_serializeValues[i]);
#ifdef AZ_COMPILER_MSVC
# pragma warning(push)
# pragma warning(disable: 4127) // conditional expression is constant
#endif
if (NUM_BYTES == 3)
#ifdef AZ_COMPILER_MSVC
# pragma warning(pop)
#endif
if constexpr (NUM_BYTES == 3)
{
uint8_t lowByte = static_cast<uint8_t>((serializedValue & 0x000000FF) );
uint8_t midByte = static_cast<uint8_t>((serializedValue & 0x0000FF00) >> 8);
@@ -40,6 +40,8 @@ namespace AzQtComponents
//! Current value.
Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
public:
using value_type = int;
explicit SliderCombo(QWidget *parent = nullptr);
~SliderCombo();
@@ -142,6 +144,8 @@ namespace AzQtComponents
Q_PROPERTY(double curveMidpoint READ curveMidpoint WRITE setCurveMidpoint)
public:
using value_type = double;
explicit SliderDoubleCombo(QWidget *parent = nullptr);
~SliderDoubleCombo();
@@ -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
@@ -297,8 +297,8 @@ namespace AzToolsFramework
GetInputChannel<AzFramework::InputChannelDeltaWithSharedPosition2D>(AzFramework::InputDeviceMouse::Movement::Z);
systemCursorChannel->ProcessRawInputEvent(m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetLength());
movementXChannel->ProcessRawInputEvent(cursorDelta.x());
movementYChannel->ProcessRawInputEvent(cursorDelta.y());
movementXChannel->ProcessRawInputEvent(static_cast<float>(cursorDelta.x()));
movementYChannel->ProcessRawInputEvent(static_cast<float>(cursorDelta.y()));
mouseWheelChannel->ProcessRawInputEvent(0.0f);
NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr);
@@ -2180,7 +2180,7 @@ namespace AzToolsFramework
QPainterPath path;
auto newRect = option.rect;
newRect.setHeight(newRect.height() - 1.0);
newRect.setHeight(newRect.height() - 1);
path.addRect(newRect);
// Get the foreground color of the current object to draw our sub-object-selected box
@@ -254,8 +254,8 @@ namespace AzToolsFramework
QRect globalRect = m_editor->GetWidgetAndVisibleChildrenGlobalRect(dragRowWidget);
int top = mapFromGlobal(globalRect.topLeft()).y();
int imageHeight = dragImage.height() / dragImage.devicePixelRatioF();
int imageWidth = dragImage.width() / dragImage.devicePixelRatioF();
int imageHeight = static_cast<int>(dragImage.height() / dragImage.devicePixelRatioF());
int imageWidth = static_cast<int>(dragImage.width() / dragImage.devicePixelRatioF());
QRect currRect = QRect(QPoint(LeftMargin + 1, top), QPoint(LeftMargin + 1 + imageWidth, top + imageHeight));
painter.setOpacity(alpha);
@@ -1867,7 +1867,7 @@ namespace AzToolsFramework
}
const auto dpr = devicePixelRatioF();
QPixmap dragImage(width * dpr, height * dpr);
QPixmap dragImage(static_cast<int>(width * dpr), static_cast<int>(height * dpr));
dragImage.setDevicePixelRatio(dpr);
dragImage.fill(Qt::transparent);
@@ -20,7 +20,6 @@ ly_add_target(
AzToolsFramework/aztoolsframework_files.cmake
AzToolsFramework/aztoolsframework_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
Platform/Common/${PAL_TRAIT_COMPILER_ID}/aztoolsframework_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake
INCLUDE_DIRECTORIES
PUBLIC
.
@@ -1,7 +0,0 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
@@ -1,13 +0,0 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
ly_add_source_properties(
SOURCES AzToolsFramework/Application/ToolsApplication.cpp
PROPERTY COMPILE_OPTIONS
VALUES -bigobj
)
@@ -583,7 +583,7 @@ namespace UnitTest
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::EventResult(
m_mouseInteractionResult, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
vi::MouseInteractionEvent(mouseInteraction, ev->angleDelta().y()));
vi::MouseInteractionEvent(mouseInteraction, static_cast<float>(ev->angleDelta().y())));
}
MouseInteractionResult m_mouseInteractionResult;
@@ -16,7 +16,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefabs_SingleEntityEach)(::benchmark::State& state)
{
const unsigned int numEntities = state.range();
const unsigned int numEntities = static_cast<unsigned int>(state.range());
const unsigned int numInstances = numEntities;
CreateFakePaths(numInstances);
@@ -58,7 +58,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromEntities)(::benchmark::State& state)
{
const unsigned int numEntities = state.range();
const unsigned int numEntities = static_cast<unsigned int>(state.range());
for (auto _ : state)
{
@@ -93,7 +93,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromSingleDepthInstances)(::benchmark::State& state)
{
const unsigned int numInstancesToAdd = state.range();
const unsigned int numInstancesToAdd = static_cast<unsigned int>(state.range());
const unsigned int numEntities = numInstancesToAdd;
// Create fake paths for all the nested instances
@@ -144,7 +144,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromLinearNestingOfInstances)(::benchmark::State& state)
{
const unsigned int numInstances = state.range();
const unsigned int numInstances = static_cast<unsigned int>(state.range());
// Create fake paths for all the nested instances
// plus the root instance
@@ -16,7 +16,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabInstantiate, InstantiatePrefab_SingleEntityInstance)(::benchmark::State& state)
{
const unsigned int numInstances = state.range();
const unsigned int numInstances = static_cast<unsigned int>(state.range());
AZStd::unique_ptr<Instance> firstInstance = m_prefabSystemComponent->CreatePrefab(
{ CreateEntity("Entity1") },
@@ -16,7 +16,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabLoad, LoadPrefab_Basic)(::benchmark::State& state)
{
const unsigned int numTemplates = state.range();
const unsigned int numTemplates = static_cast<unsigned int>(state.range());
CreateFakePaths(numTemplates);
for (auto _ : state)
@@ -18,7 +18,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_SingeEntityInstances)(::benchmark::State& state)
{
const unsigned int numInstances = state.range();
const unsigned int numInstances = static_cast<unsigned int>(state.range());
CreateFakePaths(2);
const auto& nestedTemplatePath = m_paths.front();
@@ -80,7 +80,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_SingleLinearNestingOfInstances)(::benchmark::State& state)
{
const unsigned int maxDepth = state.range();
const unsigned int maxDepth = static_cast<unsigned int>(state.range());
CreateFakePaths(maxDepth);
const unsigned int numInstances = maxDepth;
@@ -131,8 +131,8 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_MultipleLinearNestingOfInstances)(::benchmark::State& state)
{
const unsigned int numRootInstances = state.range();
const unsigned int maxDepth = state.range();
const unsigned int numRootInstances = static_cast<unsigned int>(state.range());
const unsigned int maxDepth = static_cast<unsigned int>(state.range());
CreateFakePaths(maxDepth);
const unsigned int numInstances = numRootInstances * maxDepth;
@@ -192,7 +192,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_BinaryTreeNestedInstanceHierarchy)(::benchmark::State& state)
{
const unsigned int maxDepth = state.range();
const unsigned int maxDepth = static_cast<unsigned int>(state.range());
CreateFakePaths(maxDepth);
const unsigned int numInstances = (1 << maxDepth) - 1;
@@ -18,7 +18,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_SpawnableCreate, CreateSpawnable_SingleEntityInstance)(::benchmark::State& state)
{
const unsigned int numSpawnables = state.range();
const unsigned int numSpawnables = static_cast<unsigned int>(state.range());
AZStd::unique_ptr<Instance> instance(m_prefabSystemComponent->CreatePrefab(
{ CreateEntity("Entity1") },