diff options
Diffstat (limited to 'core/fpdfapi/edit/cpdf_flateencoder.cpp')
-rw-r--r-- | core/fpdfapi/edit/cpdf_flateencoder.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/fpdfapi/edit/cpdf_flateencoder.cpp b/core/fpdfapi/edit/cpdf_flateencoder.cpp index ba04d7d938..7172bf2d7f 100644 --- a/core/fpdfapi/edit/cpdf_flateencoder.cpp +++ b/core/fpdfapi/edit/cpdf_flateencoder.cpp @@ -7,6 +7,7 @@ #include "core/fpdfapi/edit/cpdf_flateencoder.h" #include <memory> +#include <utility> #include "constants/stream_dict_common.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" @@ -40,10 +41,10 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(const CPDF_Stream* pStream, } // TODO(thestig): Move to Init() and check return value. - uint8_t* buffer = nullptr; + std::unique_ptr<uint8_t, FxFreeDeleter> buffer; ::FlateEncode(m_pAcc->GetSpan(), &buffer, &m_dwSize); - m_pData = std::unique_ptr<uint8_t, FxFreeDeleter>(buffer); + m_pData = std::move(buffer); m_pClonedDict = ToDictionary(pStream->GetDict()->Clone()); m_pClonedDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(m_dwSize)); m_pClonedDict->SetNewFor<CPDF_Name>("Filter", "FlateDecode"); |