Skip to content

Commit

Permalink
fixed some truncations
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteemann committed Nov 25, 2015
1 parent d5e3ced commit 67eaf11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion include/velocypack/velocypack-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#ifndef VELOCYPACK_COMMON_H
#define VELOCYPACK_COMMON_H 1

#include <cstddef>
#include <cstdint>

// debug mode
Expand Down
9 changes: 5 additions & 4 deletions src/Builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,19 @@ void Builder::sortObjectIndexLong(uint8_t* objBase,
entries.clear();
#endif

entries.reserve(offsets.size());
for (ValueLength i = 0; i < offsets.size(); i++) {
size_t const n = offsets.size();
entries.reserve(n);
for (size_t i = 0; i < n; i++) {
SortEntry e;
e.offset = offsets[i];
e.nameStart = findAttrName(objBase + e.offset, e.nameSize, options);
entries.push_back(e);
}
VELOCYPACK_ASSERT(entries.size() == offsets.size());
VELOCYPACK_ASSERT(entries.size() == n);
doActualSort(entries);

// copy back the sorted offsets
for (ValueLength i = 0; i < offsets.size(); i++) {
for (size_t i = 0; i < n; i++) {
offsets[i] = entries[i].offset;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/json-to-vpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ int main(int argc, char* argv[]) {
std::unordered_map<std::string, size_t> keysFound;
buildCompressedKeys(s, keysFound);

std::vector<std::tuple<size_t, std::string, size_t>> stats;
std::vector<std::tuple<uint64_t, std::string, size_t>> stats;
size_t requiredLength = 2;
uint64_t nextId = 0;
for (auto const& it : keysFound) {
Expand Down

0 comments on commit 67eaf11

Please sign in to comment.