Fixed warnings generated by recent JSON sorting feature.

Change-Id: I6fd6283b616c7a39bb878b1610e4ddf6e208fa0a
This commit is contained in:
Wouter van Oortmerssen
2019-10-17 15:16:00 -07:00
parent 5665cfe492
commit df3e8bf4a7
2 changed files with 4 additions and 3 deletions

View File

@@ -1257,7 +1257,7 @@ CheckedError Parser::ParseVectorDelimiters(uoffset_t &count, F body) {
return NoError(); return NoError();
} }
static int CompareType(const uint8_t *a, const uint8_t *b, BaseType ftype) { static bool CompareType(const uint8_t *a, const uint8_t *b, BaseType ftype) {
switch (ftype) { switch (ftype) {
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \ #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \
PTYPE, RTYPE, KTYPE) \ PTYPE, RTYPE, KTYPE) \
@@ -1394,8 +1394,9 @@ CheckedError Parser::ParseVector(const Type &type, uoffset_t *ovalue,
// stored in memory, so compute the distance between these pointers: // stored in memory, so compute the distance between these pointers:
ptrdiff_t diff = (b - a) * sizeof(Offset<Table>); ptrdiff_t diff = (b - a) * sizeof(Offset<Table>);
assert(diff >= 0); // Guaranteed by SimpleQsort. assert(diff >= 0); // Guaranteed by SimpleQsort.
a->o = EndianScalar(ReadScalar<uoffset_t>(a) - diff); auto udiff = static_cast<uoffset_t>(diff);
b->o = EndianScalar(ReadScalar<uoffset_t>(b) + diff); a->o = EndianScalar(ReadScalar<uoffset_t>(a) - udiff);
b->o = EndianScalar(ReadScalar<uoffset_t>(b) + udiff);
std::swap(*a, *b); std::swap(*a, *b);
}); });
} }

Binary file not shown.