mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-05 04:58:57 +00:00
Replace 'assert' by 'FLATBUFFERS_ASSERT' inside idl_parser.cpp (#5799)
This commit is contained in:
@@ -1336,7 +1336,7 @@ CheckedError Parser::ParseVector(const Type &type, uoffset_t *ovalue,
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(key);
|
||||
FLATBUFFERS_ASSERT(key);
|
||||
// Now sort it.
|
||||
// We can't use std::sort because for structs the size is not known at
|
||||
// compile time, and for tables our iterators dereference offsets, so can't
|
||||
@@ -1386,7 +1386,7 @@ CheckedError Parser::ParseVector(const Type &type, uoffset_t *ovalue,
|
||||
// These are serialized offsets, so are relative where they are
|
||||
// stored in memory, so compute the distance between these pointers:
|
||||
ptrdiff_t diff = (b - a) * sizeof(Offset<Table>);
|
||||
assert(diff >= 0); // Guaranteed by SimpleQsort.
|
||||
FLATBUFFERS_ASSERT(diff >= 0); // Guaranteed by SimpleQsort.
|
||||
auto udiff = static_cast<uoffset_t>(diff);
|
||||
a->o = EndianScalar(ReadScalar<uoffset_t>(a) - udiff);
|
||||
b->o = EndianScalar(ReadScalar<uoffset_t>(b) + udiff);
|
||||
|
||||
Reference in New Issue
Block a user