From b188fde27eeb2093ce8c5198de3eb46ee1eedabb Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Fri, 6 Jul 2018 12:30:43 -0700 Subject: [PATCH] Fixed Uint() method actually storing a signed int. Also fixed two constructors missing explicit. Change-Id: I147b2d2517bb660d92d4b0167992c115ed65dca7 --- include/flatbuffers/flexbuffers.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index 137d8a594..d7a0ef048 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -879,7 +879,7 @@ class Builder FLATBUFFERS_FINAL_CLASS { void UInt(uint64_t u) { stack_.push_back(Value(u, FBT_UINT, WidthU(u))); } void UInt(const char *key, uint64_t u) { Key(key); - Int(u); + UInt(u); } void Float(float f) { stack_.push_back(Value(f)); } @@ -1483,7 +1483,7 @@ class Builder FLATBUFFERS_FINAL_CLASS { BitWidth force_min_bit_width_; struct KeyOffsetCompare { - KeyOffsetCompare(const std::vector &buf) : buf_(&buf) {} + explicit KeyOffsetCompare(const std::vector &buf) : buf_(&buf) {} bool operator()(size_t a, size_t b) const { auto stra = reinterpret_cast(flatbuffers::vector_data(*buf_) + a); @@ -1496,7 +1496,7 @@ class Builder FLATBUFFERS_FINAL_CLASS { typedef std::pair StringOffset; struct StringOffsetCompare { - StringOffsetCompare(const std::vector &buf) : buf_(&buf) {} + explicit StringOffsetCompare(const std::vector &buf) : buf_(&buf) {} bool operator()(const StringOffset &a, const StringOffset &b) const { auto stra = reinterpret_cast( flatbuffers::vector_data(*buf_) + a.first);