General AMF cleanup (#663)

* General AMF cleanup

Proper memory management as well as style cleanup

* General optimizations

Fix AMFArray so values are properly deleted when you leave the scope it was created in.
Add bounds check for deletion so you don't double delete.
Remove all AMFdeletions that are contained in an array since the array now manages its own memory and deletes it when it is no longer needed.

* Better tests and fix de-serialize

Fix de-serialize to be correct and implement a test to check this

* Update AMFDeserializeTests.cpp

* Update AMFFormat.cpp
This commit is contained in:
David Markowitz
2022-07-21 22:26:09 -07:00
committed by GitHub
parent 5523b6aafc
commit 6a38b67ed5
16 changed files with 303 additions and 389 deletions

View File

@@ -59,6 +59,7 @@ public:
\return The AMF value type
*/
virtual AMFValueType GetValueType() = 0;
virtual ~AMFValue() {};
};
//! A typedef for a pointer to an AMF value
@@ -233,6 +234,7 @@ public:
};
//! The array value AMF type
// This object will manage it's own memory map and list. Do not delete its values.
class AMFArrayValue : public AMFValue {
private:
_AMFArrayMap_ associative; //!< The array map (associative part)
@@ -245,6 +247,7 @@ private:
AMFValueType GetValueType() { return AMFArray; }
public:
~AMFArrayValue() override;
//! Inserts an item into the array map for a specific key
/*!
\param key The key to set
@@ -332,6 +335,7 @@ private:
\return The AMF value type
*/
AMFValueType GetValueType() { return AMFObject; }
~AMFObjectValue() override;
public:
//! Constructor