diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-12-04 16:57:06 -0800 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-12-07 17:59:32 -0800 |
commit | 5b155e56746d50e0f6db1492c448d783db9dcdac (patch) | |
tree | ea7b5511d1ac95cb8eccb67adf2efa0f262fcc09 | |
parent | 52b0f6c371ce184bf9dfe4ac635f95b48b32ea53 (diff) |
more win x64 fixes
-rw-r--r-- | include/grpc++/impl/rpc_service_method.h | 6 | ||||
-rw-r--r-- | src/cpp/proto/proto_utils.cc | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index fcb0b7ccce..9d30d9627c 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -251,7 +251,11 @@ class RpcService { void AddMethod(RpcServiceMethod* method) { methods_.emplace_back(method); } RpcServiceMethod* GetMethod(int i) { return methods_[i].get(); } - int GetMethodCount() const { return methods_.size(); } + int GetMethodCount() const { + // On win x64, int is only 32bit + GPR_ASSERT(methods_.size() <= INT_MAX); + return (int)methods_.size(); + } private: std::vector<std::unique_ptr<RpcServiceMethod>> methods_; diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index b1330fde7f..0a05f29222 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -70,7 +70,9 @@ class GrpcBufferWriter GRPC_FINAL slice_ = gpr_slice_malloc(block_size_); } *data = GPR_SLICE_START_PTR(slice_); - byte_count_ += * size = GPR_SLICE_LENGTH(slice_); + // On win x64, int is only 32bit + GPR_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX); + byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_); gpr_slice_buffer_add(slice_buffer_, slice_); return true; } @@ -124,7 +126,9 @@ class GrpcBufferReader GRPC_FINAL } gpr_slice_unref(slice_); *data = GPR_SLICE_START_PTR(slice_); - byte_count_ += * size = GPR_SLICE_LENGTH(slice_); + // On win x64, int is only 32bit + GPR_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX); + byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_); return true; } |