Commit Graph

48 Commits

Author SHA1 Message Date
moraaar 5145fceedc Fix some compilation errors due to warnings of potentially returning unitialized variables. (#5796)
Signed-off-by: moraaar <moraaar@amazon.com>
2021-11-22 09:57:42 +00:00
lumberyard-employee-dm 58c227ceb1 Implemented C++23 deleted nullptr_t constructor/assignment for AZStd string classes (#4158)
* Added string and string_view class constructor overloads which is deleted that prevents initializing them from a nullptr or an integer type

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed locations where string and string_view were initialized with
nullptr

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fix IArchive::IsInstalledToHDD signature

Updated calls to ConvertAbsolutePathToAliasedPath to use an
list initialization instead of nullptr

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
2021-09-16 12:50:18 -05:00
Esteban Papp 36b7cb2814 Merge branch 'development' into cmake/warn_virtual
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Code/Framework/AzCore/AzCore/Memory/HeapSchema.h
#	Code/Framework/AzCore/AzCore/Memory/HphaSchema.h
#	Code/Framework/AzCore/AzCore/Memory/MallocSchema.h
#	Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.h
2021-09-14 15:32:35 -07:00
lumberyard-employee-dm 4e8d4c0c51 Added a max_size function to all AZStd container style allocator functions (#4106)
* Added a max_size function to all AZStd container style allocator
functions

The max_size functions returns the maximum value that a single contiguous
allocation value returns

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated the BestFitExternalMapSchema and MallocSchema
GetMaxContiguousAllocationSize function

Those functions now return a Max allocation size of
AZ_CORE_MAX_ALLOCATOR size to indicate the maximum size for a single
allocation

Changed the IAllocatorAllocator::GetMaxContiguousAllocationSize function
from a pure virtual function to regular virtual function

Removed the left over String.cpp test to validate that the issue with
the allocator::max_size() function was occuring

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
2021-09-14 16:15:46 -05:00
Esteban Papp 860b28c10b more fixes
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2021-09-08 08:48:32 -07:00
Esteban Papp 53dfb1a39e remove unnecessary ALIGN macros
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2021-08-20 20:36:11 -07:00
Esteban Papp 62a0041245 enable warning 4296: 'operator': expression is always false
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2021-08-19 16:16:28 -07:00
Esteban Papp 1d4c53a777 More fixes for Gems
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2021-08-16 16:42:03 -07:00
Luis Sempé 29c2ee9b0e Merge pull request #3014 from aws-lumberyard-dev/burelc/removeMCoreAlignedArray
Replace `MCore::AlignedArray` with `AZStd::vector`
2021-08-10 14:48:16 -07:00
Chris Burel e6259882b8 Replace MCore::AlignedArray with AZStd::vector
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-10 11:39:51 -07:00
Chris Burel 0953a75a94 Replace MCore::SmallArray usage with AZStd::vector
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-10 08:44:23 -07:00
Chris Burel 1837d05169 Rename EMotionFX class members to follow the m_ naming convention
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 16:40:35 -07:00
Chris Burel 04babd3cff Fix misnamed range-for loop variables
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 09:22:45 -07:00
Chris Burel 4034195bdc Convert EMotionFX runtime uint32 -> size_t
This allows the EMotionFX runtime to compile with `/we4267` enabled, which
emits a warning when converting from `size_t` to a smaller type. All tests
for the runtime have been updated accordingly, and they pass.

In instances where a range-for loop could be used, or a std algorithm, that
was used instead of using `size_t numItems = vec.size()` and a for loop.

Casts to `uint32` were removed where possible. Some places remain, like in
the file formats.

Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 09:22:31 -07:00
Chris Burel 382ca192c8 Fix Node/Skeleton uint32->size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 09:17:27 -07:00
Chris Burel 85c96c7596 Remove static_cast<uint32> from MemoryFile
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:38 -07:00
Chris Burel 404ab51439 uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:36 -07:00
Chris Burel 88a9a4fb5d Correct signature of MCore::MemSet to match memset
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:19 -07:00
Chris Burel 916b3a94d6 Convert MCoreCommandManager uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:18 -07:00
Chris Burel 387a1faf23 Convert IDGenerator uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:16 -07:00
Chris Burel ce139d6ae9 Remove unused HashFunctions functions
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:14 -07:00
Chris Burel 5a4b0f5770 Convert Math::Align to a template, so it doesn't depend on the uint32 type
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:12 -07:00
Chris Burel 24fa61f59e Convert DiskFile to not need uint32
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:10 -07:00
Chris Burel 38217651c5 Convert CommandSyntax uint32->size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:08 -07:00
Chris Burel f4442425ed Convert CommandManagerCallback uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:07 -07:00
Chris Burel a86e2ddf24 Convert MCore::CommandLine uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:05 -07:00
Chris Burel 889cdd8c0a Convert MCore::Command uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:03 -07:00
Chris Burel d712c54e20 Convert BoundingSphere to use int32_t to match AZ::Vector3::GetElement's signature
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:37:01 -07:00
Chris Burel b8695742d9 Convert MCore Attribute classes uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:36:59 -07:00
Chris Burel a04a0965cc Convert AlignedArray uint32->size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:36:57 -07:00
Chris Burel db622de75f Convert MCore Algorithms to use size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:36:56 -07:00
Chris Burel c3ff3f342d Update StringIdPool to use AZ::u32 instead of uint32
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:36:54 -07:00
Chris Burel 0a56c17519 Remove unused MCore::AbstractData class
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:36:52 -07:00
Chris Burel 8884227fe6 Remove MCore::Array
This translates all usages of MCore::Array to AZStd::vector. It is
designed to be as minimal of a change as possible (no changing to
range-for loops or other C++11 stuff).

We can decide to submit this wholesale, or submit it to a separate
branch that we can then integrate individual files from once we're ready
to do a specific class's transition.

It does not completely solve the `uint32`->`size_t` transition.

One important finding from doing this: `MCore::Array` uses a `memcpy`
when it reallocates. `AZStd::vector` will use the contained type's copy
or move constructor, per element. This is a significant change in
behavior. If you have type, `SomeStruct` that defines a destructor, that
type is copyable and not movable. So if you have a
`MCore::Array<SomeStruct>`, and you call `Add(); Add(); Add()`, that
reallocates 3 times, copying the contents using `memcpy`, and never
invokes `SomeStruct`'s copy constructor or destructor. Translating that
to `AZStd::vector<SomeStruct>` and calling `push_back(); push_back();
push_back();` will still reallocate 3 times, but it sees that
`SomeStruct` is non-movable, and uses the copy constructor to make the
copies, and then the destructor on the previous values. This call to the
destructor wasn't there before, and can cause things to be deleted that
weren't before. The solution to this is to make that struct be a
move-only type. Where possible, this was done by changing that type to
use `AZStd::unique_ptr` instead of a raw pointer, to get the proper move
behavior. Where that is not possible (types that inherit from
`MCore::MemoryObject`), a hand-written move constructor was created.

In general:
GetLength() becomes size()
GetMaxLength() becomes capacity()
GetIsEmpty() becomes empty()
Reserve() becomes reserve()
ReserveExact() becomes reserve()
Resize() becomes resize()
ResizeFast() becomes resize_no_construct()
Add() becomes emplace_back()
AddExact() becomes emplace_back()
AddEmpty() becomes emplace_back()
AddEmptyExact() becomes emplace_back()
GetPtr() becomes data()
GetItem() becomes at()
Shrink() becomes shrink_to_fit()
GetFirst() becomes front()
GetLast() becomes back()
Remove() becomes erase()
RemoveFirst() becomes erase()
RemoveLast() becomes pop_back()
RemoveByValue() becomes if (const auto it = AZStd::find(...); it != end(container)) container.erase(it);
Insert() becomes emplace()
Swap() becomes swap()
Clear(true) becomes clear(); shrink_to_fit()
Clear() becomes clear(); shrink_to_fit()
Clear(false) becomes clear()
Swap() becomes swap()
Find() becomes AZStd::find
MoveElements() becomes AZStd::move
SetMemoryCategory() is removed

Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-09 08:36:43 -07:00
Benjamin Jillich 8a47476498 Merge branch 'development' into jillich/EmfxAabbImprovements 2021-08-05 15:13:29 +02:00
Benjamin Jillich 8190d61e18 Removed MCore::OBB
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
2021-08-03 17:14:04 +02:00
Chris Burel 8730d5657f Allow special characters in AnimGraph node group names
Relying on the command system's string processing syntax prevents certain
names from being used. This converts the AnimGraphAdjustNodeGroup command
to be directly invokable, so that arguments can be passed directly, instead
of going through the CommandLine string parsing.

Signed-off-by: Chris Burel <burelc@amazon.com>
2021-08-02 11:33:48 -07:00
Benjamin Jillich cd25dbf71f Removed MCore::Quaternion AZ::Quaternion comparison tests
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
2021-07-29 17:09:57 +02:00
Benjamin Jillich aa98be18b7 Removed leftover MCore::Quaternion usages and fixes some include issues
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
2021-07-29 14:34:56 +02:00
Benjamin Jillich 5bb8a17d79 Removed MCore::Quaternion.h/.inl/.cpp files
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
2021-07-29 14:17:29 +02:00
Benjamin Jillich a287b67b43 Removed ReadDataSize/ReadData() helpers for attributes
Used only by legacy binary file format

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
2021-07-26 09:57:01 +02:00
Steve Pham 38261d0800 Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
2021-07-16 15:25:48 -07:00
Steve Pham b4a2edec6a Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
2021-06-30 19:51:55 -07:00
Steve Pham 70042fcdcd O3DE Copyright Updates for Linux Foundation (#1504) 2021-06-23 10:55:22 -07:00
greerdv 4b16d34af8 update usages of vector scale on Transform to use uniform scale 2021-05-26 23:00:01 +01:00
Chris Burel 28170ffe41 Add newlines to the end of all files 2021-04-23 09:43:40 -07:00
alexpete 75dc720198 Integrating latest 47acbe8 2021-03-25 13:57:57 -07:00
alexpete a10351f38d Initial commit 2021-03-08 14:30:57 -08:00