Thrift: Update the interface for TTransport's "borrow" method.
authorDavid Reiss <dreiss@apache.org>
Sat, 2 Feb 2008 00:54:48 +0000 (00:54 +0000)
committerDavid Reiss <dreiss@apache.org>
Sat, 2 Feb 2008 00:54:48 +0000 (00:54 +0000)
commitd46eb09befca3e43b01a00476611c7a0c0fc0254
treedfd7091441c87b5a760c56a6bcc2cd9e0789c931
parent84e5022bfc9a815ce5f14e6effd980c6672da872
Thrift: Update the interface for TTransport's "borrow" method.

Summary:
I don't know what I was thinking when I first wrote this.
It makes sense that the transport might not want to allocate its own memory,
so the protocol is expected to provide a buffer for the data.
However, if the transport already has the data buffered,
there is no need to memcpy it; it can just return a pointer into its buffer.
The new interface still requires the protocol to provide a buffer,
but allows the transport to return a pointer to an interal buffer.
In addition, I made len a pass-by-pointer parameter so that
the transport can return more than the requested data if it has it
available in its buffers.

Reviewed By: mcslee

Test Plan: Ran the DenseProtocol test and the Zlib test.

Revert Plan: ok

Other Notes:
Also got this reviewed by Chad Walters from Powerset.
Ben Maurer suggested making len a reference parameter.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665454 13f79535-47bb-0310-9956-ffa450edef68
lib/cpp/src/protocol/TDenseProtocol.cpp
lib/cpp/src/transport/TTransport.h
lib/cpp/src/transport/TTransportUtils.cpp
lib/cpp/src/transport/TTransportUtils.h
lib/cpp/src/transport/TZlibTransport.cpp
lib/cpp/src/transport/TZlibTransport.h