Commit d4794c6a authored by Paweł Wegner's avatar Paweł Wegner

MSVC fixes.

parent 15535d94
......@@ -48,7 +48,7 @@ void upload(Request<EitherError<void>>::Pointer r, int sent,
r->sendRequest(
[=](util::Output stream) {
std::vector<char> buffer(CHUNK_SIZE);
*length = callback->putData(buffer.begin().base(), CHUNK_SIZE);
*length = callback->putData(buffer.data(), CHUNK_SIZE);
auto request = r->provider()->http()->create(
response["uploadUrl"].asString(), "PUT");
std::stringstream content_range;
......
......@@ -87,6 +87,10 @@ class IRequest : public IGenericRequest {
public:
using Pointer = std::unique_ptr<IRequest>;
virtual void finish() = 0;
virtual void cancel() = 0;
/**
* Retrieves the result, blocks if it wasn't computed just yet.
* @return result
......@@ -191,6 +195,7 @@ struct Error {
template <class Left, class Right>
class Either {
public:
Either() {}
Either(const Left& left) : left_(std::make_shared<Left>(left)) {}
Either(const Right& right) : right_(std::make_shared<Right>(right)) {}
Either(std::shared_ptr<Left> left) : left_(left) {}
......@@ -207,6 +212,7 @@ class Either {
template <class Left>
class Either<Left, void> {
public:
Either() {}
Either(std::nullptr_t) {}
Either(const Left& left) : left_(std::make_shared<Left>(left)) {}
Either(std::shared_ptr<Left> left) : left_(left) {}
......
......@@ -33,7 +33,7 @@
namespace cloudstorage {
template <class T>
Request<T>::Wrapper::Wrapper(Request::Pointer r) : request_(r) {}
Request<T>::Wrapper::Wrapper(typename Request<T>::Pointer r) : request_(r) {}
template <class T>
Request<T>::Wrapper::~Wrapper() {
......
......@@ -53,7 +53,7 @@ class Request : public IRequest<ReturnValue>,
class Wrapper : public IRequest<ReturnValue> {
public:
Wrapper(Request::Pointer);
Wrapper(typename Request<ReturnValue>::Pointer);
~Wrapper();
void finish() override;
......@@ -61,7 +61,7 @@ class Request : public IRequest<ReturnValue>,
ReturnValue result() override;
private:
Request::Pointer request_;
typename Request<ReturnValue>::Pointer request_;
};
Request(std::shared_ptr<CloudProvider>);
......
......@@ -26,6 +26,7 @@
#include "Utility/Utility.h"
#include <algorithm>
#include <cctype>
#define SIZE(x) (sizeof(x) / sizeof(x[0]))
......
......@@ -28,6 +28,7 @@
#include <json/json.h>
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iomanip>
......@@ -322,7 +323,7 @@ IHttpServer::IResponse::Pointer response_from_string(
int putData(char* buffer, size_t max) override {
int cnt = std::min(data_.length() - position_, max);
memcpy(buffer, (data_.begin() + position_).base(), cnt);
memcpy(buffer, data_.data() + position_, cnt);
position_ += cnt;
return cnt;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment