From a52539a32dd5e84203c8392c635a2602d8672420 Mon Sep 17 00:00:00 2001 From: Kal Conley Date: Sat, 28 Nov 2015 11:49:51 -0800 Subject: Fix some narrowing implicit casts [NFC] --- src/google/protobuf/io/coded_stream.h | 4 ++-- src/google/protobuf/wire_format_lite_inl.h | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 361c406b..cb1869a7 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -1035,7 +1035,7 @@ inline const uint8* CodedInputStream::ExpectTagFromArray( inline void CodedInputStream::GetDirectBufferPointerInline(const void** data, int* size) { *data = buffer_; - *size = buffer_end_ - buffer_; + *size = static_cast(buffer_end_ - buffer_); } inline bool CodedInputStream::ExpectAtEnd() { @@ -1231,7 +1231,7 @@ inline MessageFactory* CodedInputStream::GetExtensionFactory() { } inline int CodedInputStream::BufferSize() const { - return buffer_end_ - buffer_; + return static_cast(buffer_end_ - buffer_); } inline CodedInputStream::CodedInputStream(ZeroCopyInputStream* input) diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h index 991c3d04..b1c477d1 100644 --- a/src/google/protobuf/wire_format_lite_inl.h +++ b/src/google/protobuf/wire_format_lite_inl.h @@ -835,12 +835,14 @@ inline int WireFormatLite::EnumSize(int value) { } inline int WireFormatLite::StringSize(const string& value) { - return io::CodedOutputStream::VarintSize32(value.size()) + - value.size(); + return static_cast( + io::CodedOutputStream::VarintSize32(static_cast(value.size())) + + value.size()); } inline int WireFormatLite::BytesSize(const string& value) { - return io::CodedOutputStream::VarintSize32(value.size()) + - value.size(); + return static_cast( + io::CodedOutputStream::VarintSize32(static_cast(value.size())) + + value.size()); } -- cgit v1.2.3