mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 16:05:44 +00:00
Fixed warnings generated by recent JSON sorting feature.
Change-Id: I6fd6283b616c7a39bb878b1610e4ddf6e208fa0a
This commit is contained in:
@@ -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.
Reference in New Issue
Block a user