1
0
Fork 0

Bug fix/vpack update (#8875)

This commit is contained in:
Jan 2019-04-30 12:33:26 +02:00 committed by GitHub
parent d63b8706dd
commit 0cbdfe9289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 146 additions and 256 deletions

View File

@ -36,8 +36,8 @@ class Request;
class Response; class Response;
using Error = std::uint32_t; using Error = std::uint32_t;
using MessageID = uint64_t; // id that identifies a Request. using MessageID = std::uint64_t; // id that identifies a Request.
using StatusCode = uint32_t; using StatusCode = std::uint32_t;
StatusCode constexpr StatusUndefined = 0; StatusCode constexpr StatusUndefined = 0;
StatusCode constexpr StatusOK = 200; StatusCode constexpr StatusOK = 200;

View File

@ -56,7 +56,7 @@ class HttpConnection final : public fuerte::Connection {
MessageID sendRequest(std::unique_ptr<Request>, RequestCallback) override; MessageID sendRequest(std::unique_ptr<Request>, RequestCallback) override;
// Return the number of unfinished requests. // Return the number of unfinished requests.
size_t requestsLeft() const override { std::size_t requestsLeft() const override {
return _numQueued.load(std::memory_order_acquire); return _numQueued.load(std::memory_order_acquire);
} }

View File

@ -60,7 +60,7 @@ class VstConnection final : public Connection {
MessageID sendRequest(std::unique_ptr<Request>, RequestCallback) override; MessageID sendRequest(std::unique_ptr<Request>, RequestCallback) override;
// Return the number of unfinished requests. // Return the number of unfinished requests.
size_t requestsLeft() const override { std::size_t requestsLeft() const override {
return (_loopState.load(std::memory_order_acquire) & WRITE_LOOP_QUEUE_MASK) + _messageStore.size(); return (_loopState.load(std::memory_order_acquire) & WRITE_LOOP_QUEUE_MASK) + _messageStore.size();
} }

View File

@ -1,66 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief Library to build up VPack documents.
///
/// DISCLAIMER
///
/// Copyright 2015 ArangoDB GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Max Neunhoeffer
/// @author Jan Steemann
/// @author Copyright 2015, ArangoDB GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#ifndef VELOCYPACK_HELPERS_H
#define VELOCYPACK_HELPERS_H 1
#include <string>
#include <cstdint>
#include <unordered_set>
#include "velocypack/velocypack-common.h"
#include "velocypack/Exception.h"
#include "velocypack/Options.h"
#include "velocypack/Slice.h"
namespace arangodb {
namespace velocypack {
struct TopLevelAttributeExcludeHandler final : AttributeExcludeHandler {
TopLevelAttributeExcludeHandler (std::unordered_set<std::string> const& attributes)
: attributes(attributes) {
}
bool shouldExclude(Slice const& key, int nesting) override final {
return (nesting == 1 && attributes.find(key.copyString()) != attributes.end());
}
std::unordered_set<std::string> attributes;
};
static inline Slice buildNullValue(char* dst, size_t length) {
if (length < 1) {
throw Exception(Exception::InternalError, "supplied buffer is too small");
}
*dst = 0x18;
return Slice(dst);
}
} // namespace arangodb::velocypack
} // namespace arangodb
#endif

View File

@ -72,9 +72,6 @@ struct Options {
// has no JSON equivalent // has no JSON equivalent
UnsupportedTypeBehavior unsupportedTypeBehavior = FailOnUnsupportedType; UnsupportedTypeBehavior unsupportedTypeBehavior = FailOnUnsupportedType;
// callback for excluding attributes from being built by the Parser
AttributeExcludeHandler* attributeExcludeHandler = nullptr;
AttributeTranslator* attributeTranslator = nullptr; AttributeTranslator* attributeTranslator = nullptr;
// custom type handler used for processing custom types by Dumper and Slicer // custom type handler used for processing custom types by Dumper and Slicer

View File

@ -47,8 +47,6 @@
namespace arangodb { namespace arangodb {
namespace velocypack { namespace velocypack {
class SliceScope;
class Slice { class Slice {
// This class provides read only access to a VPack value, it is // This class provides read only access to a VPack value, it is
// intentionally light-weight (only one pointer value), such that // intentionally light-weight (only one pointer value), such that
@ -65,55 +63,59 @@ class Slice {
public: public:
static constexpr uint64_t defaultSeed = 0xdeadbeef; static constexpr uint64_t defaultSeed = 0xdeadbeef;
static uint8_t const noneSliceData[];
static uint8_t const illegalSliceData[];
static uint8_t const nullSliceData[];
static uint8_t const falseSliceData[];
static uint8_t const trueSliceData[];
static uint8_t const zeroSliceData[];
static uint8_t const emptyStringSliceData[];
static uint8_t const emptyArraySliceData[];
static uint8_t const emptyObjectSliceData[];
static uint8_t const minKeySliceData[];
static uint8_t const maxKeySliceData[];
// constructor for an empty Value of type None // constructor for an empty Value of type None
constexpr Slice() noexcept : Slice("\x00") {} constexpr Slice() noexcept : Slice(noneSliceData) {}
// creates a Slice from a pointer to a uint8_t array // creates a Slice from a pointer to a uint8_t array
explicit constexpr Slice(uint8_t const* start) noexcept explicit constexpr Slice(uint8_t const* start) noexcept
: _start(start) {} : _start(start) {}
// creates a Slice from a pointer to a char array
explicit constexpr Slice(char const* start) noexcept
: _start((uint8_t const*)(start)) {} // reinterpret_cast does not work C++ 11 5.19.2
// No destructor, does not take part in memory management // No destructor, does not take part in memory management
// creates a slice of type None // creates a slice of type None
static constexpr Slice noneSlice() noexcept { return Slice("\x00"); } static constexpr Slice noneSlice() noexcept { return Slice(noneSliceData); }
// creates a slice of type Illegal // creates a slice of type Illegal
static constexpr Slice illegalSlice() noexcept { return Slice("\x17"); } static constexpr Slice illegalSlice() noexcept { return Slice(illegalSliceData); }
// creates a slice of type Null // creates a slice of type Null
static constexpr Slice nullSlice() noexcept { return Slice("\x18"); } static constexpr Slice nullSlice() noexcept { return Slice(nullSliceData); }
// creates a slice of type Boolean with false value // creates a slice of type Boolean with false value
static constexpr Slice falseSlice() noexcept { return Slice("\x19"); } static constexpr Slice falseSlice() noexcept { return Slice(falseSliceData); }
// creates a slice of type Boolean with true value // creates a slice of type Boolean with true value
static constexpr Slice trueSlice() noexcept { return Slice("\x1a"); } static constexpr Slice trueSlice() noexcept { return Slice(trueSliceData); }
// creates a slice of type Smallint(0) // creates a slice of type Smallint(0)
static constexpr Slice zeroSlice() noexcept { return Slice("\x30"); } static constexpr Slice zeroSlice() noexcept { return Slice(zeroSliceData); }
// creates a slice of type String, empty // creates a slice of type String, empty
static constexpr Slice emptyStringSlice() noexcept { return Slice("\x40"); } static constexpr Slice emptyStringSlice() noexcept { return Slice(emptyStringSliceData); }
// creates a slice of type Array, empty // creates a slice of type Array, empty
static constexpr Slice emptyArraySlice() noexcept { return Slice("\x01"); } static constexpr Slice emptyArraySlice() noexcept { return Slice(emptyArraySliceData); }
// creates a slice of type Object, empty // creates a slice of type Object, empty
static constexpr Slice emptyObjectSlice() noexcept { return Slice("\x0a"); } static constexpr Slice emptyObjectSlice() noexcept { return Slice(emptyObjectSliceData); }
// creates a slice of type MinKey // creates a slice of type MinKey
static constexpr Slice minKeySlice() noexcept { return Slice("\x1e"); } static constexpr Slice minKeySlice() noexcept { return Slice(minKeySliceData); }
// creates a slice of type MaxKey // creates a slice of type MaxKey
static constexpr Slice maxKeySlice() noexcept { return Slice("\x1f"); } static constexpr Slice maxKeySlice() noexcept { return Slice(maxKeySliceData); }
// creates a Slice from Json and adds it to a scope
static Slice fromJson(SliceScope& scope, std::string const& json,
Options const* options = &Options::Defaults);
// pointer to the head byte // pointer to the head byte
constexpr uint8_t const* start() const noexcept { return _start; } constexpr uint8_t const* start() const noexcept { return _start; }
@ -516,7 +518,7 @@ class Slice {
// an External // an External
Slice resolveExternal() const { Slice resolveExternal() const {
if (*_start == 0x1d) { if (*_start == 0x1d) {
return Slice(extractPointer()); return Slice(reinterpret_cast<uint8_t const*>(extractPointer()));
} }
return *this; return *this;
} }
@ -524,9 +526,9 @@ class Slice {
// returns the Slice managed by an External or the Slice itself if it's not // returns the Slice managed by an External or the Slice itself if it's not
// an External, recursive version // an External, recursive version
Slice resolveExternals() const { Slice resolveExternals() const {
char const* current = reinterpret_cast<char const*>(_start); uint8_t const* current = _start;
while (*current == 0x1d) { while (*current == 0x1d) {
current = Slice(current).extractPointer(); current = reinterpret_cast<uint8_t const*>(Slice(current).extractPointer());
} }
return Slice(current); return Slice(current);
} }
@ -1083,20 +1085,6 @@ class Slice {
} }
}; };
// a class for keeping Slice allocations in scope
class SliceScope {
public:
SliceScope(SliceScope const&) = delete;
SliceScope& operator=(SliceScope const&) = delete;
SliceScope();
~SliceScope();
Slice add(uint8_t const* data, ValueLength size);
private:
std::vector<uint8_t*> _allocations;
};
} // namespace arangodb::velocypack } // namespace arangodb::velocypack
} // namespace arangodb } // namespace arangodb

View File

@ -99,13 +99,6 @@ using VPackAttributeTranslator = arangodb::velocypack::AttributeTranslator;
#endif #endif
#endif #endif
#ifdef VELOCYPACK_HELPERS_H
#ifndef VELOCYPACK_ALIAS_HELPERS
#define VELOCYPACK_ALIAS_HELPERS
using VPackTopLevelAttributeExcludeHandler = arangodb::velocypack::TopLevelAttributeExcludeHandler;
#endif
#endif
#ifdef VELOCYPACK_DUMPER_H #ifdef VELOCYPACK_DUMPER_H
#ifndef VELOCYPACK_ALIAS_DUMPER #ifndef VELOCYPACK_ALIAS_DUMPER
#define VELOCYPACK_ALIAS_DUMPER #define VELOCYPACK_ALIAS_DUMPER

View File

@ -437,7 +437,7 @@ void Dumper::dumpValue(Slice const* slice, Slice const* base) {
} }
case ValueType::External: { case ValueType::External: {
Slice const external(slice->getExternal()); Slice const external(reinterpret_cast<uint8_t const*>(slice->getExternal()));
dumpValue(&external, base); dumpValue(&external, base);
break; break;
} }

View File

@ -482,19 +482,10 @@ void Parser::parseObject() {
++_pos; ++_pos;
_builderPtr->reportAdd(); _builderPtr->reportAdd();
bool excludeAttribute = false;
auto const lastPos = _builderPtr->_pos; auto const lastPos = _builderPtr->_pos;
if (options->attributeExcludeHandler == nullptr) {
parseString(); parseString();
} else {
parseString();
if (options->attributeExcludeHandler->shouldExclude(
Slice(_builderPtr->_start + lastPos), _nesting)) {
excludeAttribute = true;
}
}
if (!excludeAttribute && options->attributeTranslator != nullptr) { if (options->attributeTranslator != nullptr) {
// check if a translation for the attribute name exists // check if a translation for the attribute name exists
Slice key(_builderPtr->_start + lastPos); Slice key(_builderPtr->_start + lastPos);
@ -523,10 +514,6 @@ void Parser::parseObject() {
parseJson(); parseJson();
if (excludeAttribute) {
_builderPtr->removeLast();
}
i = skipWhiteSpace("Expecting ',' or '}'"); i = skipWhiteSpace("Expecting ',' or '}'");
if (i == '}') { if (i == '}') {
// end of object // end of object

View File

@ -38,20 +38,26 @@
using namespace arangodb::velocypack; using namespace arangodb::velocypack;
namespace {
// maximum values for integers of different byte sizes // maximum values for integers of different byte sizes
static int64_t const maxValues[] = { int64_t const maxValues[] = {
128, 32768, 8388608, 2147483648, 549755813888, 140737488355328, 36028797018963968 128, 32768, 8388608, 2147483648, 549755813888, 140737488355328, 36028797018963968
}; };
// creates a Slice from Json and adds it to a scope } // namespace
Slice Slice::fromJson(SliceScope& scope, std::string const& json,
Options const* options) {
Parser parser(options);
parser.parse(json);
Builder const& b = parser.builder(); // don't copy Builder contents here uint8_t const Slice::noneSliceData[] = { 0x00 };
return scope.add(b.start(), b.size()); uint8_t const Slice::illegalSliceData[] = { 0x17 };
} uint8_t const Slice::nullSliceData[] = { 0x18 };
uint8_t const Slice::falseSliceData[] = { 0x19 };
uint8_t const Slice::trueSliceData[] = { 0x1a };
uint8_t const Slice::zeroSliceData[] = { 0x30 };
uint8_t const Slice::emptyStringSliceData[] = { 0x40 };
uint8_t const Slice::emptyArraySliceData[] = { 0x01 };
uint8_t const Slice::emptyObjectSliceData[] = { 0x0a };
uint8_t const Slice::minKeySliceData[] = { 0x1e };
uint8_t const Slice::maxKeySliceData[] = { 0x1f };
// translates an integer key into a string // translates an integer key into a string
Slice Slice::translate() const { Slice Slice::translate() const {
@ -267,7 +273,7 @@ int64_t Slice::getIntUnchecked() const noexcept {
return toInt64(v); return toInt64(v);
} else { } else {
int64_t vv = static_cast<int64_t>(v); int64_t vv = static_cast<int64_t>(v);
int64_t shift = maxValues[h - 0x20]; int64_t shift = ::maxValues[h - 0x20];
return vv < shift ? vv : vv - (shift << 1); return vv < shift ? vv : vv - (shift << 1);
} }
} }
@ -288,7 +294,7 @@ int64_t Slice::getInt() const {
return toInt64(v); return toInt64(v);
} else { } else {
int64_t vv = static_cast<int64_t>(v); int64_t vv = static_cast<int64_t>(v);
int64_t shift = maxValues[h - 0x20]; int64_t shift = ::maxValues[h - 0x20];
return vv < shift ? vv : vv - (shift << 1); return vv < shift ? vv : vv - (shift << 1);
} }
} }
@ -647,22 +653,6 @@ template Slice Slice::searchObjectKeyBinary<2>(StringRef const& attribute, Value
template Slice Slice::searchObjectKeyBinary<4>(StringRef const& attribute, ValueLength ieBase, ValueLength n) const; template Slice Slice::searchObjectKeyBinary<4>(StringRef const& attribute, ValueLength ieBase, ValueLength n) const;
template Slice Slice::searchObjectKeyBinary<8>(StringRef const& attribute, ValueLength ieBase, ValueLength n) const; template Slice Slice::searchObjectKeyBinary<8>(StringRef const& attribute, ValueLength ieBase, ValueLength n) const;
SliceScope::SliceScope() : _allocations() {}
SliceScope::~SliceScope() {
for (auto& it : _allocations) {
delete[] it;
}
}
Slice SliceScope::add(uint8_t const* data, ValueLength size) {
size_t const s = checkOverflow(size);
std::unique_ptr<uint8_t[]> copy(new uint8_t[s]);
memcpy(copy.get(), data, s);
_allocations.push_back(copy.get());
return Slice(copy.release());
}
std::ostream& operator<<(std::ostream& stream, Slice const* slice) { std::ostream& operator<<(std::ostream& stream, Slice const* slice) {
stream << "[Slice " << valueTypeName(slice->type()) << " (" stream << "[Slice " << valueTypeName(slice->type()) << " ("
<< slice->hexType() << "), byteSize: " << slice->byteSize() << "]"; << slice->hexType() << "), byteSize: " << slice->byteSize() << "]";

View File

@ -626,12 +626,12 @@ struct AggregatorUnique : public Aggregator {
} }
char* pos = allocator.store(s.startAs<char>(), s.byteSize()); char* pos = allocator.store(s.startAs<char>(), s.byteSize());
seen.emplace(pos); seen.emplace(reinterpret_cast<uint8_t const*>(pos));
if (builder.isClosed()) { if (builder.isClosed()) {
builder.openArray(); builder.openArray();
} }
builder.add(VPackSlice(pos)); builder.add(VPackSlice(reinterpret_cast<uint8_t const*>(pos)));
} }
AqlValue stealValue() override final { AqlValue stealValue() override final {
@ -673,12 +673,12 @@ struct AggregatorUniqueStep2 final : public AggregatorUnique {
} }
char* pos = allocator.store(it.startAs<char>(), it.byteSize()); char* pos = allocator.store(it.startAs<char>(), it.byteSize());
seen.emplace(pos); seen.emplace(reinterpret_cast<uint8_t const*>(pos));
if (builder.isClosed()) { if (builder.isClosed()) {
builder.openArray(); builder.openArray();
} }
builder.add(VPackSlice(pos)); builder.add(VPackSlice(reinterpret_cast<uint8_t const*>(pos)));
} }
} }
}; };
@ -709,7 +709,7 @@ struct AggregatorSortedUnique : public Aggregator {
} }
char* pos = allocator.store(s.startAs<char>(), s.byteSize()); char* pos = allocator.store(s.startAs<char>(), s.byteSize());
seen.emplace(pos); seen.emplace(reinterpret_cast<uint8_t const*>(pos));
} }
AqlValue stealValue() override final { AqlValue stealValue() override final {
@ -751,7 +751,7 @@ struct AggregatorSortedUniqueStep2 final : public AggregatorSortedUnique {
} }
char* pos = allocator.store(it.startAs<char>(), it.byteSize()); char* pos = allocator.store(it.startAs<char>(), it.byteSize());
seen.emplace(pos); seen.emplace(reinterpret_cast<uint8_t const*>(pos));
} }
} }
}; };
@ -783,7 +783,7 @@ struct AggregatorCountDistinct : public Aggregator {
} }
char* pos = allocator.store(s.startAs<char>(), s.byteSize()); char* pos = allocator.store(s.startAs<char>(), s.byteSize());
seen.emplace(pos); seen.emplace(reinterpret_cast<uint8_t const*>(pos));
} }
AqlValue stealValue() override final { AqlValue stealValue() override final {
@ -818,7 +818,7 @@ struct AggregatorCountDistinctStep2 final : public AggregatorCountDistinct {
} }
char* pos = allocator.store(it.startAs<char>(), it.byteSize()); char* pos = allocator.store(it.startAs<char>(), it.byteSize());
seen.emplace(pos); seen.emplace(reinterpret_cast<uint8_t const*>(pos));
} }
} }
}; };

View File

@ -46,7 +46,6 @@
#include <velocypack/Buffer.h> #include <velocypack/Buffer.h>
#include <velocypack/Collection.h> #include <velocypack/Collection.h>
#include <velocypack/Helpers.h>
#include <velocypack/Iterator.h> #include <velocypack/Iterator.h>
#include <velocypack/Slice.h> #include <velocypack/Slice.h>
#include <velocypack/velocypack-aliases.h> #include <velocypack/velocypack-aliases.h>

View File

@ -74,7 +74,7 @@ void RestClusterHandler::handleAgencyDump() {
AuthenticationFeature* af = AuthenticationFeature::instance(); AuthenticationFeature* af = AuthenticationFeature::instance();
if (af->isActive() && !_request->user().empty()) { if (af->isActive() && !_request->user().empty()) {
auth::Level lvl = auth::Level::NONE; auth::Level lvl;
if (af->userManager() != nullptr) { if (af->userManager() != nullptr) {
lvl = af->userManager()->databaseAuthLevel(_request->user(), "_system", true); lvl = af->userManager()->databaseAuthLevel(_request->user(), "_system", true);
} else { } else {

View File

@ -63,7 +63,7 @@ inline void validateMessage(char const* vpStart, char const* vpEnd) {
validator.validate(vpStart, std::distance(vpStart, vpEnd), validator.validate(vpStart, std::distance(vpStart, vpEnd),
/*isSubPart =*/true); /*isSubPart =*/true);
VPackSlice slice = VPackSlice(vpStart); VPackSlice slice = VPackSlice(reinterpret_cast<uint8_t const*>(vpStart));
if (!slice.isArray() || slice.length() < 2) { if (!slice.isArray() || slice.length() < 2) {
throw std::runtime_error( throw std::runtime_error(
"VST message does not contain a valid request header"); "VST message does not contain a valid request header");

View File

@ -170,7 +170,7 @@ Result persistLocalDocumentIdIterator(MMFilesMarker const* marker, void* data,
case TRI_DF_MARKER_VPACK_DOCUMENT: { case TRI_DF_MARKER_VPACK_DOCUMENT: {
auto transactionId = MMFilesDatafileHelper::TransactionId(marker); auto transactionId = MMFilesDatafileHelper::TransactionId(marker);
VPackSlice const slice(reinterpret_cast<char const*>(marker) + VPackSlice const slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT)); MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
uint8_t const* vpack = slice.begin(); uint8_t const* vpack = slice.begin();
@ -333,7 +333,7 @@ int MMFilesCollection::OpenIteratorHandleDocumentMarker(MMFilesMarker const* mar
transaction::Methods* trx = state->_trx; transaction::Methods* trx = state->_trx;
TRI_ASSERT(trx != nullptr); TRI_ASSERT(trx != nullptr);
VPackSlice const slice(reinterpret_cast<char const*>(marker) + VPackSlice const slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT)); MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
uint8_t const* vpack = slice.begin(); uint8_t const* vpack = slice.begin();
@ -452,7 +452,7 @@ int MMFilesCollection::OpenIteratorHandleDeletionMarker(MMFilesMarker const* mar
TRI_ASSERT(physical != nullptr); TRI_ASSERT(physical != nullptr);
transaction::Methods* trx = state->_trx; transaction::Methods* trx = state->_trx;
VPackSlice const slice(reinterpret_cast<char const*>(marker) + VPackSlice const slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_REMOVE)); MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_REMOVE));
VPackSlice keySlice; VPackSlice keySlice;

View File

@ -141,7 +141,7 @@ static bool ScanMarker(MMFilesMarker const* marker, void* data, MMFilesDatafile*
break; break;
} }
VPackSlice slice(reinterpret_cast<char const*>(marker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
state->documentOperations[collectionId][transaction::helpers::extractKeyFromDocument(slice) state->documentOperations[collectionId][transaction::helpers::extractKeyFromDocument(slice)
.copyString()] = marker; .copyString()] = marker;
@ -642,7 +642,7 @@ void MMFilesCollectorThread::processCollectionMarker(
auto& dfi = cache->createDfi(fid); auto& dfi = cache->createDfi(fid);
dfi.numberUncollected--; dfi.numberUncollected--;
VPackSlice slice(reinterpret_cast<char const*>(walMarker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(walMarker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
TRI_ASSERT(slice.isObject()); TRI_ASSERT(slice.isObject());
@ -683,7 +683,7 @@ void MMFilesCollectorThread::processCollectionMarker(
dfi.numberUncollected--; dfi.numberUncollected--;
dfi.numberDeletions++; dfi.numberDeletions++;
VPackSlice slice(reinterpret_cast<char const*>(walMarker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(walMarker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
TRI_ASSERT(slice.isObject()); TRI_ASSERT(slice.isObject());

View File

@ -318,7 +318,7 @@ MMFilesCompactorThread::CompactionInitialContext MMFilesCompactorThread::getComp
// new or updated document // new or updated document
if (type == TRI_DF_MARKER_VPACK_DOCUMENT) { if (type == TRI_DF_MARKER_VPACK_DOCUMENT) {
VPackSlice const slice(reinterpret_cast<char const*>(marker) + VPackSlice const slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
TRI_ASSERT(slice.isObject()); TRI_ASSERT(slice.isObject());
@ -415,7 +415,7 @@ void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
// new or updated document // new or updated document
if (type == TRI_DF_MARKER_VPACK_DOCUMENT) { if (type == TRI_DF_MARKER_VPACK_DOCUMENT) {
VPackSlice const slice(reinterpret_cast<char const*>(marker) + VPackSlice const slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
TRI_ASSERT(slice.isObject()); TRI_ASSERT(slice.isObject());

View File

@ -1718,7 +1718,7 @@ DatafileScan MMFilesDatafile::scanHelper() {
if (ok) { if (ok) {
if (type == TRI_DF_MARKER_VPACK_DOCUMENT || type == TRI_DF_MARKER_VPACK_REMOVE) { if (type == TRI_DF_MARKER_VPACK_DOCUMENT || type == TRI_DF_MARKER_VPACK_REMOVE) {
VPackSlice const slice(reinterpret_cast<char const*>(marker) + VPackSlice const slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
TRI_ASSERT(slice.isObject()); TRI_ASSERT(slice.isObject());
try { try {

View File

@ -101,7 +101,7 @@ Result MMFilesExportCursor::dumpSync(VPackBuilder& builder) {
break; break;
} }
VPackSlice const slice(reinterpret_cast<char const*>(_ex->_vpack.at(_position++))); VPackSlice const slice(reinterpret_cast<uint8_t const*>(_ex->_vpack.at(_position++)));
builder.openObject(); builder.openObject();

View File

@ -40,7 +40,7 @@ class MMFilesPersistentIndexKeyComparator final : public rocksdb::Comparator {
~MMFilesPersistentIndexKeyComparator() = default; ~MMFilesPersistentIndexKeyComparator() = default;
static inline arangodb::velocypack::Slice extractKeySlice(rocksdb::Slice const& slice) { static inline arangodb::velocypack::Slice extractKeySlice(rocksdb::Slice const& slice) {
return arangodb::velocypack::Slice(slice.data() + MMFilesPersistentIndex::keyPrefixSize()); return arangodb::velocypack::Slice(reinterpret_cast<uint8_t const*>(slice.data() + MMFilesPersistentIndex::keyPrefixSize()));
} }
int Compare(rocksdb::Slice const& lhs, rocksdb::Slice const& rhs) const override; int Compare(rocksdb::Slice const& lhs, rocksdb::Slice const& rhs) const override;

View File

@ -304,7 +304,7 @@ struct MMFilesWalAccessContext : WalAccessContext {
} }
if (type == TRI_DF_MARKER_VPACK_DROP_DATABASE) { if (type == TRI_DF_MARKER_VPACK_DROP_DATABASE) {
VPackSlice slice(reinterpret_cast<char const*>(marker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
_builder.add("db", slice.get("name")); _builder.add("db", slice.get("name"));
@ -316,7 +316,7 @@ struct MMFilesWalAccessContext : WalAccessContext {
// ignore markers from dropped dbs // ignore markers from dropped dbs
return TRI_ERROR_NO_ERROR; return TRI_ERROR_NO_ERROR;
} }
VPackSlice slice(reinterpret_cast<char const*>(marker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
_builder.add("db", VPackValue(vocbase->name())); _builder.add("db", VPackValue(vocbase->name()));
_builder.add("cuid", slice.get("cuid")); _builder.add("cuid", slice.get("cuid"));
@ -364,7 +364,7 @@ struct MMFilesWalAccessContext : WalAccessContext {
case TRI_DF_MARKER_VPACK_CHANGE_COLLECTION: case TRI_DF_MARKER_VPACK_CHANGE_COLLECTION:
case TRI_DF_MARKER_VPACK_CHANGE_VIEW: case TRI_DF_MARKER_VPACK_CHANGE_VIEW:
case TRI_DF_MARKER_VPACK_DROP_INDEX: { case TRI_DF_MARKER_VPACK_DROP_INDEX: {
VPackSlice slice(reinterpret_cast<char const*>(marker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
_builder.add("data", slice); _builder.add("data", slice);
break; break;

View File

@ -360,7 +360,7 @@ bool MMFilesWalRecoverState::InitialScanMarker(MMFilesMarker const* marker, void
switch (type) { switch (type) {
case TRI_DF_MARKER_VPACK_DOCUMENT: { case TRI_DF_MARKER_VPACK_DOCUMENT: {
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (payloadSlice.isObject()) { if (payloadSlice.isObject()) {
TRI_voc_rid_t revisionId = TRI_voc_rid_t revisionId =
@ -648,7 +648,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
case TRI_DF_MARKER_VPACK_RENAME_COLLECTION: { case TRI_DF_MARKER_VPACK_RENAME_COLLECTION: {
TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker); TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker);
TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker); TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker);
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (!payloadSlice.isObject()) { if (!payloadSlice.isObject()) {
@ -730,7 +730,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
case TRI_DF_MARKER_VPACK_CHANGE_COLLECTION: { case TRI_DF_MARKER_VPACK_CHANGE_COLLECTION: {
TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker); TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker);
TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker); TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker);
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (!payloadSlice.isObject()) { if (!payloadSlice.isObject()) {
@ -784,7 +784,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
case TRI_DF_MARKER_VPACK_CHANGE_VIEW: { case TRI_DF_MARKER_VPACK_CHANGE_VIEW: {
TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker); TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker);
TRI_voc_cid_t const viewId = MMFilesDatafileHelper::ViewId(marker); TRI_voc_cid_t const viewId = MMFilesDatafileHelper::ViewId(marker);
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (!payloadSlice.isObject()) { if (!payloadSlice.isObject()) {
@ -866,7 +866,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
case TRI_DF_MARKER_VPACK_CREATE_INDEX: { case TRI_DF_MARKER_VPACK_CREATE_INDEX: {
TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker); TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker);
TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker); TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker);
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (!payloadSlice.isObject()) { if (!payloadSlice.isObject()) {
@ -948,7 +948,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
case TRI_DF_MARKER_VPACK_CREATE_COLLECTION: { case TRI_DF_MARKER_VPACK_CREATE_COLLECTION: {
TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker); TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker);
TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker); TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker);
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (!payloadSlice.isObject()) { if (!payloadSlice.isObject()) {
@ -1063,7 +1063,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
case TRI_DF_MARKER_VPACK_CREATE_VIEW: { case TRI_DF_MARKER_VPACK_CREATE_VIEW: {
TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker); TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker);
TRI_voc_cid_t const viewId = MMFilesDatafileHelper::ViewId(marker); TRI_voc_cid_t const viewId = MMFilesDatafileHelper::ViewId(marker);
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (!payloadSlice.isObject()) { if (!payloadSlice.isObject()) {
@ -1154,7 +1154,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
case TRI_DF_MARKER_VPACK_CREATE_DATABASE: { case TRI_DF_MARKER_VPACK_CREATE_DATABASE: {
TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker); TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker);
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (!payloadSlice.isObject()) { if (!payloadSlice.isObject()) {
@ -1235,7 +1235,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
case TRI_DF_MARKER_VPACK_DROP_INDEX: { case TRI_DF_MARKER_VPACK_DROP_INDEX: {
TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker); TRI_voc_tick_t const databaseId = MMFilesDatafileHelper::DatabaseId(marker);
TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker); TRI_voc_cid_t const collectionId = MMFilesDatafileHelper::CollectionId(marker);
VPackSlice const payloadSlice(reinterpret_cast<char const*>(marker) + VPackSlice const payloadSlice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
if (!payloadSlice.isObject()) { if (!payloadSlice.isObject()) {

View File

@ -172,7 +172,7 @@ static int StringifyMarker(MMFilesReplicationDumpContext* dump, TRI_voc_tick_t d
case TRI_DF_MARKER_VPACK_DROP_VIEW: { case TRI_DF_MARKER_VPACK_DROP_VIEW: {
Append(dump, ",\"data\":"); Append(dump, ",\"data\":");
VPackSlice slice(reinterpret_cast<char const*>(marker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
arangodb::basics::VPackStringBufferAdapter adapter(dump->_buffer); arangodb::basics::VPackStringBufferAdapter adapter(dump->_buffer);
VPackDumper dumper(&adapter, VPackDumper dumper(&adapter,
@ -259,7 +259,7 @@ static int SliceifyMarker(MMFilesReplicationDumpContext* dump, TRI_voc_tick_t da
case TRI_DF_MARKER_VPACK_DROP_COLLECTION: case TRI_DF_MARKER_VPACK_DROP_COLLECTION:
case TRI_DF_MARKER_VPACK_DROP_INDEX: case TRI_DF_MARKER_VPACK_DROP_INDEX:
case TRI_DF_MARKER_VPACK_DROP_VIEW: { case TRI_DF_MARKER_VPACK_DROP_VIEW: {
VPackSlice slice(reinterpret_cast<char const*>(marker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
builder.add("data", slice); builder.add("data", slice);
break; break;
@ -557,7 +557,7 @@ int MMFilesDumpLogReplication(MMFilesReplicationDumpContext* dump,
TRI_ASSERT(collectionId != 0); TRI_ASSERT(collectionId != 0);
if (dump->_vocbase->id() == databaseId) { if (dump->_vocbase->id() == databaseId) {
VPackSlice slice(reinterpret_cast<char const*>(marker) + VPackSlice slice(reinterpret_cast<uint8_t const*>(marker) +
MMFilesDatafileHelper::VPackOffset(type)); MMFilesDatafileHelper::VPackOffset(type));
VPackSlice name = slice.get("name"); VPackSlice name = slice.get("name");
if (name.isString()) { if (name.isString()) {

View File

@ -407,7 +407,7 @@ Result DatabaseInitialSyncer::parseCollectionDump(transaction::Methods& trx,
// throws if the data is invalid // throws if the data is invalid
validator.validate(p, remaining, /*isSubPart*/ true); validator.validate(p, remaining, /*isSubPart*/ true);
VPackSlice marker(p); VPackSlice marker(reinterpret_cast<uint8_t const*>(p));
Result r = parseCollectionDumpMarker(trx, coll, marker); Result r = parseCollectionDumpMarker(trx, coll, marker);
if (r.fail()) { if (r.fail()) {
r.reset(r.errorNumber(), r.reset(r.errorNumber(),

View File

@ -141,7 +141,7 @@ void RestAdminServerHandler::handleMode() {
} else if (requestType == rest::RequestType::PUT) { } else if (requestType == rest::RequestType::PUT) {
AuthenticationFeature* af = AuthenticationFeature::instance(); AuthenticationFeature* af = AuthenticationFeature::instance();
if (af->isActive() && !_request->user().empty()) { if (af->isActive() && !_request->user().empty()) {
auth::Level lvl = auth::Level::NONE; auth::Level lvl;
if (af->userManager() != nullptr) { if (af->userManager() != nullptr) {
lvl = af->userManager()->databaseAuthLevel(_request->user(), TRI_VOC_SYSTEM_DATABASE, lvl = af->userManager()->databaseAuthLevel(_request->user(), TRI_VOC_SYSTEM_DATABASE,
/*configured*/ true); /*configured*/ true);

View File

@ -53,7 +53,7 @@ RestStatus RestShutdownHandler::execute() {
AuthenticationFeature* af = AuthenticationFeature::instance(); AuthenticationFeature* af = AuthenticationFeature::instance();
if (af->isActive() && !_request->user().empty()) { if (af->isActive() && !_request->user().empty()) {
auth::Level lvl = auth::Level::NONE; auth::Level lvl;
if (af->userManager() != nullptr) { if (af->userManager() != nullptr) {
lvl = af->userManager()->databaseAuthLevel(_request->user(), "_system", lvl = af->userManager()->databaseAuthLevel(_request->user(), "_system",
/*configured*/ true); /*configured*/ true);

View File

@ -391,7 +391,7 @@ class RocksDBFlushMarker {
_databaseId = arangodb::rocksutils::uint64FromPersistent(ptr); _databaseId = arangodb::rocksutils::uint64FromPersistent(ptr);
ptr += sizeof(uint64_t); ptr += sizeof(uint64_t);
_slice = arangodb::velocypack::Slice(ptr); _slice = arangodb::velocypack::Slice(reinterpret_cast<uint8_t const*>(ptr));
if (_slice.byteSize() != size_t(end - ptr)) { if (_slice.byteSize() != size_t(end - ptr)) {
THROW_ARANGO_EXCEPTION(arangodb::Result( // exception THROW_ARANGO_EXCEPTION(arangodb::Result( // exception

View File

@ -228,7 +228,7 @@ static arangodb::Result fillIndex(RocksDBIndex& ridx, WriteBatchType& batch,
} }
res = ridx.insert(trx, &batched, RocksDBKey::documentId(it->key()), res = ridx.insert(trx, &batched, RocksDBKey::documentId(it->key()),
VPackSlice(it->value().data()), Index::OperationMode::normal); VPackSlice(reinterpret_cast<uint8_t const*>(it->value().data())), Index::OperationMode::normal);
if (res.fail()) { if (res.fail()) {
break; break;
} }

View File

@ -398,7 +398,7 @@ std::shared_ptr<Index> RocksDBCollection::createIndex(VPackSlice const& info,
VPackBuilder builder; VPackBuilder builder;
builder.openObject(); builder.openObject();
for (auto const& pair : VPackObjectIterator(VPackSlice(ps.data()))) { for (auto const& pair : VPackObjectIterator(VPackSlice(reinterpret_cast<uint8_t const*>(ps.data())))) {
if (pair.key.isEqualString("indexes")) { // append new index if (pair.key.isEqualString("indexes")) { // append new index
VPackArrayBuilder arrGuard(&builder, "indexes"); VPackArrayBuilder arrGuard(&builder, "indexes");
builder.add(VPackArrayIterator(pair.value)); builder.add(VPackArrayIterator(pair.value));
@ -696,7 +696,7 @@ Result RocksDBCollection::truncate(transaction::Methods& trx, OperationOptions&
++found; ++found;
TRI_ASSERT(_objectId == RocksDBKey::objectId(iter->key())); TRI_ASSERT(_objectId == RocksDBKey::objectId(iter->key()));
VPackSlice document(iter->value().data()); VPackSlice document(reinterpret_cast<uint8_t const*>(iter->value().data()));
TRI_ASSERT(document.isObject()); TRI_ASSERT(document.isObject());
// tmp may contain a pointer into rocksdb::WriteBuffer::_rep. This is // tmp may contain a pointer into rocksdb::WriteBuffer::_rep. This is
@ -950,7 +950,7 @@ Result RocksDBCollection::update(arangodb::transaction::Methods* trx,
} }
TRI_ASSERT(previousPS.size() > 0); TRI_ASSERT(previousPS.size() > 0);
VPackSlice const oldDoc(previousPS.data()); VPackSlice const oldDoc(reinterpret_cast<uint8_t const*>(previousPS.data()));
previousMdr.setRevisionId(transaction::helpers::extractRevFromDocument(oldDoc)); previousMdr.setRevisionId(transaction::helpers::extractRevFromDocument(oldDoc));
TRI_ASSERT(previousMdr.revisionId() != 0); TRI_ASSERT(previousMdr.revisionId() != 0);
@ -1060,7 +1060,7 @@ Result RocksDBCollection::replace(transaction::Methods* trx,
} }
TRI_ASSERT(previousPS.size() > 0); TRI_ASSERT(previousPS.size() > 0);
VPackSlice const oldDoc(previousPS.data()); VPackSlice const oldDoc(reinterpret_cast<uint8_t const*>(previousPS.data()));
previousMdr.setRevisionId(transaction::helpers::extractRevFromDocument(oldDoc)); previousMdr.setRevisionId(transaction::helpers::extractRevFromDocument(oldDoc));
TRI_ASSERT(previousMdr.revisionId() != 0); TRI_ASSERT(previousMdr.revisionId() != 0);
@ -1165,7 +1165,7 @@ Result RocksDBCollection::remove(transaction::Methods& trx, velocypack::Slice sl
} }
TRI_ASSERT(previousPS.size() > 0); TRI_ASSERT(previousPS.size() > 0);
VPackSlice const oldDoc(previousPS.data()); VPackSlice const oldDoc(reinterpret_cast<uint8_t const*>(previousPS.data()));
previousMdr.setRevisionId(transaction::helpers::extractRevFromDocument(oldDoc)); previousMdr.setRevisionId(transaction::helpers::extractRevFromDocument(oldDoc));
TRI_ASSERT(previousMdr.revisionId() != 0); TRI_ASSERT(previousMdr.revisionId() != 0);
@ -1471,7 +1471,7 @@ bool RocksDBCollection::lookupDocumentVPack(transaction::Methods* trx,
auto f = _cache->find(key->string().data(), auto f = _cache->find(key->string().data(),
static_cast<uint32_t>(key->string().size())); static_cast<uint32_t>(key->string().size()));
if (f.found()) { if (f.found()) {
cb(documentId, VPackSlice(reinterpret_cast<char const*>(f.value()->value()))); cb(documentId, VPackSlice(reinterpret_cast<uint8_t const*>(f.value()->value())));
return true; return true;
} }
} }
@ -1481,7 +1481,7 @@ bool RocksDBCollection::lookupDocumentVPack(transaction::Methods* trx,
Result res = lookupDocumentVPack(trx, documentId, ps, /*readCache*/false, withCache); Result res = lookupDocumentVPack(trx, documentId, ps, /*readCache*/false, withCache);
if (res.ok()) { if (res.ok()) {
TRI_ASSERT(ps.size() > 0); TRI_ASSERT(ps.size() > 0);
cb(documentId, VPackSlice(ps.data())); cb(documentId, VPackSlice(reinterpret_cast<uint8_t const*>(ps.data())));
return true; return true;
} }
return false; return false;

View File

@ -83,8 +83,8 @@ int RocksDBVPackComparator::compareIndexValues(rocksdb::Slice const& lhs,
TRI_ASSERT(lhs.size() > sizeof(uint64_t)); TRI_ASSERT(lhs.size() > sizeof(uint64_t));
TRI_ASSERT(rhs.size() > sizeof(uint64_t)); TRI_ASSERT(rhs.size() > sizeof(uint64_t));
VPackSlice const lSlice = VPackSlice(lhs.data() + sizeof(uint64_t)); VPackSlice const lSlice = VPackSlice(reinterpret_cast<uint8_t const*>(lhs.data()) + sizeof(uint64_t));
VPackSlice const rSlice = VPackSlice(rhs.data() + sizeof(uint64_t)); VPackSlice const rSlice = VPackSlice(reinterpret_cast<uint8_t const*>(rhs.data()) + sizeof(uint64_t));
r = ::compareIndexedValues(lSlice, rSlice); r = ::compareIndexedValues(lSlice, rSlice);

View File

@ -852,7 +852,7 @@ void RocksDBEngine::getDatabases(arangodb::velocypack::Builder& result) {
result.openArray(); result.openArray();
auto rSlice = rocksDBSlice(RocksDBEntryType::Database); auto rSlice = rocksDBSlice(RocksDBEntryType::Database);
for (iter->Seek(rSlice); iter->Valid() && iter->key().starts_with(rSlice); iter->Next()) { for (iter->Seek(rSlice); iter->Valid() && iter->key().starts_with(rSlice); iter->Next()) {
auto slice = VPackSlice(iter->value().data()); auto slice = VPackSlice(reinterpret_cast<uint8_t const*>(iter->value().data()));
//// check format id //// check format id
VPackSlice idSlice = slice.get("id"); VPackSlice idSlice = slice.get("id");
@ -954,7 +954,7 @@ int RocksDBEngine::getCollectionsAndIndexes(TRI_vocbase_t& vocbase,
continue; continue;
} }
auto slice = VPackSlice(iter->value().data()); auto slice = VPackSlice(reinterpret_cast<uint8_t const*>(iter->value().data()));
if (arangodb::basics::VelocyPackHelper::readBooleanValue(slice, StaticStrings::DataSourceDeleted, if (arangodb::basics::VelocyPackHelper::readBooleanValue(slice, StaticStrings::DataSourceDeleted,
false)) { false)) {
@ -981,7 +981,7 @@ int RocksDBEngine::getViews(TRI_vocbase_t& vocbase, arangodb::velocypack::Builde
result.openArray(); result.openArray();
for (iter->Seek(bounds.start()); iter->Valid(); iter->Next()) { for (iter->Seek(bounds.start()); iter->Valid(); iter->Next()) {
TRI_ASSERT(iter->key().compare(bounds.end()) < 0); TRI_ASSERT(iter->key().compare(bounds.end()) < 0);
auto slice = VPackSlice(iter->value().data()); auto slice = VPackSlice(reinterpret_cast<uint8_t const*>(iter->value().data()));
LOG_TOPIC("e3bcd", TRACE, Logger::VIEWS) << "got view slice: " << slice.toJson(); LOG_TOPIC("e3bcd", TRACE, Logger::VIEWS) << "got view slice: " << slice.toJson();

View File

@ -112,7 +112,7 @@ bool RocksDBAllIndexIterator::nextDocument(IndexIterator::DocumentCallback const
} }
while (limit > 0) { while (limit > 0) {
cb(RocksDBKey::documentId(_iterator->key()), VPackSlice(_iterator->value().data())); cb(RocksDBKey::documentId(_iterator->key()), VPackSlice(reinterpret_cast<uint8_t const*>(_iterator->value().data())));
--limit; --limit;
_iterator->Next(); _iterator->Next();
@ -220,7 +220,7 @@ bool RocksDBAnyIndexIterator::nextDocument(IndexIterator::DocumentCallback const
} }
while (limit > 0) { while (limit > 0) {
cb(RocksDBKey::documentId(_iterator->key()), VPackSlice(_iterator->value().data())); cb(RocksDBKey::documentId(_iterator->key()), VPackSlice(reinterpret_cast<uint8_t const*>(_iterator->value().data())));
--limit; --limit;
_returned++; _returned++;
_iterator->Next(); _iterator->Next();

View File

@ -446,7 +446,7 @@ arangodb::velocypack::StringRef RocksDBKey::vertexId(char const* data, size_t si
VPackSlice RocksDBKey::indexedVPack(char const* data, size_t size) { VPackSlice RocksDBKey::indexedVPack(char const* data, size_t size) {
TRI_ASSERT(data != nullptr); TRI_ASSERT(data != nullptr);
TRI_ASSERT(size > sizeof(uint64_t)); TRI_ASSERT(size > sizeof(uint64_t));
return VPackSlice(data + sizeof(uint64_t)); return VPackSlice(reinterpret_cast<uint8_t const*>(data) + sizeof(uint64_t));
} }
namespace arangodb { namespace arangodb {

View File

@ -309,8 +309,10 @@ RocksDBKeyBounds::RocksDBKeyBounds(RocksDBEntryType type, uint64_t first)
// 7 + 8-byte object ID of index + VPack array with index value(s) .... // 7 + 8-byte object ID of index + VPack array with index value(s) ....
// prefix is the same for non-unique indexes // prefix is the same for non-unique indexes
// static slices with an array with one entry // static slices with an array with one entry
VPackSlice min("\x02\x03\x1e"); // [minSlice] uint8_t const minSlice[] = { 0x02, 0x03, 0x1e }; // [minSlice]
VPackSlice max("\x02\x03\x1f"); // [maxSlice] uint8_t const maxSlice[] = { 0x02, 0x03, 0x1f }; // [maxSlice]
VPackSlice min(minSlice);
VPackSlice max(maxSlice);
_internals.reserve(2 * sizeof(uint64_t) + min.byteSize() + max.byteSize()); _internals.reserve(2 * sizeof(uint64_t) + min.byteSize() + max.byteSize());
uint64ToPersistent(_internals.buffer(), first); uint64ToPersistent(_internals.buffer(), first);

View File

@ -302,14 +302,14 @@ VPackSlice RocksDBLogValue::indexSlice(rocksdb::Slice const& slice) {
TRI_ASSERT(slice.size() >= sizeof(RocksDBLogType) + sizeof(uint64_t) * 2); TRI_ASSERT(slice.size() >= sizeof(RocksDBLogType) + sizeof(uint64_t) * 2);
RocksDBLogType type = static_cast<RocksDBLogType>(slice.data()[0]); RocksDBLogType type = static_cast<RocksDBLogType>(slice.data()[0]);
TRI_ASSERT(type == RocksDBLogType::IndexCreate); TRI_ASSERT(type == RocksDBLogType::IndexCreate);
return VPackSlice(slice.data() + sizeof(RocksDBLogType) + sizeof(uint64_t) * 2); return VPackSlice(reinterpret_cast<uint8_t const*>(slice.data() + sizeof(RocksDBLogType) + sizeof(uint64_t) * 2));
} }
VPackSlice RocksDBLogValue::viewSlice(rocksdb::Slice const& slice) { VPackSlice RocksDBLogValue::viewSlice(rocksdb::Slice const& slice) {
TRI_ASSERT(slice.size() >= sizeof(RocksDBLogType) + sizeof(uint64_t) * 2); TRI_ASSERT(slice.size() >= sizeof(RocksDBLogType) + sizeof(uint64_t) * 2);
RocksDBLogType type = static_cast<RocksDBLogType>(slice.data()[0]); RocksDBLogType type = static_cast<RocksDBLogType>(slice.data()[0]);
TRI_ASSERT(type == RocksDBLogType::ViewDrop); TRI_ASSERT(type == RocksDBLogType::ViewDrop);
return VPackSlice(slice.data() + sizeof(RocksDBLogType) + sizeof(uint64_t) * 2); return VPackSlice(reinterpret_cast<uint8_t const*>(slice.data() + sizeof(RocksDBLogType) + sizeof(uint64_t) * 2));
} }
namespace { namespace {
@ -351,7 +351,7 @@ std::pair<LocalDocumentId, VPackSlice> RocksDBLogValue::trackedDocument(rocksdb:
type == RocksDBLogType::TrackedDocumentRemove); type == RocksDBLogType::TrackedDocumentRemove);
LocalDocumentId id(uintFromPersistentLittleEndian<LocalDocumentId::BaseType>(slice.data() + sizeof(RocksDBLogType))); LocalDocumentId id(uintFromPersistentLittleEndian<LocalDocumentId::BaseType>(slice.data() + sizeof(RocksDBLogType)));
VPackSlice data(slice.data() + sizeof(RocksDBLogType) + sizeof(LocalDocumentId::BaseType)); VPackSlice data(reinterpret_cast<uint8_t const*>(slice.data() + sizeof(RocksDBLogType) + sizeof(LocalDocumentId::BaseType)));
return std::make_pair(id, data); return std::make_pair(id, data);
} }

View File

@ -269,7 +269,7 @@ RocksDBReplicationContext::DumpResult RocksDBReplicationContext::dumpJson(
buff.appendInteger(REPLICATION_MARKER_DOCUMENT); // set type buff.appendInteger(REPLICATION_MARKER_DOCUMENT); // set type
buff.appendText(",\"data\":"); buff.appendText(",\"data\":");
// printing the data, note: we need the CustomTypeHandler here // printing the data, note: we need the CustomTypeHandler here
dumper.dump(velocypack::Slice(cIter->iter->value().data())); dumper.dump(velocypack::Slice(reinterpret_cast<uint8_t const*>(cIter->iter->value().data())));
buff.appendText("}\n"); buff.appendText("}\n");
cIter->iter->Next(); cIter->iter->Next();
} }
@ -312,7 +312,7 @@ RocksDBReplicationContext::DumpResult RocksDBReplicationContext::dumpVPack(
builder.openObject(); builder.openObject();
builder.add("type", VPackValue(REPLICATION_MARKER_DOCUMENT)); builder.add("type", VPackValue(REPLICATION_MARKER_DOCUMENT));
builder.add(VPackValue("data")); builder.add(VPackValue("data"));
builder.add(velocypack::Slice(cIter->iter->value().data())); builder.add(velocypack::Slice(reinterpret_cast<uint8_t const*>(cIter->iter->value().data())));
builder.close(); builder.close();
cIter->iter->Next(); cIter->iter->Next();
} }
@ -390,7 +390,7 @@ arangodb::Result RocksDBReplicationContext::dumpKeyChunks(TRI_vocbase_t& vocbase
docKey.string(), &ps); docKey.string(), &ps);
if (s.ok()) { if (s.ok()) {
TRI_ASSERT(ps.size() > 0); TRI_ASSERT(ps.size() > 0);
docRev = TRI_ExtractRevisionId(VPackSlice(ps.data())); docRev = TRI_ExtractRevisionId(VPackSlice(reinterpret_cast<uint8_t const*>(ps.data())));
} else { } else {
LOG_TOPIC("32e3b", WARN, Logger::REPLICATION) LOG_TOPIC("32e3b", WARN, Logger::REPLICATION)
<< "inconsistent primary index, " << "inconsistent primary index, "
@ -536,7 +536,7 @@ arangodb::Result RocksDBReplicationContext::dumpKeys(TRI_vocbase_t& vocbase,
tmpKey.string(), &ps); tmpKey.string(), &ps);
if (s.ok()) { if (s.ok()) {
TRI_ASSERT(ps.size() > 0); TRI_ASSERT(ps.size() > 0);
docRev = TRI_ExtractRevisionId(VPackSlice(ps.data())); docRev = TRI_ExtractRevisionId(VPackSlice(reinterpret_cast<uint8_t const*>(ps.data())));
} else { } else {
arangodb::velocypack::StringRef key = RocksDBKey::primaryKey(cIter->iter->key()); arangodb::velocypack::StringRef key = RocksDBKey::primaryKey(cIter->iter->key());
LOG_TOPIC("41803", WARN, Logger::REPLICATION) LOG_TOPIC("41803", WARN, Logger::REPLICATION)
@ -674,8 +674,8 @@ arangodb::Result RocksDBReplicationContext::dumpDocuments(
tmpKey.string(), &ps); tmpKey.string(), &ps);
if (s.ok()) { if (s.ok()) {
TRI_ASSERT(ps.size() > 0); TRI_ASSERT(ps.size() > 0);
TRI_ASSERT(VPackSlice(ps.data()).isObject()); TRI_ASSERT(VPackSlice(reinterpret_cast<uint8_t const*>(ps.data())).isObject());
b.add(VPackSlice(ps.data())); b.add(VPackSlice(reinterpret_cast<uint8_t const*>(ps.data())));
} else { } else {
arangodb::velocypack::StringRef key = RocksDBKey::primaryKey(cIter->iter->key()); arangodb::velocypack::StringRef key = RocksDBKey::primaryKey(cIter->iter->key());
LOG_TOPIC("d79df", WARN, Logger::REPLICATION) LOG_TOPIC("d79df", WARN, Logger::REPLICATION)

View File

@ -237,7 +237,7 @@ void RocksDBSettingsManager::loadSettings() {
key.string(), &result); key.string(), &result);
if (status.ok()) { if (status.ok()) {
// key may not be there, so don't fail when not found // key may not be there, so don't fail when not found
VPackSlice slice = VPackSlice(result.data()); VPackSlice slice = VPackSlice(reinterpret_cast<uint8_t const*>(result.data()));
TRI_ASSERT(slice.isObject()); TRI_ASSERT(slice.isObject());
LOG_TOPIC("7458b", TRACE, Logger::ENGINES) << "read initial settings: " << slice.toJson(); LOG_TOPIC("7458b", TRACE, Logger::ENGINES) << "read initial settings: " << slice.toJson();

View File

@ -191,7 +191,7 @@ class RocksDBVPackIndexIterator final : public IndexIterator {
if (reverse) { if (reverse) {
_rangeBound = _bounds.start(); _rangeBound = _bounds.start();
options.iterate_lower_bound = &_rangeBound; options.iterate_lower_bound = &_rangeBound;
VPackSlice s = VPackSlice(_rangeBound.data() + sizeof(uint64_t)); VPackSlice s = VPackSlice(reinterpret_cast<uint8_t const*>(_rangeBound.data() + sizeof(uint64_t)));
if (s.isArray() && s.length() == 1 && s.at(0).isMinKey()) { if (s.isArray() && s.length() == 1 && s.at(0).isMinKey()) {
// lower bound is the min key. that means we can get away with a // lower bound is the min key. that means we can get away with a
// cheap outOfBounds comparator // cheap outOfBounds comparator
@ -200,7 +200,7 @@ class RocksDBVPackIndexIterator final : public IndexIterator {
} else { } else {
_rangeBound = _bounds.end(); _rangeBound = _bounds.end();
options.iterate_upper_bound = &_rangeBound; options.iterate_upper_bound = &_rangeBound;
VPackSlice s = VPackSlice(_rangeBound.data() + sizeof(uint64_t)); VPackSlice s = VPackSlice(reinterpret_cast<uint8_t const*>(_rangeBound.data() + sizeof(uint64_t)));
if (s.isArray() && s.length() == 1 && s.at(0).isMaxKey()) { if (s.isArray() && s.length() == 1 && s.at(0).isMaxKey()) {
// upper bound is the max key. that means we can get away with a // upper bound is the max key. that means we can get away with a
// cheap outOfBounds comparator // cheap outOfBounds comparator

View File

@ -224,13 +224,13 @@ arangodb::velocypack::StringRef RocksDBValue::vertexId(char const* data, size_t
VPackSlice RocksDBValue::data(char const* data, size_t size) { VPackSlice RocksDBValue::data(char const* data, size_t size) {
TRI_ASSERT(data != nullptr); TRI_ASSERT(data != nullptr);
TRI_ASSERT(size >= sizeof(char)); TRI_ASSERT(size >= sizeof(char));
return VPackSlice(data); return VPackSlice(reinterpret_cast<uint8_t const*>(data));
} }
uint64_t RocksDBValue::keyValue(char const* data, size_t size) { uint64_t RocksDBValue::keyValue(char const* data, size_t size) {
TRI_ASSERT(data != nullptr); TRI_ASSERT(data != nullptr);
TRI_ASSERT(size >= sizeof(char)); TRI_ASSERT(size >= sizeof(char));
VPackSlice key = transaction::helpers::extractKeyFromDocument(VPackSlice(data)); VPackSlice key = transaction::helpers::extractKeyFromDocument(VPackSlice(reinterpret_cast<uint8_t const*>(data)));
if (key.isString()) { if (key.isString()) {
VPackValueLength l; VPackValueLength l;
char const* p = key.getStringUnchecked(l); char const* p = key.getStringUnchecked(l);

View File

@ -54,7 +54,7 @@ void ManagedDocumentResult::addToBuilder(velocypack::Builder& builder,
TRI_ASSERT(!empty()); TRI_ASSERT(!empty());
if (_vpack == nullptr) { // managed if (_vpack == nullptr) { // managed
TRI_ASSERT(!_string.empty()); TRI_ASSERT(!_string.empty());
builder.add(VPackSlice(_string.data())); builder.add(VPackSlice(reinterpret_cast<uint8_t const*>(_string.data())));
} else { } else {
if (allowExternals) { if (allowExternals) {
builder.addExternal(_vpack); builder.addExternal(_vpack);

View File

@ -189,7 +189,7 @@ void VPackFeature::start() {
return; return;
} }
slice = VPackSlice(s.data()); slice = VPackSlice(reinterpret_cast<uint8_t const*>(s.data()));
} }
VPackBuffer<char> buffer(4096); VPackBuffer<char> buffer(4096);

View File

@ -496,7 +496,7 @@ void VelocyPackDumper::dumpValue(VPackSlice const* slice, VPackSlice const* base
} }
case VPackValueType::External: { case VPackValueType::External: {
VPackSlice const external(slice->getExternal()); VPackSlice const external(reinterpret_cast<uint8_t const*>(slice->getExternal()));
dumpValue(&external, base); dumpValue(&external, base);
break; break;
} }

View File

@ -468,7 +468,7 @@ void VelocyPackHelper::ensureStringValue(VPackSlice const& slice, std::string co
arangodb::velocypack::Slice slice, std::string const& key, arangodb::velocypack::Slice slice, std::string const& key,
arangodb::velocypack::StringRef const& defaultValue) noexcept { arangodb::velocypack::StringRef const& defaultValue) noexcept {
if (slice.isExternal()) { if (slice.isExternal()) {
slice = arangodb::velocypack::Slice(slice.getExternal()); slice = arangodb::velocypack::Slice(reinterpret_cast<uint8_t const*>(slice.getExternal()));
} }
if (!slice.isObject() || !slice.hasKey(key)) { if (!slice.isObject() || !slice.hasKey(key)) {
@ -495,7 +495,7 @@ std::string VelocyPackHelper::getStringValue(VPackSlice const& slice,
std::string VelocyPackHelper::getStringValue(VPackSlice slice, char const* name, std::string VelocyPackHelper::getStringValue(VPackSlice slice, char const* name,
std::string const& defaultValue) { std::string const& defaultValue) {
if (slice.isExternal()) { if (slice.isExternal()) {
slice = VPackSlice(slice.getExternal()); slice = VPackSlice(reinterpret_cast<uint8_t const*>(slice.getExternal()));
} }
TRI_ASSERT(slice.isObject()); TRI_ASSERT(slice.isObject());
if (!slice.hasKey(name)) { if (!slice.hasKey(name)) {
@ -514,7 +514,7 @@ std::string VelocyPackHelper::getStringValue(VPackSlice slice, char const* name,
std::string VelocyPackHelper::getStringValue(VPackSlice slice, std::string const& name, std::string VelocyPackHelper::getStringValue(VPackSlice slice, std::string const& name,
std::string const& defaultValue) { std::string const& defaultValue) {
if (slice.isExternal()) { if (slice.isExternal()) {
slice = VPackSlice(slice.getExternal()); slice = VPackSlice(reinterpret_cast<uint8_t const*>(slice.getExternal()));
} }
TRI_ASSERT(slice.isObject()); TRI_ASSERT(slice.isObject());
if (!slice.hasKey(name)) { if (!slice.hasKey(name)) {

View File

@ -213,7 +213,7 @@ void LogAppender::log(LogMessage* message) {
// otherwise use the general topic // otherwise use the general topic
if (!shown) { if (!shown) {
shown = output(LogTopic::MAX_LOG_TOPICS); output(LogTopic::MAX_LOG_TOPICS);
} }
for (auto const& logger : _loggers) { for (auto const& logger : _loggers) {

View File

@ -404,7 +404,7 @@ class RandomDeviceWin32 : public RandomDevice {
} }
} }
uint32_t random() { uint32_t random() override {
if (pos >= N) { if (pos >= N) {
fillBuffer(); fillBuffer();
} }

View File

@ -747,7 +747,7 @@ VPackSlice HttpRequest::payload(VPackOptions const* options) {
validationOptions.disallowCustom = true; validationOptions.disallowCustom = true;
VPackValidator validator(&validationOptions); VPackValidator validator(&validationOptions);
validator.validate(_body.c_str(), _body.length()); validator.validate(_body.c_str(), _body.length());
return VPackSlice(_body.c_str()); return VPackSlice(reinterpret_cast<uint8_t const*>(_body.c_str()));
} }
return VPackSlice::noneSlice(); return VPackSlice::noneSlice();
} }

View File

@ -83,7 +83,7 @@ VPackSlice VstRequest::payload(VPackOptions const* options) {
// will throw on error // will throw on error
_validatedPayload = validator.validate(vpack.data(), vpack.length()); _validatedPayload = validator.validate(vpack.data(), vpack.length());
} }
return VPackSlice(vpack.data()); return VPackSlice(reinterpret_cast<uint8_t const*>(vpack.data()));
} }
} }
return VPackSlice::noneSlice(); // no body return VPackSlice::noneSlice(); // no body

View File

@ -238,7 +238,7 @@ asio_ns::ssl::context SslServerFeature::createSslContext() const {
LOG_TOPIC("cdaf2", TRACE, arangodb::Logger::SSL) LOG_TOPIC("cdaf2", TRACE, arangodb::Logger::SSL)
<< "trying to load CA certificates from '" << _cafile << "'"; << "trying to load CA certificates from '" << _cafile << "'";
int res = SSL_CTX_load_verify_locations(nativeContext, _cafile.c_str(), nullptr); res = SSL_CTX_load_verify_locations(nativeContext, _cafile.c_str(), nullptr);
if (res == 0) { if (res == 0) {
LOG_TOPIC("30289", ERR, arangodb::Logger::SSL) LOG_TOPIC("30289", ERR, arangodb::Logger::SSL)

View File

@ -107,10 +107,10 @@ std::string const& ScriptLoader::findScript(std::string const& name) {
MUTEX_LOCKER(mutexLocker, _lock); MUTEX_LOCKER(mutexLocker, _lock);
std::map<std::string, std::string>::iterator i = _scripts.find(name); auto it = _scripts.find(name);
if (i != _scripts.end()) { if (it != _scripts.end()) {
return i->second; return it->second;
} }
if (!_directory.empty()) { if (!_directory.empty()) {

View File

@ -1050,7 +1050,7 @@ void JS_Download(v8::FunctionCallbackInfo<v8::Value> const& args) {
validationOptions.disallowCustom = true; validationOptions.disallowCustom = true;
VPackValidator validator(&validationOptions); VPackValidator validator(&validationOptions);
validator.validate(sb.data(), sb.length()); // throws on error validator.validate(sb.data(), sb.length()); // throws on error
json.assign(VPackSlice(sb.data()).toJson()); json.assign(VPackSlice(reinterpret_cast<uint8_t const*>(sb.data())).toJson());
body = arangodb::velocypack::StringRef(json); body = arangodb::velocypack::StringRef(json);
} }
@ -2650,7 +2650,7 @@ static void JS_CopyFile(v8::FunctionCallbackInfo<v8::Value> const& args) {
if (destinationIsDirectory) { if (destinationIsDirectory) {
char const* file = strrchr(source.c_str(), TRI_DIR_SEPARATOR_CHAR); char const* file = strrchr(source.c_str(), TRI_DIR_SEPARATOR_CHAR);
if (file == nullptr) { if (file == nullptr) {
if (destination[destination.length()] == TRI_DIR_SEPARATOR_CHAR) { if (!destination.empty() && destination.back() != TRI_DIR_SEPARATOR_CHAR) {
destination += TRI_DIR_SEPARATOR_CHAR; destination += TRI_DIR_SEPARATOR_CHAR;
} }
destination += source; destination += source;
@ -4686,7 +4686,7 @@ static void JS_VPackToV8(v8::FunctionCallbackInfo<v8::Value> const& args) {
validator.validate(value.c_str(), value.size(), false); validator.validate(value.c_str(), value.size(), false);
VPackSlice slice(value.c_str()); VPackSlice slice(reinterpret_cast<uint8_t const*>(value.data()));
v8::Handle<v8::Value> result = TRI_VPackToV8(isolate, slice); v8::Handle<v8::Value> result = TRI_VPackToV8(isolate, slice);
TRI_V8_RETURN(result); TRI_V8_RETURN(result);
} else if (args[0]->IsObject() && V8Buffer::hasInstance(isolate, args[0])) { } else if (args[0]->IsObject() && V8Buffer::hasInstance(isolate, args[0])) {
@ -4696,7 +4696,7 @@ static void JS_VPackToV8(v8::FunctionCallbackInfo<v8::Value> const& args) {
validator.validate(data, size, false); validator.validate(data, size, false);
VPackSlice slice(data); VPackSlice slice(reinterpret_cast<uint8_t const*>(data));
v8::Handle<v8::Value> result = TRI_VPackToV8(isolate, slice); v8::Handle<v8::Value> result = TRI_VPackToV8(isolate, slice);
TRI_V8_RETURN(result); TRI_V8_RETURN(result);
} else { } else {

View File

@ -232,7 +232,7 @@ v8::Handle<v8::Value> TRI_VPackToV8(v8::Isolate* isolate, VPackSlice const& slic
} }
case VPackValueType::External: { case VPackValueType::External: {
// resolve external // resolve external
return TRI_VPackToV8(isolate, VPackSlice(slice.getExternal()), options, base); return TRI_VPackToV8(isolate, VPackSlice(reinterpret_cast<uint8_t const*>(slice.getExternal())), options, base);
} }
case VPackValueType::Custom: { case VPackValueType::Custom: {
if (options == nullptr || options->customTypeHandler == nullptr || base == nullptr) { if (options == nullptr || options->customTypeHandler == nullptr || base == nullptr) {