Skip to content

Fixed build errors and failed unit tests with MSVC 2015 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ namespace Aws
template<typename F>
std::function< F > BuildFunction(const F &f)
{
return std::function< F >( f, Aws::Allocator<void>() );
return std::function< F >(std::allocator_arg_t(), Aws::Allocator<void>(), f );
}

// some things, like bind results, don't implicity convert to direct function types, catch those with specializations
template<typename F>
std::function< F > BuildFunction(const std::function< F > &f)
{
return std::function< F >( f, Aws::Allocator<void>() );
return std::function< F >(std::allocator_arg_t(), Aws::Allocator<void>(), f);
}

template<typename F>
std::function< F > BuildFunction(std::function< F > &&f)
{
return std::function< F >( std::move(f), Aws::Allocator<void>() );
// 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<void>() );
return std::function< F >(std::allocator_arg_t(), Aws::Allocator<void>(), f);
}

} // namespace Aws
Expand Down
4 changes: 2 additions & 2 deletions aws-cpp-sdk-core/source/external/json-cpp/jsoncpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions aws-cpp-sdk-core/source/http/URI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion aws-cpp-sdk-transfer-tests/TransferTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down