diff --git a/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSFunction.h b/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSFunction.h index 9c266b85e86..2765d0a78b8 100644 --- a/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSFunction.h +++ b/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSFunction.h @@ -28,20 +28,22 @@ namespace Aws template std::function< F > BuildFunction(const F &f) { - return std::function< F >( f, Aws::Allocator() ); + return std::function< F >(std::allocator_arg_t(), Aws::Allocator(), f ); } // some things, like bind results, don't implicity convert to direct function types, catch those with specializations template std::function< F > BuildFunction(const std::function< F > &f) { - return std::function< F >( f, Aws::Allocator() ); + return std::function< F >(std::allocator_arg_t(), Aws::Allocator(), f); } template std::function< F > BuildFunction(std::function< F > &&f) { - return std::function< F >( std::move(f), Aws::Allocator() ); + // TODO: there seems to be no move c'tor that also takes an allocator, do a copy instead of a move ! + //return std::function< F >( std::move(f), Aws::Allocator() ); + return std::function< F >(std::allocator_arg_t(), Aws::Allocator(), f); } } // namespace Aws diff --git a/aws-cpp-sdk-core/source/external/json-cpp/jsoncpp.cpp b/aws-cpp-sdk-core/source/external/json-cpp/jsoncpp.cpp index c769b52a649..4b1a23bad07 100644 --- a/aws-cpp-sdk-core/source/external/json-cpp/jsoncpp.cpp +++ b/aws-cpp-sdk-core/source/external/json-cpp/jsoncpp.cpp @@ -2567,8 +2567,8 @@ bool Value::removeIndex(ArrayIndex index, Value* removed) { ArrayIndex oldSize = size(); // shift left all items left, into the place of the "removed" for (ArrayIndex i = index; i < (oldSize - 1); ++i){ - CZString key(i); - (*value_.map_)[key] = (*this)[i + 1]; + CZString currentKey(i); + (*value_.map_)[currentKey] = (*this)[i + 1]; } // erase the last one ("leftover") CZString keyLast(oldSize - 1); diff --git a/aws-cpp-sdk-core/source/http/URI.cpp b/aws-cpp-sdk-core/source/http/URI.cpp index 983395b1167..328a46e9b9a 100644 --- a/aws-cpp-sdk-core/source/http/URI.cpp +++ b/aws-cpp-sdk-core/source/http/URI.cpp @@ -142,32 +142,32 @@ Aws::String URI::GetUnEncodedPath() const QueryStringParameterCollection URI::GetQueryStringParameters(bool decode) const { - Aws::String queryString = GetQueryString(); + Aws::String localQueryString = GetQueryString(); QueryStringParameterCollection parameterCollection; //if we actually have a query string - if (queryString.size() > 0) + if (localQueryString.size() > 0) { size_t currentPos = 1, locationOfNextDelimiter = 1; //while we have params left to parse - while (currentPos < queryString.size()) + while (currentPos < localQueryString.size()) { //find next key/value pair - locationOfNextDelimiter = queryString.find('&', currentPos); + locationOfNextDelimiter = localQueryString.find('&', currentPos); Aws::String keyValuePair; //if this isn't the last parameter if (locationOfNextDelimiter != Aws::String::npos) { - keyValuePair = queryString.substr(currentPos, locationOfNextDelimiter - currentPos); + keyValuePair = localQueryString.substr(currentPos, locationOfNextDelimiter - currentPos); } //if it is the last parameter else { - keyValuePair = queryString.substr(currentPos); + keyValuePair = localQueryString.substr(currentPos); } //split on = diff --git a/aws-cpp-sdk-identity-management-tests/auth/PersistentCognitoIdentityProvider_JsonFileImplTest.cpp b/aws-cpp-sdk-identity-management-tests/auth/PersistentCognitoIdentityProvider_JsonFileImplTest.cpp index ecd7e9158a4..e7fe1383672 100644 --- a/aws-cpp-sdk-identity-management-tests/auth/PersistentCognitoIdentityProvider_JsonFileImplTest.cpp +++ b/aws-cpp-sdk-identity-management-tests/auth/PersistentCognitoIdentityProvider_JsonFileImplTest.cpp @@ -42,14 +42,26 @@ using namespace Aws::Utils::Json; Aws::String ComputeIdentityFilePath() { static bool s_initialized = false; - static char s_tempName[L_tmpnam+1]; + static Aws::String s_tempName; - if(!s_initialized) + if(s_tempName.empty()) { - s_tempName[0] = '.'; - tmpnam_s(s_tempName + 1, L_tmpnam); - s_initialized = true; - } + char tempName[L_tmpnam_s]; + memset(tempName, 0x00, L_tmpnam_s); + + tmpnam_s(tempName, L_tmpnam_s); + + // tmpnam_s() may return a file name that starts with a \ or an absolut path ... + if ((strlen(tempName) > 0) && (tempName[0] == '\\')) + { + s_tempName = '.'; + s_tempName += tempName; + } + else + { + s_tempName = tempName; + } + } return Aws::String(s_tempName); } diff --git a/aws-cpp-sdk-transfer-tests/TransferTests.cpp b/aws-cpp-sdk-transfer-tests/TransferTests.cpp index dcf1a785a09..4ff585e3974 100644 --- a/aws-cpp-sdk-transfer-tests/TransferTests.cpp +++ b/aws-cpp-sdk-transfer-tests/TransferTests.cpp @@ -104,7 +104,7 @@ class TransferTests : public ::testing::Test Aws::OFStream testFile; testFile.open(fileName.c_str()); auto putStringLength = putString.length(); - for (unsigned i = putStringLength; i <= fileSize; i += putStringLength) + for (auto i = putStringLength; i <= fileSize; i += putStringLength) { testFile << putString; }