Skip to content

Commit 7dd7f8e

Browse files
committed
CborValue - Update move constructors to create a new decoder each time
1 parent 6517faa commit 7dd7f8e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/aws-cpp-sdk-core/include/aws/core/utils/cbor/CborValue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ namespace Aws
4343
* Moves the ownership of the CborValue.
4444
* No copying is performed.
4545
*/
46-
CborValue(CborValue&& value);
46+
CborValue(CborValue&& value) noexcept;
4747

4848
/**
4949
* Move assignment operator.
5050
*/
51-
CborValue& operator=(CborValue&& other);
51+
CborValue& operator=(CborValue&& other) noexcept;
5252

5353
~CborValue();
5454

src/aws-cpp-sdk-core/source/utils/cbor/CborValue.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ CborValue& CborValue::operator=(const CborValue& other)
3939
}
4040

4141
CborValue::CborValue(CborValue&& value) :
42-
m_body(std::move(value.m_body)),
43-
m_decoder(std::move(value.m_decoder))
42+
m_body(std::move(value.m_body))
4443
{
44+
auto cursor = Aws::Crt::ByteCursorFromArray(reinterpret_cast<const uint8_t*>(m_body.c_str()), m_body.length());
45+
m_decoder = std::make_shared<CborDecoder>(cursor);
4546
}
4647

4748
CborValue& CborValue::operator=(CborValue&& other)
4849
{
4950
if (this != &other) {
5051
m_body = std::move(other.m_body);
51-
m_decoder = std::move(other.m_decoder);
52+
auto cursor = Aws::Crt::ByteCursorFromArray(reinterpret_cast<const uint8_t*>(m_body.c_str()), m_body.length());
53+
m_decoder = std::make_shared<CborDecoder>(cursor);
5254
}
5355
return *this;
5456
}
5557

56-
CborValue::~CborValue()
57-
{
58-
}
58+
CborValue::~CborValue() = default;

0 commit comments

Comments
 (0)