Fix use of min and max when Windows.h is imported (#4411)

This commit is contained in:
Younguk Kim
2017-08-18 01:35:50 +09:00
committed by Wouter van Oortmerssen
parent 2f2e4cced4
commit 513958ea72
2 changed files with 7 additions and 7 deletions

View File

@@ -1531,7 +1531,7 @@ class FlatBufferBuilder
auto stra = reinterpret_cast<const String *>(buf_->data_at(a.o));
auto strb = reinterpret_cast<const String *>(buf_->data_at(b.o));
return strncmp(stra->c_str(), strb->c_str(),
std::min(stra->size(), strb->size()) + 1) < 0;
(std::min)(stra->size(), strb->size()) + 1) < 0;
}
const vector_downward *buf_;
};
@@ -1961,7 +1961,7 @@ inline const uint8_t *GetBufferStartFromRootPointer(const void *root) {
auto table = reinterpret_cast<const Table *>(root);
auto vtable = table->GetVTable();
// Either the vtable is before the root or after the root.
auto start = std::min(vtable, reinterpret_cast<const uint8_t *>(root));
auto start = (std::min)(vtable, reinterpret_cast<const uint8_t *>(root));
// Align to at least sizeof(uoffset_t).
start = reinterpret_cast<const uint8_t *>(
reinterpret_cast<uintptr_t>(start) & ~(sizeof(uoffset_t) - 1));