Skip to content

Commit

Permalink
Replace 'assert' by 'FLATBUFFERS_ASSERT' inside idl_parser.cpp (googl…
Browse files Browse the repository at this point in the history
  • Loading branch information
vglavnyy authored Mar 12, 2020
1 parent 35abb7f commit d10c163
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/idl_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d10c163

Please sign in to comment.