diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-04 14:37:18 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-04 21:48:48 +0000 |
commit | afd0d1f488ea55da545b3310fd8f22e45522a695 (patch) | |
tree | 89136eba4669421b6f828edb9f3d69ee558110d0 /fpdfsdk/fpdfsave.cpp | |
parent | 4f8b044b95dc282959dfe41453e2a9c1ec7e9354 (diff) | |
download | pdfium-afd0d1f488ea55da545b3310fd8f22e45522a695.tar.xz |
RefCount CPDF_StreamAcc all the time.
Pass stream argument to constructor; it feels like a
stream accessor should always be made from a stream rather
than passing one in after the fact.
Change-Id: Iaa46cb37677b81f0170f5d39bab76ad38ea4af44
Reviewed-on: https://pdfium-review.googlesource.com/3620
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfsave.cpp')
-rw-r--r-- | fpdfsdk/fpdfsave.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 6894f8c2ed..004c921a52 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -137,12 +137,10 @@ bool SaveXFADocumentData( // template if (iTemplate > -1) { CPDF_Stream* pTemplateStream = pArray->GetStreamAt(iTemplate); - CPDF_StreamAcc streamAcc; - streamAcc.LoadAllData(pTemplateStream); - uint8_t* pData = (uint8_t*)streamAcc.GetData(); - uint32_t dwSize2 = streamAcc.GetSize(); - CFX_RetainPtr<IFX_SeekableStream> pTemplate = - IFX_MemoryStream::Create(pData, dwSize2); + auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pTemplateStream); + pAcc->LoadAllData(); + CFX_RetainPtr<IFX_SeekableStream> pTemplate = IFX_MemoryStream::Create( + const_cast<uint8_t*>(pAcc->GetData()), pAcc->GetSize()); pChecksum->UpdateChecksum(pTemplate); } CPDF_Stream* pFormStream = nullptr; |