diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index 93bdf6c72..37692f981 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -1257,7 +1257,7 @@ CheckedError Parser::ParseVectorDelimiters(uoffset_t &count, F body) { 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) { #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \ 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: ptrdiff_t diff = (b - a) * sizeof(Offset); assert(diff >= 0); // Guaranteed by SimpleQsort. - a->o = EndianScalar(ReadScalar(a) - diff); - b->o = EndianScalar(ReadScalar(b) + diff); + auto udiff = static_cast(diff); + a->o = EndianScalar(ReadScalar(a) - udiff); + b->o = EndianScalar(ReadScalar(b) + udiff); std::swap(*a, *b); }); } diff --git a/tests/javatest.bin b/tests/javatest.bin index 43b3766ac..804dbba6f 100644 Binary files a/tests/javatest.bin and b/tests/javatest.bin differ