1
0
Fork 0

updated vpack library

This commit is contained in:
jsteemann 2016-05-02 13:49:28 +02:00
parent 14bd7bbe72
commit 0038ccefb0
2 changed files with 15 additions and 17 deletions

View File

@ -732,7 +732,21 @@ class Slice {
bool isEqualString(std::string const& attribute) const;
// check if two Slices are equal on the binary level
bool equals(Slice const& other) const;
bool equals(Slice const& other) const {
if (head() != other.head()) {
return false;
}
ValueLength const size = byteSize();
if (size != other.byteSize()) {
return false;
}
return (memcmp(start(), other.start(),
arangodb::velocypack::checkOverflow(size)) == 0);
}
bool operator==(Slice const& other) const { return equals(other); }
bool operator!=(Slice const& other) const { return !equals(other); }

View File

@ -390,22 +390,6 @@ Slice Slice::translateUnchecked() const {
return Slice();
}
// check if two Slices are equal on the binary level
bool Slice::equals(Slice const& other) const {
if (head() != other.head()) {
return false;
}
ValueLength const size = byteSize();
if (size != other.byteSize()) {
return false;
}
return (memcmp(start(), other.start(),
arangodb::velocypack::checkOverflow(size)) == 0);
}
std::string Slice::toJson(Options const* options) const {
std::string buffer;
StringSink sink(&buffer);