diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index fca56030479..885a1075ad1 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -126,11 +126,11 @@ class WriteOptions { } private: - void SetBit(const gpr_int32 mask) { flags_ |= mask; } + void SetBit(const gpr_uint32 mask) { flags_ |= mask; } - void ClearBit(const gpr_int32 mask) { flags_ &= ~mask; } + void ClearBit(const gpr_uint32 mask) { flags_ &= ~mask; } - bool GetBit(const gpr_int32 mask) const { return flags_ & mask; } + bool GetBit(const gpr_uint32 mask) const { return (flags_ & mask) != 0; } gpr_uint32 flags_; }; diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index be84c222a0e..f47acc8f8dc 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -111,7 +112,8 @@ class GrpcBufferReader GRPC_FINAL if (backup_count_ > 0) { *data = GPR_SLICE_START_PTR(slice_) + GPR_SLICE_LENGTH(slice_) - backup_count_; - *size = backup_count_; + GPR_ASSERT(backup_count_ <= INT_MAX); + *size = (int)backup_count_; backup_count_ = 0; return true; } diff --git a/src/cpp/util/time.cc b/src/cpp/util/time.cc index b3401eb26b7..6157a37745a 100644 --- a/src/cpp/util/time.cc +++ b/src/cpp/util/time.cc @@ -57,8 +57,8 @@ void Timepoint2Timespec(const system_clock::time_point& from, return; } nanoseconds nsecs = duration_cast(deadline - secs); - to->tv_sec = secs.count(); - to->tv_nsec = nsecs.count(); + to->tv_sec = (time_t)secs.count(); + to->tv_nsec = (int)nsecs.count(); to->clock_type = GPR_CLOCK_REALTIME; } @@ -73,8 +73,8 @@ void TimepointHR2Timespec(const high_resolution_clock::time_point& from, return; } nanoseconds nsecs = duration_cast(deadline - secs); - to->tv_sec = secs.count(); - to->tv_nsec = nsecs.count(); + to->tv_sec = (time_t)secs.count(); + to->tv_nsec = (int)nsecs.count(); to->clock_type = GPR_CLOCK_REALTIME; }