mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
THRIFT-1070 C++ compiler and runtime have 32/64bit problems
Patch: Rich Salz git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1075121 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d9924984db
commit
9db5e50b42
@ -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<uint32_t>(" << 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<uint32_t>(" << 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<uint32_t>(" << prefix << ".size()));" << endl;
|
||||
}
|
||||
|
||||
string iter = tmp("_iter");
|
||||
|
@ -108,7 +108,7 @@ class TBufferBase : public TVirtualTransport<TBufferBase> {
|
||||
if (TDB_LIKELY(static_cast<ptrdiff_t>(*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<uint32_t>(rBound_ - rBase_);
|
||||
return rBase_;
|
||||
}
|
||||
return borrowSlow(buf, len);
|
||||
@ -568,7 +568,7 @@ class TMemoryBuffer : public TVirtualTransport<TMemoryBuffer, TBufferBase> {
|
||||
// TODO(dreiss): Make bufPtr const.
|
||||
void getBuffer(uint8_t** bufPtr, uint32_t* sz) {
|
||||
*bufPtr = rBase_;
|
||||
*sz = wBase_ - rBase_;
|
||||
*sz = static_cast<uint32_t>(wBase_ - rBase_);
|
||||
}
|
||||
|
||||
std::string getBufferAsString() {
|
||||
@ -656,11 +656,11 @@ class TMemoryBuffer : public TVirtualTransport<TMemoryBuffer, TBufferBase> {
|
||||
|
||||
uint32_t available_read() const {
|
||||
// Remember, wBase_ is the real rBound_.
|
||||
return wBase_ - rBase_;
|
||||
return static_cast<uint32_t>(wBase_ - rBase_);
|
||||
}
|
||||
|
||||
uint32_t available_write() const {
|
||||
return wBound_ - wBase_;
|
||||
return static_cast<uint32_t>(wBound_ - wBase_);
|
||||
}
|
||||
|
||||
// Returns a pointer to where the client can write data to append to
|
||||
|
Loading…
Reference in New Issue
Block a user