Skip to content

Commit

Permalink
[MOVE] A left over from the move implemtations. One that is only foun…
Browse files Browse the repository at this point in the history
…d if you use it ;-) (rdkcentral#1581)
  • Loading branch information
pwielders authored Apr 30, 2024
1 parent c0bfab6 commit effa74c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Source/core/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace Core {
template <const uint32_t STARTSIZE, typename SIZETYPE>
class AllocatorType {
public:
AllocatorType<STARTSIZE, SIZETYPE> operator=(const AllocatorType<STARTSIZE, SIZETYPE>&) = delete;
AllocatorType<STARTSIZE, SIZETYPE>& operator=(const AllocatorType<STARTSIZE, SIZETYPE>& copy) = delete;

AllocatorType()
: _bufferSize(STARTSIZE)
Expand Down Expand Up @@ -173,6 +173,21 @@ namespace Core {
}
}

AllocatorType<STARTSIZE, SIZETYPE>& operator=(AllocatorType<STARTSIZE, SIZETYPE>&& move) {
if (STARTSIZE != 0) {
if (_data != nullptr) {
::free(_data);
}
_data == move._data;
move._data = nullptr;
_bufferSize = move._bufferSize;
}
else {
::memcpy(_data, move._data, _bufferSize);
}
return (*this);
}

public:
inline uint8_t& operator[](const SIZETYPE index)
{
Expand Down Expand Up @@ -527,7 +542,7 @@ namespace Core {
FrameType<BLOCKSIZE, BIG_ENDIAN_ORDERING, SIZE_CONTEXT>& operator=(FrameType<BLOCKSIZE, BIG_ENDIAN_ORDERING, SIZE_CONTEXT>&& move) {
if (this != &move) {
_size = move._size;
_data = std::move(move.data);
_data = std::move(move._data);

move._size = 0;
}
Expand Down

0 comments on commit effa74c

Please sign in to comment.