summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_flatten.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-23 23:52:53 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-23 23:52:53 +0000
commit367ed462b51799c008795b19e886ccbed221b9be (patch)
tree3c94f25900ec5617954dbfd3e615e6a4751ddfcd /fpdfsdk/fpdf_flatten.cpp
parentc1dde5d9b3da2af6e6f81df09ed41ab9c34bbde4 (diff)
downloadpdfium-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_flatten.cpp')
-rw-r--r--fpdfsdk/fpdf_flatten.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index b9e29be8b4..7ea49cfddf 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -176,7 +176,7 @@ CPDF_Object* NewIndirectContentsStream(const ByteString& key,
pdfium::MakeUnique<CPDF_Dictionary>(pDocument->GetByteStringPool()));
ByteString sStream =
ByteString::Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
- pNewContents->SetData(sStream.raw_str(), sStream.GetLength());
+ pNewContents->SetData(sStream.AsRawSpan());
return pNewContents;
}
@@ -205,8 +205,7 @@ void SetPageContents(const ByteString& key,
ByteString sStream = "q\n";
ByteString sBody = ByteString(pAcc->GetData(), pAcc->GetSize());
sStream = sStream + sBody + "\nQ";
- pContentsStream->SetDataAndRemoveFilter(sStream.raw_str(),
- sStream.GetLength());
+ pContentsStream->SetDataAndRemoveFilter(sStream.AsRawSpan());
pContentsArray->Add(pContentsStream->MakeReference(pDocument));
pPage->SetFor(pdfium::page_object::kContents,
pContentsArray->MakeReference(pDocument));
@@ -394,7 +393,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CFX_Matrix m = GetMatrix(rcAnnot, rcStream, matrix);
sStream += ByteString::Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d,
m.e, m.f, sFormName.c_str());
- pNewXObject->SetDataAndRemoveFilter(sStream.raw_str(), sStream.GetLength());
+ pNewXObject->SetDataAndRemoveFilter(sStream.AsRawSpan());
}
pPageDict->RemoveFor("Annots");
return FLATTEN_SUCCESS;