mirror of https://gitee.com/bigwinds/arangodb
micro optimizations (#6162)
This commit is contained in:
parent
ed9d901846
commit
d6a3b66e2a
|
@ -58,97 +58,97 @@ static constexpr bool isLittleEndian() {return false;}
|
|||
#pragma messsage("unsupported os or compiler")
|
||||
#endif
|
||||
|
||||
template<typename T> inline void ByteSwap (T& t) {
|
||||
template<typename T> inline void ByteSwap(T& t) {
|
||||
uint8_t* ptr = (uint8_t*)(&t);
|
||||
size_t bytes = sizeof(T);
|
||||
for(size_t i = 0; i < bytes/2; i ++ ) {
|
||||
for(size_t i = 0; i < bytes / 2; i ++ ) {
|
||||
uint8_t swap = ptr[i];
|
||||
ptr[i] = ptr[bytes-i-1];
|
||||
ptr[bytes-i-1] = swap;
|
||||
ptr[i] = ptr[bytes - i - 1];
|
||||
ptr[bytes - i - 1] = swap;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, size_t size> struct EndianTraits;
|
||||
|
||||
template<typename T> struct EndianTraits<T,2> {
|
||||
template<typename T> struct EndianTraits<T, 2> {
|
||||
typedef typename std::make_unsigned<T>::type type;
|
||||
inline static type htole (type in) {
|
||||
inline static type htole(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToLittleInt16(in);
|
||||
#elif __linux__
|
||||
return htole16(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type letoh (type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapLittleToHostInt16(in);
|
||||
#elif __linux__
|
||||
return le16toh(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type htobe (type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToBigInt16(in);
|
||||
#elif __linux__
|
||||
return htobe16(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()){
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type betoh (type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapBigToHostInt16(in);
|
||||
#elif __linux__
|
||||
return be16toh(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct EndianTraits<T,4> {
|
||||
typedef typename std::make_unsigned<T>::type type;
|
||||
inline static type htole (type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToLittleInt32(in);
|
||||
#elif __linux__
|
||||
return htole32(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type letoh (type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapLittleToHostInt32(in);
|
||||
#elif __linux__
|
||||
return le32toh(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type htobe (type in) {
|
||||
inline static type letoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapLittleToHostInt16(in);
|
||||
#elif __linux__
|
||||
return le16toh(in);
|
||||
#elif _WIN32
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type htobe(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToBigInt16(in);
|
||||
#elif __linux__
|
||||
return htobe16(in);
|
||||
#elif _WIN32
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type betoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapBigToHostInt16(in);
|
||||
#elif __linux__
|
||||
return be16toh(in);
|
||||
#elif _WIN32
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct EndianTraits<T, 4> {
|
||||
typedef typename std::make_unsigned<T>::type type;
|
||||
inline static type htole(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToLittleInt32(in);
|
||||
#elif __linux__
|
||||
return htole32(in);
|
||||
#elif _WIN32
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type letoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapLittleToHostInt32(in);
|
||||
#elif __linux__
|
||||
return le32toh(in);
|
||||
#elif _WIN32
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type htobe(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToBigInt32(in);
|
||||
#elif __linux__
|
||||
|
@ -160,55 +160,55 @@ template<typename T> struct EndianTraits<T,4> {
|
|||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type betoh (type in) {
|
||||
inline static type betoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapBigToHostInt32(in);
|
||||
#elif __linux__
|
||||
return be32toh(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct EndianTraits<T,8> {
|
||||
template<typename T> struct EndianTraits<T, 8> {
|
||||
typedef typename std::make_unsigned<T>::type type;
|
||||
inline static type htole (type in) {
|
||||
inline static type htole(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToLittleInt64(in);
|
||||
#elif __linux__
|
||||
return htole64(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type letoh (type in) {
|
||||
inline static type letoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapLittleToHostInt64(in);
|
||||
#elif __linux__
|
||||
return le64toh(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type htobe (type in) {
|
||||
inline static type htobe(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToBigInt64(in);
|
||||
#elif __linux__
|
||||
return htobe64(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()){
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class CallOnceRequestCallback {
|
|||
CallOnceRequestCallback() : _invoked(), _cb(nullptr) {
|
||||
_invoked.clear();
|
||||
}
|
||||
CallOnceRequestCallback(RequestCallback cb)
|
||||
explicit CallOnceRequestCallback(RequestCallback cb)
|
||||
: _invoked(), _cb(std::move(cb)) {
|
||||
_invoked.clear();
|
||||
}
|
||||
|
|
|
@ -148,7 +148,6 @@ ConnectionBuilder& ConnectionBuilder::endpoint(std::string const& host) {
|
|||
}
|
||||
|
||||
// put hostname, port and path in seperate strings
|
||||
std::string server;
|
||||
if (!(parsed.field_set & (1 << UF_HOST))) {
|
||||
throw std::runtime_error(std::string("invalid host: ") + host);
|
||||
}
|
||||
|
|
|
@ -592,6 +592,8 @@ std::unique_ptr<Response> HttpConnection<ST>::sendRequestSync(std::unique_ptr<Re
|
|||
shutdownConnection(ErrorCondition::ProtocolError); // will cleanup _inFlight
|
||||
throw ErrorCondition::ProtocolError;
|
||||
}
|
||||
|
||||
// item.message_complete may have been set by the call to http_parser_execute!
|
||||
if (item.message_complete) {
|
||||
//_timeout.cancel(); // got response in time
|
||||
// Remove consumed data from receive buffer.
|
||||
|
|
|
@ -419,7 +419,8 @@ void RestHandler::executeEngine(bool isContinue) {
|
|||
<< DIAGNOSTIC_INFORMATION(ex);
|
||||
#endif
|
||||
RequestStatistics::SET_EXECUTE_ERROR(_statistics);
|
||||
Exception err(TRI_ERROR_INTERNAL, std::string("VPack error: ") + ex.what(),
|
||||
bool const isParseError = (ex.errorCode() == arangodb::velocypack::Exception::ParseError);
|
||||
Exception err(isParseError ? TRI_ERROR_HTTP_CORRUPTED_JSON : TRI_ERROR_INTERNAL, std::string("VPack error: ") + ex.what(),
|
||||
__FILE__, __LINE__);
|
||||
handleError(err);
|
||||
} catch (std::bad_alloc const& ex) {
|
||||
|
|
|
@ -427,7 +427,7 @@ bool Scheduler::canPostDirectly() const noexcept {
|
|||
bool Scheduler::pushToFifo(int64_t fifo, std::function<void()> const& callback,
|
||||
bool isV8) {
|
||||
TRI_ASSERT(0 <= fifo && fifo < NUMBER_FIFOS);
|
||||
TRI_ASSERT(fifo != FIFO8 || (fifo == FIFO8 && isV8));
|
||||
TRI_ASSERT(fifo != FIFO8 || isV8);
|
||||
|
||||
size_t p = static_cast<size_t>(fifo);
|
||||
auto job = std::make_unique<FifoJob>(callback, isV8);
|
||||
|
|
|
@ -1381,7 +1381,7 @@ v8::Local<v8::Value> V8ClientConnection::requestData(
|
|||
if (req->header.contentType() == fuerte::ContentType::Unset) {
|
||||
req->header.contentType(fuerte::ContentType::Json);
|
||||
}
|
||||
} else if (!body->IsUndefined() && !body->IsNull()) {
|
||||
} else if (!body->IsNullOrUndefined()) {
|
||||
VPackBuffer<uint8_t> buffer;
|
||||
VPackBuilder builder(buffer, &_vpackOptions);
|
||||
int res = TRI_V8ToVPack(isolate, builder, body, false);
|
||||
|
@ -1391,6 +1391,11 @@ v8::Local<v8::Value> V8ClientConnection::requestData(
|
|||
}
|
||||
req->addVPack(std::move(buffer));
|
||||
req->header.contentType(fuerte::ContentType::VPack);
|
||||
} else {
|
||||
// body is null or undefined
|
||||
if (req->header.contentType() == fuerte::ContentType::Unset) {
|
||||
req->header.contentType(fuerte::ContentType::Json);
|
||||
}
|
||||
}
|
||||
if (req->header.acceptType() == fuerte::ContentType::Unset) {
|
||||
req->header.acceptType(fuerte::ContentType::VPack);
|
||||
|
@ -1428,7 +1433,7 @@ v8::Local<v8::Value> V8ClientConnection::requestDataRaw(
|
|||
if (req->header.contentType() == fuerte::ContentType::Unset) {
|
||||
req->header.contentType(fuerte::ContentType::Json);
|
||||
}
|
||||
} else if (!body->IsUndefined() && !body->IsNull()) {
|
||||
} else if (!body->IsNullOrUndefined()) {
|
||||
VPackBuffer<uint8_t> buffer;
|
||||
VPackBuilder builder(buffer);
|
||||
int res = TRI_V8ToVPack(isolate, builder, body, false);
|
||||
|
@ -1438,6 +1443,11 @@ v8::Local<v8::Value> V8ClientConnection::requestDataRaw(
|
|||
}
|
||||
req->addVPack(std::move(buffer));
|
||||
req->header.contentType(fuerte::ContentType::VPack);
|
||||
} else {
|
||||
// body is null or undefined
|
||||
if (req->header.contentType() == fuerte::ContentType::Unset) {
|
||||
req->header.contentType(fuerte::ContentType::Json);
|
||||
}
|
||||
}
|
||||
if (req->header.acceptType() == fuerte::ContentType::Unset) {
|
||||
req->header.acceptType(fuerte::ContentType::VPack);
|
||||
|
|
|
@ -991,7 +991,7 @@ ArangoDatabase.prototype._parse = function (query) {
|
|||
if (typeof query === 'object' && typeof query.toAQL === 'function') {
|
||||
query = { query: query.toAQL() };
|
||||
} else {
|
||||
query = { query: query };
|
||||
query = { query };
|
||||
}
|
||||
|
||||
const requestResult = this._connection.POST('/_api/query', query);
|
||||
|
|
|
@ -34,7 +34,7 @@ const _ = require('lodash');
|
|||
|
||||
const db = internal.db;
|
||||
|
||||
const GRAPH_PREFIX = '_api/gharial/';
|
||||
const GRAPH_PREFIX = '/_api/gharial/';
|
||||
|
||||
// remove me later
|
||||
exports._exists = ggc._exists;
|
||||
|
@ -73,7 +73,7 @@ CommonGraph.prototype.__updateDefinitions = function (edgeDefs, orphans) {
|
|||
CommonGraph.prototype._extendEdgeDefinitions = function (edgeDefinition) {
|
||||
const data = edgeDefinition || {};
|
||||
const uri = GRAPH_PREFIX + encodeURIComponent(this.__name) + "/edge";
|
||||
const requestResult = arangosh.checkRequestResult(db._connection.POST(uri, JSON.stringify(data)));
|
||||
const requestResult = arangosh.checkRequestResult(db._connection.POST(uri, data));
|
||||
const graph = requestResult.graph;
|
||||
try {
|
||||
this.__updateDefinitions(graph.edgeDefinitions, graph.orphanCollections);
|
||||
|
@ -84,7 +84,7 @@ CommonGraph.prototype._extendEdgeDefinitions = function (edgeDefinition) {
|
|||
CommonGraph.prototype._editEdgeDefinitions = function (edgeDefinition) {
|
||||
const data = edgeDefinition || {};
|
||||
const uri = GRAPH_PREFIX + encodeURIComponent(this.__name) + "/edge/" + edgeDefinition.collection;
|
||||
const requestResult = arangosh.checkRequestResult(db._connection.PUT(uri, JSON.stringify(data)));
|
||||
const requestResult = arangosh.checkRequestResult(db._connection.PUT(uri, data));
|
||||
const graph = requestResult.graph;
|
||||
try {
|
||||
this.__updateDefinitions(graph.edgeDefinitions, graph.orphanCollections);
|
||||
|
@ -103,7 +103,7 @@ CommonGraph.prototype._addVertexCollection = function (name, createCollection) {
|
|||
} else {
|
||||
uri += "?createCollection=false";
|
||||
}
|
||||
const requestResult = arangosh.checkRequestResult(db._connection.POST(uri, JSON.stringify(data)));
|
||||
const requestResult = arangosh.checkRequestResult(db._connection.POST(uri, data));
|
||||
const graph = requestResult.graph;
|
||||
|
||||
try {
|
||||
|
@ -179,13 +179,12 @@ exports._create = function (name, edgeDefinitions, orphans, options) {
|
|||
}
|
||||
|
||||
const uri = GRAPH_PREFIX;
|
||||
const requestResult = arangosh.checkRequestResult(db._connection.POST(uri, JSON.stringify(data)));
|
||||
const requestResult = arangosh.checkRequestResult(db._connection.POST(uri, data));
|
||||
db._flushCache();
|
||||
return new CommonGraph(requestResult.graph);
|
||||
};
|
||||
|
||||
exports._drop = function (graphName, dropCollections) {
|
||||
|
||||
let uri = GRAPH_PREFIX + encodeURIComponent(graphName);
|
||||
if (dropCollections) {
|
||||
uri += "?dropCollections=true";
|
||||
|
|
|
@ -340,7 +340,7 @@ function range(start, end) {
|
|||
|
||||
function loadAgency(conn, seen) {
|
||||
|
||||
var agencyDump = conn.POST("/_api/agency/read", '[["/"]]');
|
||||
var agencyDump = conn.POST_RAW("/_api/agency/read", '[["/"]]');
|
||||
seen[conn.getEndpoint()] = true;
|
||||
|
||||
if (agencyDump.code === 404) {
|
||||
|
|
|
@ -59,169 +59,169 @@ static constexpr bool isLittleEndian() {return false;}
|
|||
#pragma messsage("unsupported os or compiler")
|
||||
#endif
|
||||
|
||||
template<typename T> inline void ByteSwap (T& t) {
|
||||
template<typename T> inline void ByteSwap(T& t) {
|
||||
uint8_t* ptr = (uint8_t*)(&t);
|
||||
size_t bytes = sizeof(T);
|
||||
for(size_t i = 0; i < bytes/2; i ++ ) {
|
||||
for (size_t i = 0; i < bytes / 2; i++) {
|
||||
uint8_t swap = ptr[i];
|
||||
ptr[i] = ptr[bytes-i-1];
|
||||
ptr[bytes-i-1] = swap;
|
||||
ptr[i] = ptr[bytes - i - 1];
|
||||
ptr[bytes - i - 1] = swap;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, size_t size> struct EndianTraits;
|
||||
|
||||
template<typename T> struct EndianTraits<T,2> {
|
||||
template<typename T> struct EndianTraits<T, 2> {
|
||||
typedef typename std::make_unsigned<T>::type type;
|
||||
inline static type htole (type in) {
|
||||
inline static type htole(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToLittleInt16(in);
|
||||
#elif __linux__
|
||||
return htole16(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type letoh (type in) {
|
||||
inline static type letoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapLittleToHostInt16(in);
|
||||
#elif __linux__
|
||||
return le16toh(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type htobe (type in) {
|
||||
inline static type htobe(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToBigInt16(in);
|
||||
#elif __linux__
|
||||
return htobe16(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()){
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type betoh (type in) {
|
||||
inline static type betoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapBigToHostInt16(in);
|
||||
#elif __linux__
|
||||
return be16toh(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct EndianTraits<T,4> {
|
||||
template<typename T> struct EndianTraits<T, 4> {
|
||||
typedef typename std::make_unsigned<T>::type type;
|
||||
inline static type htole (type in) {
|
||||
inline static type htole(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToLittleInt32(in);
|
||||
#elif __linux__
|
||||
return htole32(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type letoh (type in) {
|
||||
inline static type letoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapLittleToHostInt32(in);
|
||||
#elif __linux__
|
||||
return le32toh(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type htobe (type in) {
|
||||
inline static type htobe(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToBigInt32(in);
|
||||
#elif __linux__
|
||||
return htobe32(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type betoh (type in) {
|
||||
inline static type betoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapBigToHostInt32(in);
|
||||
#elif __linux__
|
||||
return be32toh(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct EndianTraits<T,8> {
|
||||
template<typename T> struct EndianTraits<T, 8> {
|
||||
typedef typename std::make_unsigned<T>::type type;
|
||||
inline static type htole (type in) {
|
||||
inline static type htole(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToLittleInt64(in);
|
||||
#elif __linux__
|
||||
return htole64(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type letoh (type in) {
|
||||
inline static type letoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapLittleToHostInt64(in);
|
||||
#elif __linux__
|
||||
return le64toh(in);
|
||||
#elif _WIN32
|
||||
if(!isLittleEndian()) {
|
||||
if (!isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type htobe (type in) {
|
||||
inline static type htobe(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapHostToBigInt64(in);
|
||||
#elif __linux__
|
||||
return htobe64(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()){
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
inline static type betoh (type in) {
|
||||
inline static type betoh(type in) {
|
||||
#ifdef __APPLE__
|
||||
return OSSwapBigToHostInt64(in);
|
||||
#elif __linux__
|
||||
return be64toh(in);
|
||||
#elif _WIN32
|
||||
if(isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
if (isLittleEndian()) {
|
||||
ByteSwap(in);
|
||||
}
|
||||
#endif
|
||||
return in;
|
||||
}
|
||||
|
|
|
@ -272,6 +272,7 @@ rest::ResponseCode GeneralResponse::responseCode(int code) {
|
|||
TRI_ASSERT(code != TRI_ERROR_NO_ERROR);
|
||||
|
||||
switch (code) {
|
||||
case TRI_ERROR_HTTP_CORRUPTED_JSON:
|
||||
case TRI_ERROR_BAD_PARAMETER:
|
||||
case TRI_ERROR_ARANGO_DATABASE_NAME_INVALID:
|
||||
case TRI_ERROR_ARANGO_DOCUMENT_KEY_BAD:
|
||||
|
|
Loading…
Reference in New Issue