Skip to content

Commit

Permalink
remove const in Deserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
chedeti committed Aug 4, 2016
1 parent 76db7f9 commit a7ee938
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions include/grpc++/impl/codegen/thrift_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,15 @@ class ThriftSerializer {
// Deserialize the passed char array into the passed type, returns the number
// of bytes that have been consumed from the passed string.
template <typename T>
uint32_t Deserialize(const uint8_t* serialized_buffer, size_t length,
T* fields) {
uint32_t Deserialize(uint8_t* serialized_buffer, size_t length, T* fields) {
// prepare buffer if necessary
if (!prepared_) {
prepare();
}
last_deserialized_ = true;

// reset buffer transport
buffer_->resetBuffer(const_cast<uint8_t*>(serialized_buffer), length);
buffer_->resetBuffer(serialized_buffer, length);

// read the protocol version if necessary
if (serialize_version_) {
Expand Down Expand Up @@ -200,10 +199,9 @@ class ThriftSerializer {
bool serialize_version_;

void prepare() {
buffer_ = boost::make_shared<TMemoryBuffer>(*(new TMemoryBuffer()));
buffer_ = boost::make_shared<TMemoryBuffer>();
// create a protocol for the memory buffer transport
protocol_ = std::make_shared<Protocol>(*(new Protocol(buffer_)));

protocol_ = std::make_shared<Protocol>(buffer_);
prepared_ = true;
}

Expand Down

0 comments on commit a7ee938

Please sign in to comment.