Commit f4e4be63 authored by Feng Xiao's avatar Feng Xiao

Merge pull request #1011 from c0nk/wip-implicit-cast-fix

Fix some narrowing implicit casts [NFC]
parents d3cb5f40 a52539a3
...@@ -1035,7 +1035,7 @@ inline const uint8* CodedInputStream::ExpectTagFromArray( ...@@ -1035,7 +1035,7 @@ inline const uint8* CodedInputStream::ExpectTagFromArray(
inline void CodedInputStream::GetDirectBufferPointerInline(const void** data, inline void CodedInputStream::GetDirectBufferPointerInline(const void** data,
int* size) { int* size) {
*data = buffer_; *data = buffer_;
*size = buffer_end_ - buffer_; *size = static_cast<int>(buffer_end_ - buffer_);
} }
inline bool CodedInputStream::ExpectAtEnd() { inline bool CodedInputStream::ExpectAtEnd() {
...@@ -1231,7 +1231,7 @@ inline MessageFactory* CodedInputStream::GetExtensionFactory() { ...@@ -1231,7 +1231,7 @@ inline MessageFactory* CodedInputStream::GetExtensionFactory() {
} }
inline int CodedInputStream::BufferSize() const { inline int CodedInputStream::BufferSize() const {
return buffer_end_ - buffer_; return static_cast<int>(buffer_end_ - buffer_);
} }
inline CodedInputStream::CodedInputStream(ZeroCopyInputStream* input) inline CodedInputStream::CodedInputStream(ZeroCopyInputStream* input)
......
...@@ -835,12 +835,14 @@ inline int WireFormatLite::EnumSize(int value) { ...@@ -835,12 +835,14 @@ inline int WireFormatLite::EnumSize(int value) {
} }
inline int WireFormatLite::StringSize(const string& value) { inline int WireFormatLite::StringSize(const string& value) {
return io::CodedOutputStream::VarintSize32(value.size()) + return static_cast<int>(
value.size(); io::CodedOutputStream::VarintSize32(static_cast<uint32>(value.size())) +
value.size());
} }
inline int WireFormatLite::BytesSize(const string& value) { inline int WireFormatLite::BytesSize(const string& value) {
return io::CodedOutputStream::VarintSize32(value.size()) + return static_cast<int>(
value.size(); io::CodedOutputStream::VarintSize32(static_cast<uint32>(value.size())) +
value.size());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment