Fix ZeroCopyOutputStream:

Added a destructor that commits the last block of data
if there was no final call to BackUp.
This commit is contained in:
Vinnie Falco
2015-01-16 01:18:40 -08:00
parent 9156633baf
commit 98d4e0e1b5

View File

@@ -152,6 +152,8 @@ public:
ZeroCopyOutputStream (Streambuf& streambuf,
std::size_t blockSize);
~ZeroCopyOutputStream();
bool
Next (void** data, int* size) override;
@@ -177,6 +179,13 @@ ZeroCopyOutputStream<Streambuf>::ZeroCopyOutputStream(
{
}
template <class Streambuf>
ZeroCopyOutputStream<Streambuf>::~ZeroCopyOutputStream()
{
if (commit_ != 0)
streambuf_.commit(commit_);
}
template <class Streambuf>
bool
ZeroCopyOutputStream<Streambuf>::Next(