Skip to content

Commit

Permalink
fix warning on mac clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Andersbakken committed Sep 21, 2020
1 parent c0637f2 commit 9ad2ff1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/FileMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,15 @@ class FileMap
if (uint32_t size = FixedSize<Key>::value) {
valuesOffset = ((static_cast<uint32_t>(map.size()) * size) + (sizeof(uint32_t) * 2));
serializer << valuesOffset;
for (const std::pair<Key, Value> &pair : map) {
for (const auto &pair : map) {
out.append(reinterpret_cast<const char*>(&pair.first), size);
}
} else {
serializer << static_cast<uint32_t>(0); // values offset
uint32_t offset = sizeof(uint32_t) * 2 + (map.size() * sizeof(uint32_t));
String keyData;
Serializer keySerializer(keyData);
for (const std::pair<Key, Value> &pair : map) {
for (const auto &pair : map) {
const uint32_t pos = offset + keyData.size();
out.append(reinterpret_cast<const char*>(&pos), sizeof(pos));
keySerializer << pair.first;
Expand All @@ -259,14 +259,14 @@ class FileMap
assert(valuesOffset == static_cast<uint32_t>(out.size()));

if (uint32_t size = FixedSize<Value>::value) {
for (const std::pair<Key, Value> &pair : map) {
for (const auto &pair : map) {
out.append(reinterpret_cast<const char*>(&pair.second), size);
}
} else {
const uint32_t encodedValuesOffset = valuesOffset + (sizeof(uint32_t) * map.size());
String valueData;
Serializer valueSerializer(valueData);
for (const std::pair<Key, Value> &pair : map) {
for (const auto &pair : map) {
const uint32_t pos = encodedValuesOffset + valueData.size();
out.append(reinterpret_cast<const char*>(&pos), sizeof(pos));
valueSerializer << pair.second;
Expand Down

0 comments on commit 9ad2ff1

Please sign in to comment.