Skip to content

Commit bf91354

Browse files
siilikejsteemann
andauthored
Apply suggestions from code review
Fix first issues Co-Authored-By: Jan <jsteemann@users.noreply.github.com>
1 parent c6b9b74 commit bf91354

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

VelocyPack.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,13 +581,13 @@ Essentially this is object-relational mapping for parts of documents.
581581
The format of the type is:
582582

583583
0xee
584-
TAG in 1 byte
584+
TAG number in 1 byte
585585
sub VPack value
586586

587587
or
588588

589589
0xef
590-
TAG in 8 bytes
590+
TAG number in 8 bytes, little-endian encoding
591591
sub VPack value
592592

593593

include/velocypack/Builder.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -316,67 +316,67 @@ class Builder {
316316
}
317317

318318
// Add a subvalue into an object from a Value:
319-
inline uint8_t* addTagged(std::string const& attrName, int64_t tag, Value const& sub) {
319+
inline uint8_t* addTagged(std::string const& attrName, uint64_t tag, Value const& sub) {
320320
return addInternal<Value>(attrName, tag, sub);
321321
}
322-
inline uint8_t* addTagged(StringRef const& attrName, int64_t tag, Value const& sub) {
322+
inline uint8_t* addTagged(StringRef const& attrName, uint64_t tag, Value const& sub) {
323323
return addInternal<Value>(attrName, tag, sub);
324324
}
325-
inline uint8_t* addTagged(char const* attrName, int64_t tag, Value const& sub) {
325+
inline uint8_t* addTagged(char const* attrName, uint64_t tag, Value const& sub) {
326326
return addInternal<Value>(attrName, tag, sub);
327327
}
328-
inline uint8_t* addTagged(char const* attrName, size_t attrLength, int64_t tag, Value const& sub) {
328+
inline uint8_t* addTagged(char const* attrName, std::size_t attrLength, uint64_t tag, Value const& sub) {
329329
return addInternal<Value>(attrName, attrLength, tag, sub);
330330
}
331331

332332
// Add a subvalue into an object from a Slice:
333-
inline uint8_t* addTagged(std::string const& attrName, int64_t tag, Slice const& sub) {
333+
inline uint8_t* addTagged(std::string const& attrName, uint64_t tag, Slice const& sub) {
334334
return addInternal<Slice>(attrName, tag, sub);
335335
}
336-
inline uint8_t* addTagged(StringRef const& attrName, int64_t tag, Slice const& sub) {
336+
inline uint8_t* addTagged(StringRef const& attrName, uint64_t tag, Slice const& sub) {
337337
return addInternal<Slice>(attrName, tag, sub);
338338
}
339-
inline uint8_t* addTagged(char const* attrName, int64_t tag, Slice const& sub) {
339+
inline uint8_t* addTagged(char const* attrName, uint64_t tag, Slice const& sub) {
340340
return addInternal<Slice>(attrName, tag, sub);
341341
}
342-
inline uint8_t* addTagged(char const* attrName, size_t attrLength, int64_t tag, Slice const& sub) {
342+
inline uint8_t* addTagged(char const* attrName, std::size_t attrLength, uint64_t tag, Slice const& sub) {
343343
return addInternal<Slice>(attrName, attrLength, tag, sub);
344344
}
345345

346346
// Add a subvalue into an object from a ValuePair:
347-
inline uint8_t* addTagged(std::string const& attrName, int64_t tag, ValuePair const& sub) {
347+
inline uint8_t* addTagged(std::string const& attrName, uint64_t tag, ValuePair const& sub) {
348348
return addInternal<ValuePair>(attrName, tag, sub);
349349
}
350-
inline uint8_t* addTagged(StringRef const& attrName, int64_t tag, ValuePair const& sub) {
350+
inline uint8_t* addTagged(StringRef const& attrName, uint64_t tag, ValuePair const& sub) {
351351
return addInternal<ValuePair>(attrName, tag, sub);
352352
}
353-
inline uint8_t* addTagged(char const* attrName, int64_t tag, ValuePair const& sub) {
353+
inline uint8_t* addTagged(char const* attrName, uint64_t tag, ValuePair const& sub) {
354354
return addInternal<ValuePair>(attrName, tag, sub);
355355
}
356-
inline uint8_t* addTagged(char const* attrName, size_t attrLength, int64_t tag, ValuePair const& sub) {
356+
inline uint8_t* addTagged(char const* attrName, std::size_t attrLength, uint64_t tag, ValuePair const& sub) {
357357
return addInternal<ValuePair>(attrName, attrLength, tag, sub);
358358
}
359-
inline uint8_t* addTagged(char const* attrName, size_t attrLength, int64_t tag, Serialize const& sub) {
359+
inline uint8_t* addTagged(char const* attrName, std::size_t attrLength, uint64_t tag, Serialize const& sub) {
360360
return addInternal<Serializable>(attrName, attrLength, tag, sub._sable);
361361
}
362362

363363
// Add a subvalue into an array from a Value:
364-
inline uint8_t* addTagged(int64_t tag, Value const& sub) {
364+
inline uint8_t* addTagged(uint64_t tag, Value const& sub) {
365365
return addInternal<Value>(tag, sub);
366366
}
367367

368368
// Add a slice to an array
369-
inline uint8_t* addTagged(int64_t tag, Slice const& sub) {
369+
inline uint8_t* addTagged(uint64_t tag, Slice const& sub) {
370370
return addInternal<Slice>(tag, sub);
371371
}
372372

373373
// Add a subvalue into an array from a ValuePair:
374-
inline uint8_t* addTagged(int64_t tag, ValuePair const& sub) {
374+
inline uint8_t* addTagged(uint64_t tag, ValuePair const& sub) {
375375
return addInternal<ValuePair>(tag, sub);
376376
}
377377

378378
// Add a subvalue into an array from a Serialize:
379-
inline uint8_t* addTagged(int64_t tag, Serialize const& sub) {
379+
inline uint8_t* addTagged(uint64_t tag, Serialize const& sub) {
380380
return addInternal<Serializable>(tag, sub._sable);
381381
}
382382

include/velocypack/Slice.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ class Slice {
117117
// creates a slice of type MaxKey
118118
static constexpr Slice maxKeySlice() noexcept { return Slice(maxKeySliceData); }
119119

120-
int64_t getTagId() const {
120+
uint64_t getTagId() const {
121121
if(isTagged()) {
122122
if(*_start == 0xee) {
123-
return readIntegerFixed<ValueLength, 1>(_start + 1);
123+
return readIntegerFixed<uint64_t, 1>(_start + 1);
124124
} else if(*_start == 0xef) {
125-
return readIntegerFixed<ValueLength, 8>(_start + 1);
125+
return readIntegerFixed<uint64_t, 8>(_start + 1);
126126
} else {
127127
throw new Exception(Exception::InternalError, "Invalid tag type ID");
128128
}
@@ -219,12 +219,12 @@ class Slice {
219219
return VELOCYPACK_HASH(start(), static_cast<std::size_t>(stringSliceLength()), seed);
220220
}
221221

222-
// check if slice is of the specified type (excluding tags)
222+
// check if slice is of the specified type (including tags)
223223
constexpr inline bool isType(ValueType t) const noexcept {
224224
return SliceStaticData::TypeMap[*start()] == t;
225225
}
226226

227-
// check if slice is of the specified type (including tags)
227+
// check if slice is of the specified type (excluding tags)
228228
constexpr inline bool isRawType(ValueType t) const noexcept {
229229
return SliceStaticData::TypeMap[*rawStart()] == t;
230230
}
@@ -802,12 +802,12 @@ class Slice {
802802
return out;
803803
}
804804

805-
// get the total byte size for the slice, including the head byte, excluding tags
805+
// get the total byte size for the slice, including the head byte, including tags
806806
ValueLength byteSize() const {
807807
return byteSize(start());
808808
}
809809

810-
// get the total byte size for the slice, including the head byte, including tags
810+
// get the total byte size for the slice, including the head byte, excluding tags
811811
ValueLength rawByteSize() const {
812812
return byteSize(rawStart());
813813
}

include/velocypack/velocypack-common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
#ifdef VELOCYPACK_XXHASH
9595
// forward for XXH64 function declared elsewhere
9696
extern "C" unsigned long long XXH64(void const*, std::size_t, unsigned long long);
97-
extern "C" unsigned int XXH32(const void* input, size_t len, unsigned int seed);
97+
extern "C" unsigned int XXH32(void const* input, std::size_t len, unsigned int seed);
9898

9999
#define VELOCYPACK_HASH(mem, size, seed) XXH64(mem, size, seed)
100100
#define VELOCYPACK_HASH32(mem, size, seed) XXH32(mem, size, seed)

src/Collection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ bool Collection::contains(Slice const& slice, Slice const& other) {
140140
}
141141

142142
bool Collection::containsObject(Slice const& slice, Slice const& other) {
143-
ObjectIterator it(other);
143+
ObjectIterator it(other, true);
144144

145145
while (it.valid()) {
146146
Slice v = slice.get(it.key(true).stringRef());

0 commit comments

Comments
 (0)