aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
diff options
context:
space:
mode:
authornalpp <nalpp@yandex-team.ru>2022-02-10 16:46:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:46 +0300
commit30d1ef3941e0dc835be7609de5ebee66958f215a (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
parent87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb (diff)
downloadydb-30d1ef3941e0dc835be7609de5ebee66958f215a.tar.gz
Restoring authorship annotation for <nalpp@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp')
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp122
1 files changed, 61 insertions, 61 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
index 39247ce3b1..43e7863421 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
@@ -2,64 +2,64 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
-
-#include <aws/core/utils/Array.h>
-
-#include <aws/core/platform/Security.h>
-
-namespace Aws
-{
- namespace Utils
- {
- Array<CryptoBuffer> CryptoBuffer::Slice(size_t sizeOfSlice) const
- {
- assert(sizeOfSlice <= GetLength());
-
- size_t numberOfSlices = (GetLength() + sizeOfSlice - 1) / sizeOfSlice;
- size_t currentSliceIndex = 0;
- Array<CryptoBuffer> slices(numberOfSlices);
-
- for (size_t i = 0; i < numberOfSlices - 1; ++i)
- {
- CryptoBuffer newArray(sizeOfSlice);
- for (size_t cpyIdx = 0; cpyIdx < newArray.GetLength(); ++cpyIdx)
- {
- newArray[cpyIdx] = GetItem(cpyIdx + currentSliceIndex);
- }
- currentSliceIndex += sizeOfSlice;
- slices[i] = std::move(newArray);
- }
-
- CryptoBuffer lastArray(GetLength() % sizeOfSlice == 0 ? sizeOfSlice : GetLength() % sizeOfSlice );
- for (size_t cpyIdx = 0; cpyIdx < lastArray.GetLength(); ++cpyIdx)
- {
- lastArray[cpyIdx] = GetItem(cpyIdx + currentSliceIndex);
- }
- slices[slices.GetLength() - 1] = std::move(lastArray);
-
- return slices;
- }
-
- CryptoBuffer& CryptoBuffer::operator^(const CryptoBuffer& operand)
- {
- size_t smallestSize = std::min<size_t>(GetLength(), operand.GetLength());
- for (size_t i = 0; i < smallestSize; ++i)
- {
- (*this)[i] ^= operand[i];
- }
-
- return *this;
- }
-
- /**
- * Zero out the array securely
- */
- void CryptoBuffer::Zero()
- {
- if (GetUnderlyingData())
- {
- Aws::Security::SecureMemClear(GetUnderlyingData(), GetLength());
- }
- }
- }
-} \ No newline at end of file
+
+#include <aws/core/utils/Array.h>
+
+#include <aws/core/platform/Security.h>
+
+namespace Aws
+{
+ namespace Utils
+ {
+ Array<CryptoBuffer> CryptoBuffer::Slice(size_t sizeOfSlice) const
+ {
+ assert(sizeOfSlice <= GetLength());
+
+ size_t numberOfSlices = (GetLength() + sizeOfSlice - 1) / sizeOfSlice;
+ size_t currentSliceIndex = 0;
+ Array<CryptoBuffer> slices(numberOfSlices);
+
+ for (size_t i = 0; i < numberOfSlices - 1; ++i)
+ {
+ CryptoBuffer newArray(sizeOfSlice);
+ for (size_t cpyIdx = 0; cpyIdx < newArray.GetLength(); ++cpyIdx)
+ {
+ newArray[cpyIdx] = GetItem(cpyIdx + currentSliceIndex);
+ }
+ currentSliceIndex += sizeOfSlice;
+ slices[i] = std::move(newArray);
+ }
+
+ CryptoBuffer lastArray(GetLength() % sizeOfSlice == 0 ? sizeOfSlice : GetLength() % sizeOfSlice );
+ for (size_t cpyIdx = 0; cpyIdx < lastArray.GetLength(); ++cpyIdx)
+ {
+ lastArray[cpyIdx] = GetItem(cpyIdx + currentSliceIndex);
+ }
+ slices[slices.GetLength() - 1] = std::move(lastArray);
+
+ return slices;
+ }
+
+ CryptoBuffer& CryptoBuffer::operator^(const CryptoBuffer& operand)
+ {
+ size_t smallestSize = std::min<size_t>(GetLength(), operand.GetLength());
+ for (size_t i = 0; i < smallestSize; ++i)
+ {
+ (*this)[i] ^= operand[i];
+ }
+
+ return *this;
+ }
+
+ /**
+ * Zero out the array securely
+ */
+ void CryptoBuffer::Zero()
+ {
+ if (GetUnderlyingData())
+ {
+ Aws::Security::SecureMemClear(GetUnderlyingData(), GetLength());
+ }
+ }
+ }
+} \ No newline at end of file