Open zonque opened 6 years ago
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here (e.g. I signed it!
) and we'll verify it.
I signed it!
CLAs look good, thanks!
Currently, the
VCDiffStreamingDecoder
class expects applications to call into::StartDecoding()
with a dictionary, and then maintains an internal buffer (decoded_target_
) to accumulate pending output bytes. These are then written through::AppendNewOutputText()
and::FlushDecodedTarget()
.The problem with this implementation is that the allocation of this intermediate buffer may fail, which will then result in the application abort with a trap.
This patch adds an alternative interface that does not lead to internal allocation.
StartDecoding()
may now optionally be called with an output buffer and a maximum length, andDecodeChunk()
may be called without anOutputString
parameter. If operated this way, the decoder will directly write to the provided memory buffer, which can, for instance, bemmap()
ed on a block device.The old interface is kept around for full compatibility.
This should address #12.