From a6d98fb0670260fa9c6a18d216b4ebda807a5b36 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Wed, 15 Feb 2017 17:40:24 -0800 Subject: [PATCH] Fixed VS x64 warnings in flexbuffers.h --- include/flatbuffers/flexbuffers.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index bd2be0def..6c3012c3e 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -85,7 +85,7 @@ inline bool IsFixedTypedVector(Type t) { return t >= TYPE_VECTOR_INT2 && t <= TYPE_VECTOR_FLOAT4; } -inline Type ToTypedVector(Type t, int fixed_len = 0) { +inline Type ToTypedVector(Type t, size_t fixed_len = 0) { assert(IsTypedVectorElementType(t)); switch (fixed_len) { case 0: return static_cast(t - TYPE_INT + TYPE_VECTOR_INT); @@ -601,7 +601,7 @@ class Reference { template bool Mutate(const uint8_t *dest, T t, size_t byte_width, BitWidth value_width) { - auto fits = (1U << value_width) <= byte_width; + auto fits = static_cast(1U << value_width) <= byte_width; if (fits) { t = flatbuffers::EndianScalar(t); memcpy(const_cast(dest), &t, byte_width); @@ -1082,7 +1082,7 @@ class Builder FLATBUFFERS_FINAL_CLASS { } // For values T >= byte_width - template void Write(T val, uint8_t byte_width) { + template void Write(T val, size_t byte_width) { val = flatbuffers::EndianScalar(val); WriteBytes(&val, byte_width); } @@ -1176,7 +1176,8 @@ class Builder FLATBUFFERS_FINAL_CLASS { auto offset = offset_loc - u_; // Does it fit? auto bit_width = WidthU(offset); - if (1U << bit_width == byte_width) return bit_width; + if (static_cast(1U << bit_width) == byte_width) + return bit_width; } assert(false); // Must match one of the sizes above. return BIT_WIDTH_64;