diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-23 23:52:53 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-23 23:52:53 +0000 |
commit | 367ed462b51799c008795b19e886ccbed221b9be (patch) | |
tree | 3c94f25900ec5617954dbfd3e615e6a4751ddfcd /fpdfsdk/fpdf_ppo.cpp | |
parent | c1dde5d9b3da2af6e6f81df09ed41ab9c34bbde4 (diff) | |
download | pdfium-367ed462b51799c008795b19e886ccbed221b9be.tar.xz |
Use pdfium::span<> in CPDF_Stream::SetData().
Conversion to span makes this more elegant in a number of places,
owing to std::vector directly converting to span, and the bytestring's
ToRawSpan().
Disambiguate single-argument forms to allow passing {} as
an argument.
Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2
Reviewed-on: https://pdfium-review.googlesource.com/41272
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_ppo.cpp')
-rw-r--r-- | fpdfsdk/fpdf_ppo.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fpdfsdk/fpdf_ppo.cpp b/fpdfsdk/fpdf_ppo.cpp index 722070547f..3c99304a98 100644 --- a/fpdfsdk/fpdf_ppo.cpp +++ b/fpdfsdk/fpdf_ppo.cpp @@ -715,17 +715,14 @@ uint32_t CPDF_NPageToOneExporter::MakeXObject( bsSrcContentStream += bsStream; bsSrcContentStream += "\n"; } - pNewXObject->SetDataAndRemoveFilter(bsSrcContentStream.raw_str(), - bsSrcContentStream.GetLength()); + pNewXObject->SetDataAndRemoveFilter(bsSrcContentStream.AsRawSpan()); } else { const CPDF_Stream* pStream = pSrcContentObj->AsStream(); auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream); pAcc->LoadAllDataFiltered(); ByteString bsStream(pAcc->GetData(), pAcc->GetSize()); - pNewXObject->SetDataAndRemoveFilter(bsStream.raw_str(), - bsStream.GetLength()); + pNewXObject->SetDataAndRemoveFilter(bsStream.AsRawSpan()); } - return pNewXObject->GetObjNum(); } @@ -752,7 +749,7 @@ void CPDF_NPageToOneExporter::FinishPage( auto pDict = pdfium::MakeUnique<CPDF_Dictionary>(dest()->GetByteStringPool()); CPDF_Stream* pStream = dest()->NewIndirect<CPDF_Stream>(nullptr, 0, std::move(pDict)); - pStream->SetData(bsContent.raw_str(), bsContent.GetLength()); + pStream->SetData(bsContent.AsRawSpan()); pDestPageDict->SetFor(pdfium::page_object::kContents, pStream->MakeReference(dest())); } |