1
0
Fork 0

MSVC fixes

This commit is contained in:
Frank Celler 2016-03-31 14:01:23 +02:00
parent dfec0bb73d
commit 295c8a3809
26 changed files with 48 additions and 45 deletions

View File

@ -67,7 +67,7 @@ HttpHandler::status_t RestActionHandler::execute() {
case GeneralRequest::RequestType::GET:
case GeneralRequest::RequestType::POST:
case GeneralRequest::RequestType::PUT:
case GeneralRequest::RequestType::DELETE:
case GeneralRequest::RequestType::DELETE_REQ:
case GeneralRequest::RequestType::HEAD:
case GeneralRequest::RequestType::OPTIONS:
case GeneralRequest::RequestType::PATCH: {

View File

@ -589,7 +589,7 @@ arangodb::rest::HttpHandler::status_t RestAqlHandler::execute() {
}
break;
}
case GeneralRequest::RequestType::DELETE:
case GeneralRequest::RequestType::DELETE_REQ:
case GeneralRequest::RequestType::HEAD:
case GeneralRequest::RequestType::PATCH:
case GeneralRequest::RequestType::OPTIONS:

View File

@ -1246,7 +1246,7 @@ AgencyCommResult AgencyComm::removeValues(std::string const& key,
AgencyCommResult result;
sendWithFailover(arangodb::GeneralRequest::RequestType::DELETE,
sendWithFailover(arangodb::GeneralRequest::RequestType::DELETE_REQ,
_globalConnectionOptions._requestTimeout, result, url, "",
false);
@ -1823,7 +1823,7 @@ bool AgencyComm::send(arangodb::httpclient::GeneralClientConnection* connection,
if (method == arangodb::GeneralRequest::RequestType::GET ||
method == arangodb::GeneralRequest::RequestType::HEAD ||
method == arangodb::GeneralRequest::RequestType::DELETE) {
method == arangodb::GeneralRequest::RequestType::DELETE_REQ) {
TRI_ASSERT(body.empty());
}

View File

@ -705,7 +705,7 @@ int deleteDocumentOnCoordinator(
// Send a synchronous request to that shard using ClusterComm:
auto res = cc->syncRequest(
"", TRI_NewTickServer(), "shard:" + shardID,
arangodb::GeneralRequest::RequestType::DELETE,
arangodb::GeneralRequest::RequestType::DELETE_REQ,
"/_db/" + dbname + "/_api/document/" + StringUtils::urlEncode(shardID) +
"/" + StringUtils::urlEncode(key) + "?waitForSync=" +
(waitForSync ? "true" : "false") + revstr + policystr,
@ -731,7 +731,7 @@ int deleteDocumentOnCoordinator(
std::unique_ptr<std::map<std::string, std::string>> headersCopy(
new std::map<std::string, std::string>(*headers));
cc->asyncRequest("", coordTransactionID, "shard:" + p.first,
arangodb::GeneralRequest::RequestType::DELETE,
arangodb::GeneralRequest::RequestType::DELETE_REQ,
"/_db/" + StringUtils::urlEncode(dbname) +
"/_api/document/" + StringUtils::urlEncode(p.first) +
"/" + StringUtils::urlEncode(key) + "?waitForSync=" +

View File

@ -289,7 +289,7 @@ bool HttpCommTask::processRead() {
// handle different HTTP methods
switch (_requestType) {
case GeneralRequest::RequestType::GET:
case GeneralRequest::RequestType::DELETE:
case GeneralRequest::RequestType::DELETE_REQ:
case GeneralRequest::RequestType::HEAD:
case GeneralRequest::RequestType::OPTIONS:
case GeneralRequest::RequestType::POST:
@ -302,7 +302,7 @@ bool HttpCommTask::processRead() {
_requestType == GeneralRequest::RequestType::PUT ||
_requestType == GeneralRequest::RequestType::PATCH ||
_requestType == GeneralRequest::RequestType::OPTIONS ||
_requestType == GeneralRequest::RequestType::DELETE);
_requestType == GeneralRequest::RequestType::DELETE_REQ);
if (!checkContentLength(expectContentLength)) {
return false;

View File

@ -422,7 +422,7 @@ int InitialSyncer::sendFinishBatch() {
setProgress(progress);
std::unique_ptr<SimpleHttpResult> response(_client->retryRequest(
GeneralRequest::RequestType::DELETE, url, nullptr, 0));
GeneralRequest::RequestType::DELETE_REQ, url, nullptr, 0));
if (response == nullptr || !response->isComplete()) {
return TRI_ERROR_REPLICATION_NO_RESPONSE;
@ -953,7 +953,7 @@ int InitialSyncer::handleCollectionSync(
// now delete the keys we ordered
std::unique_ptr<SimpleHttpResult> response(_client->retryRequest(
GeneralRequest::RequestType::DELETE, url, nullptr, 0));
GeneralRequest::RequestType::DELETE_REQ, url, nullptr, 0));
};
TRI_DEFER(shutdown());

View File

@ -271,7 +271,7 @@ int Syncer::sendRemoveBarrier() {
// send request
std::unique_ptr<SimpleHttpResult> response(_client->retryRequest(
GeneralRequest::RequestType::DELETE, url, nullptr, 0));
GeneralRequest::RequestType::DELETE_REQ, url, nullptr, 0));
if (response == nullptr || !response->isComplete()) {
return TRI_ERROR_REPLICATION_NO_RESPONSE;

View File

@ -65,7 +65,7 @@ HttpHandler::status_t RestCursorHandler::execute() {
return status_t(HANDLER_DONE);
}
if (type == GeneralRequest::RequestType::DELETE) {
if (type == GeneralRequest::RequestType::DELETE_REQ) {
deleteCursor();
return status_t(HANDLER_DONE);
}

View File

@ -56,7 +56,7 @@ HttpHandler::status_t RestDebugHandler::execute() {
// execute one of the CRUD methods
switch (type) {
case GeneralRequest::RequestType::DELETE:
case GeneralRequest::RequestType::DELETE_REQ:
if (len == 1) {
TRI_ClearFailurePointsDebugging();
} else {

View File

@ -48,7 +48,7 @@ HttpHandler::status_t RestDocumentHandler::execute() {
// execute one of the CRUD methods
switch (type) {
case GeneralRequest::RequestType::DELETE:
case GeneralRequest::RequestType::DELETE_REQ:
deleteDocument();
break;
case GeneralRequest::RequestType::GET:

View File

@ -64,7 +64,7 @@ HttpHandler::status_t RestExportHandler::execute() {
return status_t(HANDLER_DONE);
}
if (type == GeneralRequest::RequestType::DELETE) {
if (type == GeneralRequest::RequestType::DELETE_REQ) {
deleteCursor();
return status_t(HANDLER_DONE);
}

View File

@ -60,7 +60,7 @@ HttpHandler::status_t RestJobHandler::execute() {
} else {
generateError(HttpResponse::BAD, TRI_ERROR_HTTP_BAD_PARAMETER);
}
} else if (type == GeneralRequest::RequestType::DELETE) {
} else if (type == GeneralRequest::RequestType::DELETE_REQ) {
deleteJob();
} else {
generateError(HttpResponse::METHOD_NOT_ALLOWED,

View File

@ -40,7 +40,7 @@ HttpHandler::status_t RestQueryCacheHandler::execute() {
auto const type = _request->requestType();
switch (type) {
case GeneralRequest::RequestType::DELETE:
case GeneralRequest::RequestType::DELETE_REQ:
clearCache();
break;
case GeneralRequest::RequestType::GET:

View File

@ -59,7 +59,7 @@ HttpHandler::status_t RestQueryHandler::execute() {
// execute one of the CRUD methods
try {
switch (type) {
case GeneralRequest::RequestType::DELETE:
case GeneralRequest::RequestType::DELETE_REQ:
deleteQuery();
break;
case GeneralRequest::RequestType::GET:

View File

@ -135,7 +135,7 @@ HttpHandler::status_t RestReplicationHandler::execute() {
if (type != GeneralRequest::RequestType::GET &&
type != GeneralRequest::RequestType::POST &&
type != GeneralRequest::RequestType::PUT &&
type != GeneralRequest::RequestType::DELETE) {
type != GeneralRequest::RequestType::DELETE_REQ) {
goto BAD_CALL;
}
@ -149,7 +149,7 @@ HttpHandler::status_t RestReplicationHandler::execute() {
handleCommandGetKeys();
} else if (type == GeneralRequest::RequestType::PUT) {
handleCommandFetchKeys();
} else if (type == GeneralRequest::RequestType::DELETE) {
} else if (type == GeneralRequest::RequestType::DELETE_REQ) {
handleCommandRemoveKeys();
}
} else if (command == "dump") {
@ -239,7 +239,7 @@ HttpHandler::status_t RestReplicationHandler::execute() {
handleCommandApplierStop();
} else if (command == "applier-state") {
if (type == GeneralRequest::RequestType::DELETE) {
if (type == GeneralRequest::RequestType::DELETE_REQ) {
handleCommandApplierDeleteState();
} else {
if (type != GeneralRequest::RequestType::GET) {
@ -592,7 +592,7 @@ void RestReplicationHandler::handleCommandBatch() {
return;
}
if (type == GeneralRequest::RequestType::DELETE && len >= 2) {
if (type == GeneralRequest::RequestType::DELETE_REQ && len >= 2) {
// delete an existing blocker
TRI_voc_tick_t id = (TRI_voc_tick_t)StringUtils::uint64(suffix[1]);
@ -706,7 +706,7 @@ void RestReplicationHandler::handleCommandBarrier() {
return;
}
if (type == GeneralRequest::RequestType::DELETE && len >= 2) {
if (type == GeneralRequest::RequestType::DELETE_REQ && len >= 2) {
// delete an existing barrier
TRI_voc_tick_t id = StringUtils::uint64(suffix[1]);

View File

@ -56,7 +56,7 @@ HttpHandler::status_t WorkMonitorHandler::execute() {
return status_t(HANDLER_ASYNC);
}
if (type == GeneralRequest::RequestType::DELETE) {
if (type == GeneralRequest::RequestType::DELETE_REQ) {
if (len != 1) {
generateError(HttpResponse::BAD, TRI_ERROR_HTTP_BAD_PARAMETER,
"expecting DELETE /_admin/work-monitor/<id>");

View File

@ -194,7 +194,7 @@ bool ListenTask::handleEvent(EventToken token, EventType revents) {
// set client address and port
ConnectionInfo info;
Endpoint::DomainType type = _endpoint->getDomainType();
Endpoint::DomainType type = _endpoint->domainType();
char host[NI_MAXHOST], serv[NI_MAXSERV];
if (getnameinfo((sockaddr*)addr, len, host, sizeof(host), serv,
@ -257,7 +257,7 @@ bool ListenTask::handleEvent(EventToken token, EventType revents) {
// set the endpoint
info.endpoint = _endpoint->specification();
info.endpointType = _endpoint->getDomainType();
info.endpointType = _endpoint->domainType();
return handleConnected(connectionSocket, info);
}

View File

@ -439,7 +439,7 @@ static v8::Handle<v8::Object> RequestCppToV8(v8::Isolate* isolate,
req->ForceSet(RequestTypeKey, OptionsConstant);
break;
}
case GeneralRequest::RequestType::DELETE: {
case GeneralRequest::RequestType::DELETE_REQ: {
TRI_GET_GLOBAL_STRING(DeleteConstant);
req->ForceSet(RequestTypeKey, DeleteConstant);
break;

View File

@ -213,7 +213,7 @@ static void JS_HttpStatistics(v8::FunctionCallbackInfo<v8::Value> const& args) {
TRI_V8_ASCII_STRING("requestsDelete"),
v8::Number::New(
isolate,
(double)methodRequests[(int)GeneralRequest::RequestType::DELETE]
(double)methodRequests[(int)GeneralRequest::RequestType::DELETE_REQ]
._count));
result->Set(
TRI_V8_ASCII_STRING("requestsOptions"),

View File

@ -274,7 +274,7 @@ struct ShapesTest : public BenchmarkOperation {
} else if (mod == 1) {
return GeneralRequest::RequestType::GET;
} else {
return GeneralRequest::RequestType::DELETE;
return GeneralRequest::RequestType::DELETE_REQ;
}
}
@ -446,7 +446,7 @@ struct RandomShapesTest : public BenchmarkOperation {
} else if (mod == 1) {
return GeneralRequest::RequestType::GET;
} else {
return GeneralRequest::RequestType::DELETE;
return GeneralRequest::RequestType::DELETE_REQ;
}
}
@ -541,7 +541,7 @@ struct DocumentCrudTest : public BenchmarkOperation {
} else if (mod == 3) {
return GeneralRequest::RequestType::GET;
} else if (mod == 4) {
return GeneralRequest::RequestType::DELETE;
return GeneralRequest::RequestType::DELETE_REQ;
} else {
TRI_ASSERT(false);
return GeneralRequest::RequestType::GET;
@ -640,7 +640,7 @@ struct EdgeCrudTest : public BenchmarkOperation {
}
/*
else if (mod == 4) {
return GeneralRequest::RequestType::DELETE;
return GeneralRequest::RequestType::DELETE_REQ;
}
*/
else {
@ -1522,7 +1522,7 @@ static bool DeleteCollection(SimpleHttpClient* client,
std::map<std::string, std::string> headerFields;
SimpleHttpResult* result = nullptr;
result = client->request(GeneralRequest::RequestType::DELETE,
result = client->request(GeneralRequest::RequestType::DELETE_REQ,
"/_api/collection/" + name, "", 0, headerFields);
bool failed = true;

View File

@ -285,7 +285,7 @@ void DumpFeature::endBatch(std::string DBserver) {
_batchId = 0;
std::unique_ptr<SimpleHttpResult> response(_httpClient->request(
GeneralRequest::RequestType::DELETE, url + urlExt, nullptr, 0));
GeneralRequest::RequestType::DELETE_REQ, url + urlExt, nullptr, 0));
// ignore any return value
}

View File

@ -1267,10 +1267,10 @@ v8::Handle<v8::Value> V8ClientConnection::deleteData(
v8::Isolate* isolate, std::string const& location,
std::map<std::string, std::string> const& headerFields, bool raw) {
if (raw) {
return requestDataRaw(isolate, GeneralRequest::RequestType::DELETE, location,
return requestDataRaw(isolate, GeneralRequest::RequestType::DELETE_REQ, location,
"", headerFields);
}
return requestData(isolate, GeneralRequest::RequestType::DELETE, location, "",
return requestData(isolate, GeneralRequest::RequestType::DELETE_REQ, location, "",
headerFields);
}

View File

@ -71,7 +71,7 @@ class Endpoint {
virtual bool setTimeout(TRI_socket_t, double);
virtual bool isConnected() const { return _connected; }
virtual bool setSocketFlags(TRI_socket_t);
virtual DomainType getDomainType() const { return _domainType; }
virtual DomainType domainType() const { return _domainType; }
virtual int domain() const = 0;
virtual int port() const = 0;

View File

@ -32,8 +32,6 @@
using namespace arangodb;
using namespace arangodb::basics;
#warning TODO move to system or os file
#ifdef _WIN32
#define STR_ERROR() \
windowsErrorBuf; \
@ -41,6 +39,7 @@ using namespace arangodb::basics;
windowsErrorBuf, sizeof(windowsErrorBuf), NULL); \
errno = GetLastError();
#else
#warning TODO move to system or os file
#define STR_ERROR() strerror(errno)
#endif
@ -101,7 +100,7 @@ EndpointIp::EndpointIp(DomainType domainType, EndpointType type,
_host(host),
_port(port),
_reuseAddress(reuseAddress) {
TRI_ASSERT(domainType == DOMAIN_IPV4 || domainType == Endpoint::DOMAIN_IPV6);
TRI_ASSERT(domainType == DomainType::IPV4 || domainType == DomainType::IPV6);
}
////////////////////////////////////////////////////////////////////////////////
@ -274,7 +273,7 @@ TRI_socket_t EndpointIp::connect(double connectTimeout, double requestTimeout) {
TRI_ASSERT(!_connected);
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = getDomain(); // Allow IPv4 or IPv6
hints.ai_family = domain(); // Allow IPv4 or IPv6
hints.ai_flags = TRI_CONNECT_AI_FLAGS;
hints.ai_socktype = SOCK_STREAM;

View File

@ -48,11 +48,13 @@ std::string GeneralRequest::translateVersion(ProtocolVersion version) {
case ProtocolVersion::UNKNOWN:
return "HTTP/1.0";
}
return "UNKNOWN"; // in order please MSVC
}
std::string GeneralRequest::translateMethod(RequestType method) {
switch (method) {
case RequestType::DELETE:
case RequestType::DELETE_REQ:
return "DELETE";
case RequestType::GET:
@ -86,6 +88,8 @@ std::string GeneralRequest::translateMethod(RequestType method) {
LOG(WARN) << "illegal http request method encountered in switch";
return "UNKNOWN";
}
return "UNKNOWN"; // in order please MSVC
}
GeneralRequest::RequestType GeneralRequest::translateMethod(
@ -93,7 +97,7 @@ GeneralRequest::RequestType GeneralRequest::translateMethod(
std::string const methodString = StringUtils::toupper(method);
if (methodString == "DELETE") {
return RequestType::DELETE;
return RequestType::DELETE_REQ;
} else if (methodString == "GET") {
return RequestType::GET;
} else if (methodString == "HEAD") {
@ -153,7 +157,7 @@ GeneralRequest::RequestType GeneralRequest::findRequestType(char const* ptr,
case 6:
if (ptr[0] == 'd' && ptr[1] == 'e' && ptr[2] == 'l' && ptr[3] == 'e' &&
ptr[4] == 't' && ptr[5] == 'e') {
return RequestType::DELETE;
return RequestType::DELETE_REQ;
}
break;

View File

@ -52,7 +52,7 @@ class GeneralRequest {
// VSTREAM_STATUS: Returns STATUS code and message for a given
// request
enum class RequestType {
DELETE = 0,
DELETE_REQ = 0, // windows redefines DELETE
GET,
HEAD,
OPTIONS,