Skip to content

Commit 0749b56

Browse files
committed
Revert "move to move ctor"
This reverts commit 2982c1d.
1 parent 2982c1d commit 0749b56

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

src/aws-cpp-sdk-core/include/aws/core/utils/Array.h

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <aws/core/utils/memory/AWSMemory.h>
1111
#include <aws/core/utils/memory/stl/AWSVector.h>
12-
#include <aws/crt/Types.h>
1312
#include <memory>
1413
#include <cassert>
1514
#include <cstring>
@@ -115,7 +114,7 @@ namespace Aws
115114
}
116115

117116
//move c_tor
118-
Array(Array&& other) noexcept :
117+
Array(Array&& other) :
119118
m_size(other.m_size),
120119
m_length(other.m_length),
121120
m_data(std::move(other.m_data))
@@ -124,16 +123,6 @@ namespace Aws
124123
other.m_data = nullptr;
125124
}
126125

127-
explicit Array(Crt::ByteBuf&& other) noexcept :
128-
m_size(other.len),
129-
m_length(other.len),
130-
m_data(other.buffer)
131-
{
132-
other.capacity = 0;
133-
other.len = 0;
134-
other.buffer = nullptr;
135-
}
136-
137126
virtual ~Array() = default;
138127

139128
Array& operator=(const Array& other)
@@ -161,7 +150,7 @@ namespace Aws
161150
return *this;
162151
}
163152

164-
Array& operator=(Array&& other) noexcept
153+
Array& operator=(Array&& other)
165154
{
166155
m_size = other.m_size;
167156
m_length = other.m_length;
@@ -170,15 +159,6 @@ namespace Aws
170159
return *this;
171160
}
172161

173-
Array& operator=(Crt::ByteBuf&& other) noexcept
174-
{
175-
m_size = other.len;
176-
m_length = other.len;
177-
m_data.reset(other.buffer);
178-
179-
return *this;
180-
}
181-
182162
bool operator==(const Array& other) const
183163
{
184164
if (this == &other)
@@ -278,8 +258,6 @@ namespace Aws
278258
CryptoBuffer(CryptoBuffer&& other) : ByteBuffer(std::move(other)) {}
279259
CryptoBuffer& operator=(const CryptoBuffer&) = default;
280260
CryptoBuffer& operator=(CryptoBuffer&& other) { ByteBuffer::operator=(std::move(other)); return *this; }
281-
CryptoBuffer(Crt::ByteBuf&& other) noexcept : ByteBuffer(std::move(other)) {}
282-
CryptoBuffer& operator=(Crt::ByteBuf&& other) noexcept { ByteBuffer::operator=(std::move(other)); return *this; }
283261
bool operator==(const CryptoBuffer& other) const { return ByteBuffer::operator==(other); }
284262
bool operator!=(const CryptoBuffer& other) const { return ByteBuffer::operator!=(other); }
285263

src/aws-cpp-sdk-core/source/utils/crypto/crt/CRTSymmetricCipher.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ namespace Aws
3636

3737
if (m_cipher.Encrypt(toEncrypt, resultBuffer))
3838
{
39-
return resultBuffer;
39+
CryptoBuffer result{resultBuffer.buffer, resultBuffer.len};
40+
Crt::ByteBufDelete(resultBuffer);
41+
return result;
4042
}
43+
Crt::ByteBufDelete(resultBuffer);
4144
return {0};
4245
}
4346

@@ -49,8 +52,11 @@ namespace Aws
4952
{
5053
auto tagCur = m_cipher.GetTag();
5154
m_tag = CryptoBuffer(tagCur.ptr, tagCur.len);
52-
return resultBuffer;
55+
CryptoBuffer result{resultBuffer.buffer, resultBuffer.len};
56+
Crt::ByteBufDelete(resultBuffer);
57+
return result;
5358
}
59+
Crt::ByteBufDelete(resultBuffer);
5460
return {0};
5561
}
5662

@@ -63,8 +69,11 @@ namespace Aws
6369

6470
if (m_cipher.Decrypt(toDecrypt, resultBuffer))
6571
{
66-
return resultBuffer;
72+
CryptoBuffer result{resultBuffer.buffer, resultBuffer.len};
73+
Crt::ByteBufDelete(resultBuffer);
74+
return result;
6775
}
76+
Crt::ByteBufDelete(resultBuffer);
6877
return (0);
6978
}
7079

@@ -74,8 +83,11 @@ namespace Aws
7483

7584
if (m_cipher.FinalizeDecryption(resultBuffer))
7685
{
77-
return resultBuffer;
86+
CryptoBuffer result{resultBuffer.buffer, resultBuffer.len};
87+
Crt::ByteBufDelete(resultBuffer);
88+
return result;
7889
}
90+
Crt::ByteBufDelete(resultBuffer);
7991
return {0};
8092
}
8193

0 commit comments

Comments
 (0)