diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc index d6ebc32db..8dfb0ee3d 100644 --- a/compiler/cpp/src/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/generate/t_cpp_generator.cc @@ -1917,8 +1917,8 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) { indent() << function_signature(*f_iter, "") << " {" << endl; indent_up(); f_header_ << - indent() << "uint32_t sz = ifaces_.size();" << endl << - indent() << "for (uint32_t i = 0; i < sz; ++i) {" << endl; + indent() << "size_t sz = ifaces_.size();" << endl << + indent() << "for (size_t i = 0; i < sz; ++i) {" << endl; if (!(*f_iter)->get_returntype()->is_void()) { f_header_ << indent() << " if (i == sz - 1) {" << endl; @@ -3622,17 +3622,17 @@ void t_cpp_generator::generate_serialize_container(ofstream& out, "xfer += oprot->writeMapBegin(" << type_to_enum(((t_map*)ttype)->get_key_type()) << ", " << type_to_enum(((t_map*)ttype)->get_val_type()) << ", " << - prefix << ".size());" << endl; + "static_cast(" << prefix << ".size()));" << endl; } else if (ttype->is_set()) { indent(out) << "xfer += oprot->writeSetBegin(" << type_to_enum(((t_set*)ttype)->get_elem_type()) << ", " << - prefix << ".size());" << endl; + "static_cast(" << prefix << ".size()));" << endl; } else if (ttype->is_list()) { indent(out) << "xfer += oprot->writeListBegin(" << type_to_enum(((t_list*)ttype)->get_elem_type()) << ", " << - prefix << ".size());" << endl; + "static_cast(" << prefix << ".size()));" << endl; } string iter = tmp("_iter"); diff --git a/lib/cpp/src/transport/TBufferTransports.h b/lib/cpp/src/transport/TBufferTransports.h index f6d52d598..92492d7e1 100644 --- a/lib/cpp/src/transport/TBufferTransports.h +++ b/lib/cpp/src/transport/TBufferTransports.h @@ -108,7 +108,7 @@ class TBufferBase : public TVirtualTransport { if (TDB_LIKELY(static_cast(*len) <= rBound_ - rBase_)) { // With strict aliasing, writing to len shouldn't force us to // refetch rBase_ from memory. TODO(dreiss): Verify this. - *len = rBound_ - rBase_; + *len = static_cast(rBound_ - rBase_); return rBase_; } return borrowSlow(buf, len); @@ -568,7 +568,7 @@ class TMemoryBuffer : public TVirtualTransport { // TODO(dreiss): Make bufPtr const. void getBuffer(uint8_t** bufPtr, uint32_t* sz) { *bufPtr = rBase_; - *sz = wBase_ - rBase_; + *sz = static_cast(wBase_ - rBase_); } std::string getBufferAsString() { @@ -656,11 +656,11 @@ class TMemoryBuffer : public TVirtualTransport { uint32_t available_read() const { // Remember, wBase_ is the real rBound_. - return wBase_ - rBase_; + return static_cast(wBase_ - rBase_); } uint32_t available_write() const { - return wBound_ - wBase_; + return static_cast(wBound_ - wBase_); } // Returns a pointer to where the client can write data to append to