Rename CPDF_{Byte,Wide}String::AsSpan() to span()
Makes these method names consistent between strings and string views,
so that templates may more easily be applied to both.
-- CPDF_ByteString::AsRawSpan() renamed to raw_span().
Change-Id: If957ecb99987bf70885e1cd62b837e216a60acaa
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/57950
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_interactiveform.cpp b/fpdfsdk/cpdfsdk_interactiveform.cpp
index 2fee643..67fa3e3 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.cpp
+++ b/fpdfsdk/cpdfsdk_interactiveform.cpp
@@ -101,7 +101,7 @@
name = pField->GetUnicodeTextFor("T");
ByteString name_b = name.ToDefANSI();
ByteString csBValue = pField->GetStringFor("V");
- WideString csWValue = PDF_DecodeText(csBValue.AsRawSpan());
+ WideString csWValue = PDF_DecodeText(csBValue.raw_span());
ByteString csValue_b = csWValue.ToDefANSI();
fdfEncodedData << name_b << "=" << csValue_b;
if (i != pFields->size() - 1)
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
index 3bca040..1274b4a 100644
--- a/fpdfsdk/fpdf_annot.cpp
+++ b/fpdfsdk/fpdf_annot.cpp
@@ -774,7 +774,7 @@
ByteString newValue = PDF_EncodeText(WideStringFromFPDFWideString(value));
auto* pNewApStream = pApDict->SetNewFor<CPDF_Stream>(modeKey);
- pNewApStream->SetData(newValue.AsRawSpan());
+ pNewApStream->SetData(newValue.raw_span());
} else {
if (pApDict) {
if (appearanceMode == FPDF_ANNOT_APPEARANCEMODE_NORMAL)
diff --git a/fpdfsdk/fpdf_attachment.cpp b/fpdfsdk/fpdf_attachment.cpp
index 937b504..8617a98 100644
--- a/fpdfsdk/fpdf_attachment.cpp
+++ b/fpdfsdk/fpdf_attachment.cpp
@@ -32,7 +32,7 @@
ByteString CFXByteStringHexDecode(const ByteString& bsHex) {
std::unique_ptr<uint8_t, FxFreeDeleter> result;
uint32_t size = 0;
- HexDecode(bsHex.AsRawSpan(), &result, &size);
+ HexDecode(bsHex.raw_span(), &result, &size);
return ByteString(result.get(), size);
}
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index 470869b..d1a6db7 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -178,7 +178,7 @@
const ByteString& contents) {
CPDF_Stream* pNewContents = pDocument->NewIndirect<CPDF_Stream>(
nullptr, 0, pDocument->New<CPDF_Dictionary>());
- pNewContents->SetData(contents.AsRawSpan());
+ pNewContents->SetData(contents.raw_span());
return pNewContents;
}
@@ -213,7 +213,7 @@
sStream += ByteString(pAcc->GetSpan());
sStream += "\nQ";
}
- pContentsStream->SetDataAndRemoveFilter(sStream.AsRawSpan());
+ pContentsStream->SetDataAndRemoveFilter(sStream.raw_span());
pContentsArray = pDocument->NewIndirect<CPDF_Array>();
pContentsArray->AddNew<CPDF_Reference>(pDocument,
pContentsStream->GetObjNum());
@@ -413,7 +413,7 @@
ByteString str(buf);
sStream += ByteString::Format("q %s cm /%s Do Q\n", str.c_str(),
sFormName.c_str());
- pNewXObject->SetDataAndRemoveFilter(sStream.AsRawSpan());
+ pNewXObject->SetDataAndRemoveFilter(sStream.raw_span());
}
pPageDict->RemoveFor("Annots");
return FLATTEN_SUCCESS;
diff --git a/fpdfsdk/fpdf_ppo.cpp b/fpdfsdk/fpdf_ppo.cpp
index 113d501..e8261a2 100644
--- a/fpdfsdk/fpdf_ppo.cpp
+++ b/fpdfsdk/fpdf_ppo.cpp
@@ -696,7 +696,7 @@
pAcc->LoadAllDataFiltered();
bsSrcContentStream = ByteString(pAcc->GetData(), pAcc->GetSize());
}
- pNewXObject->SetDataAndRemoveFilter(bsSrcContentStream.AsRawSpan());
+ pNewXObject->SetDataAndRemoveFilter(bsSrcContentStream.raw_span());
}
// TODO(xlou): A better name schema to avoid possible object name collision.
@@ -727,7 +727,7 @@
auto pDict = dest()->New<CPDF_Dictionary>();
CPDF_Stream* pStream =
dest()->NewIndirect<CPDF_Stream>(nullptr, 0, std::move(pDict));
- pStream->SetData(bsContent.AsRawSpan());
+ pStream->SetData(bsContent.raw_span());
pDestPageDict->SetNewFor<CPDF_Reference>(pdfium::page_object::kContents,
dest(), pStream->GetObjNum());
}
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp
index c7f4ff7..261b274 100644
--- a/fpdfsdk/pwl/cpwl_appstream.cpp
+++ b/fpdfsdk/pwl/cpwl_appstream.cpp
@@ -1937,7 +1937,7 @@
}
pStreamDict->SetMatrixFor("Matrix", widget_->GetMatrix());
pStreamDict->SetRectFor("BBox", widget_->GetRotatedRect());
- pStream->SetDataAndRemoveFilter(sContents.AsRawSpan());
+ pStream->SetDataAndRemoveFilter(sContents.raw_span());
}
void CPWL_AppStream::Remove(const ByteString& sAPType) {