Rename "pDoc" instances to "doc" or "document" in //fpdfsdk and //xfa
Mass rename a common variable name to follow Google C++ style. Gemini
did most of the work, with lots of manual interventions.
Bug: 42271580
Change-Id: Ife26e7a850dafab463516add0040023916c854da
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/134310
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 2c58760..b64865d 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -63,10 +63,10 @@
}
CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment(
- CPDF_Document* pDoc,
+ CPDF_Document* doc,
FPDF_FORMFILLINFO* pFFinfo)
: info_(pFFinfo),
- cpdfdoc_(pDoc),
+ cpdfdoc_(doc),
interactive_form_filler_(
std::make_unique<CFFL_InteractiveFormFiller>(this)) {
DCHECK(cpdfdoc_);
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index 5d14d74..ce1dd0e 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -58,7 +58,7 @@
: public CFX_Timer::HandlerIface,
public CFFL_InteractiveFormFiller::CallbackIface {
public:
- CPDFSDK_FormFillEnvironment(CPDF_Document* pDoc, FPDF_FORMFILLINFO* pFFinfo);
+ CPDFSDK_FormFillEnvironment(CPDF_Document* doc, FPDF_FORMFILLINFO* pFFinfo);
~CPDFSDK_FormFillEnvironment() override;
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index 7c7bb71..e814937 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -415,8 +415,8 @@
g_unsupport_info = unsp_info;
}
-void ReportUnsupportedFeatures(const CPDF_Document* pDoc) {
- const CPDF_Dictionary* pRootDict = pDoc->GetRoot();
+void ReportUnsupportedFeatures(const CPDF_Document* doc) {
+ const CPDF_Dictionary* pRootDict = doc->GetRoot();
if (!pRootDict) {
return;
}
@@ -458,8 +458,8 @@
}
}
-void ReportUnsupportedXFA(const CPDF_Document* pDoc) {
- if (!pDoc->GetExtension() && DocHasXFA(pDoc)) {
+void ReportUnsupportedXFA(const CPDF_Document* doc) {
+ if (!doc->GetExtension() && DocHasXFA(doc)) {
RaiseUnsupportedError(FPDF_UNSP_DOC_XFAFORM);
}
}
diff --git a/fpdfsdk/cpdfsdk_helpers.h b/fpdfsdk/cpdfsdk_helpers.h
index 6231757..4e1dc08 100644
--- a/fpdfsdk/cpdfsdk_helpers.h
+++ b/fpdfsdk/cpdfsdk_helpers.h
@@ -343,8 +343,8 @@
FPDF_BOOL IsPDFSandboxPolicyEnabled(FPDF_DWORD policy);
void SetPDFUnsupportInfo(UNSUPPORT_INFO* unsp_info);
-void ReportUnsupportedFeatures(const CPDF_Document* pDoc);
-void ReportUnsupportedXFA(const CPDF_Document* pDoc);
+void ReportUnsupportedFeatures(const CPDF_Document* doc);
+void ReportUnsupportedXFA(const CPDF_Document* doc);
void CheckForUnsupportedAnnot(const CPDF_Annot* pAnnot);
void ProcessParseError(CPDF_Parser::Error err);
void SetColorFromScheme(const FPDF_COLORSCHEME* pColorScheme,
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index bac9fd0..53820b8 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -658,6 +658,6 @@
}
int CPDFSDK_PageView::GetPageIndexForStaticPDF() const {
- CPDF_Document* pDoc = form_fill_env_->GetPDFDocument();
- return pDoc->GetPageIndex(GetPDFPage()->GetDict()->GetObjNum());
+ CPDF_Document* doc = form_fill_env_->GetPDFDocument();
+ return doc->GetPageIndex(GetPDFPage()->GetDict()->GetObjNum());
}
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
index 6617ae5..08e9250 100644
--- a/fpdfsdk/fpdf_annot.cpp
+++ b/fpdfsdk/fpdf_annot.cpp
@@ -256,7 +256,7 @@
}
RetainPtr<CPDF_Dictionary> SetExtGStateInResourceDict(
- CPDF_Document* pDoc,
+ CPDF_Document* doc,
const CPDF_Dictionary* pAnnotDict,
const ByteString& sBlendMode) {
auto pGSDict =
@@ -288,7 +288,7 @@
pExtGStateDict->SetFor("GS", pGSDict);
- auto pResourceDict = pDoc->New<CPDF_Dictionary>();
+ auto pResourceDict = doc->New<CPDF_Dictionary>();
pResourceDict->SetFor("ExtGState", pExtGStateDict);
return pResourceDict;
}
@@ -1216,8 +1216,8 @@
CPDF_AnnotContext* pAnnotContext = CPDFAnnotContextFromFPDFAnnotation(annot);
- CPDF_Document* pDoc = pAnnotContext->GetPage()->GetDocument();
- if (!pDoc) {
+ CPDF_Document* doc = pAnnotContext->GetPage()->GetDocument();
+ if (!doc) {
return false;
}
@@ -1231,19 +1231,19 @@
// color.
if (pAnnotDict->KeyExist("CA") && pAnnotDict->GetFloatFor("CA") < 1.0f) {
stream_dict->SetFor("Resources", SetExtGStateInResourceDict(
- pDoc, pAnnotDict.Get(), "Normal"));
+ doc, pAnnotDict.Get(), "Normal"));
}
// SAFETY: required from caller.
ByteString new_stream_data = PDF_EncodeText(
UNSAFE_BUFFERS(WideStringFromFPDFWideString(value).AsStringView()));
- auto new_stream = pDoc->NewIndirect<CPDF_Stream>(std::move(stream_dict));
+ auto new_stream = doc->NewIndirect<CPDF_Stream>(std::move(stream_dict));
new_stream->SetData(new_stream_data.unsigned_span());
// Storing reference to indirect object in annotation's AP
if (!ap_dict) {
ap_dict = pAnnotDict->SetNewFor<CPDF_Dictionary>(pdfium::annotation::kAP);
}
- ap_dict->SetNewFor<CPDF_Reference>(mode_key, pDoc, new_stream->GetObjNum());
+ ap_dict->SetNewFor<CPDF_Reference>(mode_key, doc, new_stream->GetObjNum());
return true;
}
diff --git a/fpdfsdk/fpdf_attachment.cpp b/fpdfsdk/fpdf_attachment.cpp
index d468056..31f7c85 100644
--- a/fpdfsdk/fpdf_attachment.cpp
+++ b/fpdfsdk/fpdf_attachment.cpp
@@ -38,19 +38,19 @@
FPDF_EXPORT int FPDF_CALLCONV
FPDFDoc_GetAttachmentCount(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return 0;
}
- auto name_tree = CPDF_NameTree::Create(pDoc, "EmbeddedFiles");
+ auto name_tree = CPDF_NameTree::Create(doc, "EmbeddedFiles");
return name_tree ? pdfium::checked_cast<int>(name_tree->GetCount()) : 0;
}
FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
FPDFDoc_AddAttachment(FPDF_DOCUMENT document, FPDF_WIDESTRING name) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
@@ -60,20 +60,19 @@
return nullptr;
}
- auto name_tree =
- CPDF_NameTree::CreateWithRootNameArray(pDoc, "EmbeddedFiles");
+ auto name_tree = CPDF_NameTree::CreateWithRootNameArray(doc, "EmbeddedFiles");
if (!name_tree) {
return nullptr;
}
// Set up the basic entries in the filespec dictionary.
- auto pFile = pDoc->NewIndirect<CPDF_Dictionary>();
+ auto pFile = doc->NewIndirect<CPDF_Dictionary>();
pFile->SetNewFor<CPDF_Name>("Type", "Filespec");
pFile->SetNewFor<CPDF_String>("UF", wsName.AsStringView());
pFile->SetNewFor<CPDF_String>(pdfium::stream::kF, wsName.AsStringView());
// Add the new attachment name and filespec into the document's EmbeddedFiles.
- if (!name_tree->AddValueAndName(pFile->MakeReference(pDoc), wsName)) {
+ if (!name_tree->AddValueAndName(pFile->MakeReference(doc), wsName)) {
return nullptr;
}
@@ -83,12 +82,12 @@
FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
FPDFDoc_GetAttachment(FPDF_DOCUMENT document, int index) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc || index < 0) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc || index < 0) {
return nullptr;
}
- auto name_tree = CPDF_NameTree::Create(pDoc, "EmbeddedFiles");
+ auto name_tree = CPDF_NameTree::Create(doc, "EmbeddedFiles");
if (!name_tree || static_cast<size_t>(index) >= name_tree->GetCount()) {
return nullptr;
}
@@ -102,12 +101,12 @@
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFDoc_DeleteAttachment(FPDF_DOCUMENT document, int index) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc || index < 0) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc || index < 0) {
return false;
}
- auto name_tree = CPDF_NameTree::Create(pDoc, "EmbeddedFiles");
+ auto name_tree = CPDF_NameTree::Create(doc, "EmbeddedFiles");
if (!name_tree || static_cast<size_t>(index) >= name_tree->GetCount()) {
return false;
}
@@ -233,8 +232,8 @@
}
CPDF_Object* pFile = CPDFObjectFromFPDFAttachment(attachment);
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pFile || !pFile->IsDictionary() || !pDoc || len > INT_MAX) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!pFile || !pFile->IsDictionary() || !doc || len > INT_MAX) {
return false;
}
@@ -268,12 +267,12 @@
CPDF_String::DataType::kIsHex);
// Create the file stream and have the filespec dictionary link to it.
- auto pFileStream = pDoc->NewIndirect<CPDF_Stream>(
+ auto pFileStream = doc->NewIndirect<CPDF_Stream>(
DataVector<uint8_t>(contents_span.begin(), contents_span.end()),
std::move(pFileStreamDict));
auto pEFDict = pFile->AsMutableDictionary()->SetNewFor<CPDF_Dictionary>("EF");
- pEFDict->SetNewFor<CPDF_Reference>("F", pDoc, pFileStream->GetObjNum());
+ pEFDict->SetNewFor<CPDF_Reference>("F", doc, pFileStream->GetObjNum());
return true;
}
diff --git a/fpdfsdk/fpdf_catalog.cpp b/fpdfsdk/fpdf_catalog.cpp
index 287ba1e..abe7150 100644
--- a/fpdfsdk/fpdf_catalog.cpp
+++ b/fpdfsdk/fpdf_catalog.cpp
@@ -12,12 +12,12 @@
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFCatalog_IsTagged(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return false;
}
- const CPDF_Dictionary* pCatalog = pDoc->GetRoot();
+ const CPDF_Dictionary* pCatalog = doc->GetRoot();
if (!pCatalog) {
return false;
}
diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp
index b046494..5dc5b13 100644
--- a/fpdfsdk/fpdf_dataavail.cpp
+++ b/fpdfsdk/fpdf_dataavail.cpp
@@ -191,8 +191,8 @@
}
FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
- return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0;
+ CPDF_Document* document = CPDFDocumentFromFPDFDocument(doc);
+ return document ? document->GetParser()->GetFirstPageNo() : 0;
}
FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp
index e399bd8..7c8309c 100644
--- a/fpdfsdk/fpdf_doc.cpp
+++ b/fpdfsdk/fpdf_doc.cpp
@@ -67,15 +67,15 @@
}
CPDF_LinkList* GetLinkList(CPDF_Page* page) {
- CPDF_Document* pDoc = page->GetDocument();
- auto* pList = static_cast<CPDF_LinkList*>(pDoc->GetLinksContext());
+ CPDF_Document* doc = page->GetDocument();
+ auto* pList = static_cast<CPDF_LinkList*>(doc->GetLinksContext());
if (pList) {
return pList;
}
auto pNewList = std::make_unique<CPDF_LinkList>();
pList = pNewList.get();
- pDoc->SetLinksContext(std::move(pNewList));
+ doc->SetLinksContext(std::move(pNewList));
return pList;
}
@@ -83,11 +83,11 @@
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
- CPDF_BookmarkTree tree(pDoc);
+ CPDF_BookmarkTree tree(doc);
CPDF_Bookmark cBookmark(
pdfium::WrapRetain(CPDFDictionaryFromFPDFBookmark(bookmark)));
return FPDFBookmarkFromCPDFDictionary(
@@ -96,8 +96,8 @@
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
@@ -105,7 +105,7 @@
return nullptr;
}
- CPDF_BookmarkTree tree(pDoc);
+ CPDF_BookmarkTree tree(doc);
CPDF_Bookmark cBookmark(
pdfium::WrapRetain(CPDFDictionaryFromFPDFBookmark(bookmark)));
return FPDFBookmarkFromCPDFDictionary(
@@ -138,8 +138,8 @@
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
@@ -149,7 +149,7 @@
return nullptr;
}
- CPDF_BookmarkTree tree(pDoc);
+ CPDF_BookmarkTree tree(doc);
std::set<const CPDF_Dictionary*> visited;
return FPDFBookmarkFromCPDFDictionary(
FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict());
@@ -157,8 +157,8 @@
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
@@ -168,7 +168,7 @@
CPDF_Bookmark cBookmark(
pdfium::WrapRetain(CPDFDictionaryFromFPDFBookmark(bookmark)));
- CPDF_Dest dest = cBookmark.GetDest(pDoc);
+ CPDF_Dest dest = cBookmark.GetDest(doc);
if (dest.GetArray()) {
return FPDFDestFromCPDFArray(dest.GetArray());
}
@@ -178,7 +178,7 @@
if (!action.HasDict()) {
return nullptr;
}
- return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
+ return FPDFDestFromCPDFArray(action.GetDest(doc).GetArray());
}
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV
@@ -216,8 +216,8 @@
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
FPDF_ACTION action) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
@@ -227,7 +227,7 @@
return nullptr;
}
CPDF_Action cAction(pdfium::WrapRetain(CPDFDictionaryFromFPDFAction(action)));
- return FPDFDestFromCPDFArray(cAction.GetDest(pDoc).GetArray());
+ return FPDFDestFromCPDFArray(cAction.GetDest(doc).GetArray());
}
FPDF_EXPORT unsigned long FPDF_CALLCONV
@@ -249,8 +249,8 @@
FPDF_ACTION action,
void* buffer,
unsigned long buflen) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return 0;
}
unsigned long type = FPDFAction_GetType(action);
@@ -260,15 +260,15 @@
// SAFETY: required from caller.
auto result_span = UNSAFE_BUFFERS(SpanFromFPDFApiArgs(buffer, buflen));
CPDF_Action cAction(pdfium::WrapRetain(CPDFDictionaryFromFPDFAction(action)));
- ByteString path = cAction.GetURI(pDoc);
+ ByteString path = cAction.GetURI(doc);
fxcrt::try_spancpy(result_span, path.span_with_terminator());
return static_cast<unsigned long>(path.span_with_terminator().size());
}
FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document,
FPDF_DEST dest) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return -1;
}
@@ -277,7 +277,7 @@
}
CPDF_Dest destination(pdfium::WrapRetain(CPDFArrayFromFPDFDest(dest)));
- return destination.GetDestPageIndex(pDoc);
+ return destination.GetDestPageIndex(doc);
}
FPDF_EXPORT unsigned long FPDF_CALLCONV
@@ -370,12 +370,12 @@
if (!link) {
return nullptr;
}
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
CPDF_Link cLink(pdfium::WrapRetain(CPDFDictionaryFromFPDFLink(link)));
- FPDF_DEST dest = FPDFDestFromCPDFArray(cLink.GetDest(pDoc).GetArray());
+ FPDF_DEST dest = FPDFDestFromCPDFArray(cLink.GetDest(doc).GetArray());
if (dest) {
return dest;
}
@@ -384,7 +384,7 @@
if (!action.HasDict()) {
return nullptr;
}
- return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
+ return FPDFDestFromCPDFArray(action.GetDest(doc).GetArray());
}
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link) {
@@ -510,8 +510,8 @@
FPDF_FILEIDTYPE id_type,
void* buffer,
unsigned long buflen) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return 0;
}
@@ -520,7 +520,7 @@
return 0;
}
- RetainPtr<const CPDF_Array> pFileId = pDoc->GetFileIdentifier();
+ RetainPtr<const CPDF_Array> pFileId = doc->GetFileIdentifier();
if (!pFileId) {
return 0;
}
@@ -544,12 +544,12 @@
if (!tag) {
return 0;
}
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return 0;
}
- RetainPtr<const CPDF_Dictionary> pInfo = pDoc->GetInfo();
+ RetainPtr<const CPDF_Dictionary> pInfo = doc->GetInfo();
if (!pInfo) {
return 0;
}
diff --git a/fpdfsdk/fpdf_doc_embeddertest.cpp b/fpdfsdk/fpdf_doc_embeddertest.cpp
index ce8bac2..abeb1f9 100644
--- a/fpdfsdk/fpdf_doc_embeddertest.cpp
+++ b/fpdfsdk/fpdf_doc_embeddertest.cpp
@@ -77,7 +77,7 @@
TEST_F(FPDFDocEmbedderTest, MultipleSamePage) {
ASSERT_TRUE(OpenDocument("hello_world.pdf"));
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document());
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document());
std::set<FPDF_PAGE> unique_pages;
std::vector<ScopedFPDFPage> owned_pages(4);
@@ -87,10 +87,10 @@
}
#ifdef PDF_ENABLE_XFA
EXPECT_EQ(1u, unique_pages.size());
- EXPECT_EQ(1u, pDoc->GetParsedPageCountForTesting());
+ EXPECT_EQ(1u, doc->GetParsedPageCountForTesting());
#else // PDF_ENABLE_XFA
EXPECT_EQ(4u, unique_pages.size());
- EXPECT_EQ(4u, pDoc->GetParsedPageCountForTesting());
+ EXPECT_EQ(4u, doc->GetParsedPageCountForTesting());
#endif // PDF_ENABLE_XFA
}
diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp
index fc47f3c..80b3732 100644
--- a/fpdfsdk/fpdf_editimg.cpp
+++ b/fpdfsdk/fpdf_editimg.cpp
@@ -121,13 +121,13 @@
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
FPDFPageObj_NewImageObj(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
auto pImageObj = std::make_unique<CPDF_ImageObject>();
- pImageObj->SetImage(pdfium::MakeRetain<CPDF_Image>(pDoc));
+ pImageObj->SetImage(pdfium::MakeRetain<CPDF_Image>(doc));
// Caller takes ownership.
return FPDFPageObjectFromCPDFPageObject(pImageObj.release());
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 57acc21..dcee7bf 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -118,8 +118,8 @@
RetainPtr<CPDF_Dictionary> GetOrCreateMarkParamsDict(FPDF_DOCUMENT document,
FPDF_PAGEOBJECTMARK mark) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
@@ -131,7 +131,7 @@
RetainPtr<CPDF_Dictionary> pParams = pMarkItem->GetParam();
if (!pParams) {
- pParams = pDoc->New<CPDF_Dictionary>();
+ pParams = doc->New<CPDF_Dictionary>();
pMarkItem->SetDirectDict(pParams);
}
return pParams;
@@ -158,10 +158,10 @@
} // namespace
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument() {
- auto pDoc =
+ auto doc =
std::make_unique<CPDF_Document>(std::make_unique<CPDF_DocRenderData>(),
std::make_unique<CPDF_DocPageData>());
- pDoc->CreateNewDoc();
+ doc->CreateNewDoc();
time_t currentTime;
ByteString DateStr;
@@ -176,7 +176,7 @@
}
}
- RetainPtr<CPDF_Dictionary> pInfoDict = pDoc->GetInfo();
+ RetainPtr<CPDF_Dictionary> pInfoDict = doc->GetInfo();
if (pInfoDict) {
if (IsPDFSandboxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) {
pInfoDict->SetNewFor<CPDF_String>("CreationDate", DateStr);
@@ -184,21 +184,21 @@
pInfoDict->SetNewFor<CPDF_String>("Creator", L"PDFium");
}
- // Caller takes ownership of pDoc.
- return FPDFDocumentFromCPDFDocument(pDoc.release());
+ // Caller takes ownership of doc.
+ return FPDFDocumentFromCPDFDocument(doc.release());
}
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document,
int page_index) {
- auto* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ auto* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return;
}
- CPDF_Document::Extension* pExtension = pDoc->GetExtension();
+ CPDF_Document::Extension* pExtension = doc->GetExtension();
const uint32_t page_obj_num = pExtension ? pExtension->DeletePage(page_index)
- : pDoc->DeletePage(page_index);
- pDoc->SetPageToNullObject(page_obj_num);
+ : doc->DeletePage(page_index);
+ doc->SetPageToNullObject(page_obj_num);
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
@@ -222,13 +222,13 @@
int page_index,
double width,
double height) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
- page_index = std::clamp(page_index, 0, pDoc->GetPageCount());
- RetainPtr<CPDF_Dictionary> pPageDict(pDoc->CreateNewPage(page_index));
+ page_index = std::clamp(page_index, 0, doc->GetPageCount());
+ RetainPtr<CPDF_Dictionary> pPageDict(doc->CreateNewPage(page_index));
if (!pPageDict) {
return nullptr;
}
@@ -239,14 +239,14 @@
pPageDict->SetNewFor<CPDF_Dictionary>(pdfium::page_object::kResources);
#ifdef PDF_ENABLE_XFA
- if (pDoc->GetExtension()) {
- auto pXFAPage = pdfium::MakeRetain<CPDFXFA_Page>(pDoc, page_index);
+ if (doc->GetExtension()) {
+ auto pXFAPage = pdfium::MakeRetain<CPDFXFA_Page>(doc, page_index);
pXFAPage->LoadPDFPageFromDict(pPageDict);
return FPDFPageFromIPDFPage(pXFAPage.Leak()); // Caller takes ownership.
}
#endif // PDF_ENABLE_XFA
- auto pPage = pdfium::MakeRetain<CPDF_Page>(pDoc, pPageDict);
+ auto pPage = pdfium::MakeRetain<CPDF_Page>(doc, pPageDict);
pPage->AddPageImageCache();
pPage->ParseContent();
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index c08db23..df851a8 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -602,13 +602,13 @@
FPDFPageObj_NewTextObj(FPDF_DOCUMENT document,
FPDF_BYTESTRING font,
float font_size) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
RetainPtr<CPDF_Font> pFont =
- CPDF_Font::GetStockFont(pDoc, ByteStringView(font));
+ CPDF_Font::GetStockFont(doc, ByteStringView(font));
if (!pFont) {
return nullptr;
}
@@ -667,8 +667,8 @@
uint32_t size,
int font_type,
FPDF_BOOL cid) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc || !data || size == 0 ||
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc || !data || size == 0 ||
(font_type != FPDF_FONT_TYPE1 && font_type != FPDF_FONT_TRUETYPE)) {
return nullptr;
}
@@ -685,20 +685,20 @@
// Caller takes ownership.
return FPDFFontFromCPDFFont(
- cid ? LoadCompositeFont(pDoc, std::move(pFont), span, font_type).Leak()
- : LoadSimpleFont(pDoc, std::move(pFont), span, font_type).Leak());
+ cid ? LoadCompositeFont(doc, std::move(pFont), span, font_type).Leak()
+ : LoadSimpleFont(doc, std::move(pFont), span, font_type).Leak());
}
FPDF_EXPORT FPDF_FONT FPDF_CALLCONV
FPDFText_LoadStandardFont(FPDF_DOCUMENT document, FPDF_BYTESTRING font) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
// Caller takes ownership.
return FPDFFontFromCPDFFont(
- CPDF_Font::GetStockFont(pDoc, ByteStringView(font)).Leak());
+ CPDF_Font::GetStockFont(doc, ByteStringView(font)).Leak());
}
FPDF_EXPORT FPDF_FONT FPDF_CALLCONV
@@ -860,15 +860,15 @@
FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
FPDF_FONT font,
float font_size) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
CPDF_Font* pFont = CPDFFontFromFPDFFont(font);
- if (!pDoc || !pFont) {
+ if (!doc || !pFont) {
return nullptr;
}
auto pTextObj = std::make_unique<CPDF_TextObject>();
pTextObj->mutable_text_state().SetFont(
- CPDF_DocPageData::FromDocument(pDoc)->GetFont(
+ CPDF_DocPageData::FromDocument(doc)->GetFont(
pFont->GetMutableFontDict()));
pTextObj->mutable_text_state().SetFontSize(font_size);
pTextObj->SetDefaultStates();
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 81e5c46..7111187 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -83,12 +83,12 @@
}
FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetPageMode(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return PAGEMODE_UNKNOWN;
}
- const CPDF_Dictionary* pRoot = pDoc->GetRoot();
+ const CPDF_Dictionary* pRoot = doc->GetRoot();
if (!pRoot) {
return PAGEMODE_UNKNOWN;
}
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index 939c4c7..4fc126c 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -56,10 +56,10 @@
rect.bottom - rcPage.bottom >= -kMinBorderSize;
}
-void GetContentsRect(CPDF_Document* pDoc,
+void GetContentsRect(CPDF_Document* doc,
RetainPtr<CPDF_Dictionary> dict,
std::vector<CFX_FloatRect>* pRectArray) {
- auto pPDFPage = pdfium::MakeRetain<CPDF_Page>(pDoc, dict);
+ auto pPDFPage = pdfium::MakeRetain<CPDF_Page>(doc, dict);
pPDFPage->ParseContent();
for (const auto& pPageObject : *pPDFPage) {
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 0abd0c1..1916bf3 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -881,8 +881,8 @@
return;
}
- CPDF_Document* pDoc = pFormFillEnv->GetPDFDocument();
- const CPDF_Dictionary* dict = pDoc->GetRoot();
+ CPDF_Document* doc = pFormFillEnv->GetPDFDocument();
+ const CPDF_Dictionary* dict = doc->GetRoot();
if (!dict) {
return;
}
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 35968ee..0ce0bb5 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -222,8 +222,8 @@
return false;
}
- CPDF_Document* pDoc = pPage->GetDocument();
- if (!pDoc) {
+ CPDF_Document* doc = pPage->GetDocument();
+ if (!doc) {
return false;
}
@@ -239,23 +239,22 @@
WriteMatrix(text_buf, CFXMatrixFromFSMatrix(*matrix)) << " cm ";
}
- auto pStream = pDoc->NewIndirect<CPDF_Stream>(pDoc->New<CPDF_Dictionary>());
+ auto pStream = doc->NewIndirect<CPDF_Stream>(doc->New<CPDF_Dictionary>());
pStream->SetDataFromStringstream(&text_buf);
- auto pEndStream =
- pDoc->NewIndirect<CPDF_Stream>(pDoc->New<CPDF_Dictionary>());
+ auto pEndStream = doc->NewIndirect<CPDF_Stream>(doc->New<CPDF_Dictionary>());
pEndStream->SetData(ByteStringView(" Q").unsigned_span());
RetainPtr<CPDF_Array> pContentArray = ToArray(pContentObj);
if (pContentArray) {
- pContentArray->InsertNewAt<CPDF_Reference>(0, pDoc, pStream->GetObjNum());
- pContentArray->AppendNew<CPDF_Reference>(pDoc, pEndStream->GetObjNum());
+ pContentArray->InsertNewAt<CPDF_Reference>(0, doc, pStream->GetObjNum());
+ pContentArray->AppendNew<CPDF_Reference>(doc, pEndStream->GetObjNum());
} else if (pContentObj->IsStream() && !pContentObj->IsInline()) {
- pContentArray = pDoc->NewIndirect<CPDF_Array>();
- pContentArray->AppendNew<CPDF_Reference>(pDoc, pStream->GetObjNum());
- pContentArray->AppendNew<CPDF_Reference>(pDoc, pContentObj->GetObjNum());
- pContentArray->AppendNew<CPDF_Reference>(pDoc, pEndStream->GetObjNum());
- pPageDict->SetNewFor<CPDF_Reference>(pdfium::page_object::kContents, pDoc,
+ pContentArray = doc->NewIndirect<CPDF_Array>();
+ pContentArray->AppendNew<CPDF_Reference>(doc, pStream->GetObjNum());
+ pContentArray->AppendNew<CPDF_Reference>(doc, pContentObj->GetObjNum());
+ pContentArray->AppendNew<CPDF_Reference>(doc, pEndStream->GetObjNum());
+ pPageDict->SetNewFor<CPDF_Reference>(pdfium::page_object::kContents, doc,
pContentArray->GetObjNum());
}
@@ -424,22 +423,22 @@
}
}
}
- CPDF_Document* pDoc = pPage->GetDocument();
- if (!pDoc) {
+ CPDF_Document* doc = pPage->GetDocument();
+ if (!doc) {
return;
}
- auto pStream = pDoc->NewIndirect<CPDF_Stream>(pDoc->New<CPDF_Dictionary>());
+ auto pStream = doc->NewIndirect<CPDF_Stream>(doc->New<CPDF_Dictionary>());
pStream->SetDataFromStringstream(&strClip);
RetainPtr<CPDF_Array> pArray = ToArray(pContentObj);
if (pArray) {
- pArray->InsertNewAt<CPDF_Reference>(0, pDoc, pStream->GetObjNum());
+ pArray->InsertNewAt<CPDF_Reference>(0, doc, pStream->GetObjNum());
} else if (pContentObj->IsStream() && !pContentObj->IsInline()) {
- auto pContentArray = pDoc->NewIndirect<CPDF_Array>();
- pContentArray->AppendNew<CPDF_Reference>(pDoc, pStream->GetObjNum());
- pContentArray->AppendNew<CPDF_Reference>(pDoc, pContentObj->GetObjNum());
- pPageDict->SetNewFor<CPDF_Reference>(pdfium::page_object::kContents, pDoc,
+ auto pContentArray = doc->NewIndirect<CPDF_Array>();
+ pContentArray->AppendNew<CPDF_Reference>(doc, pStream->GetObjNum());
+ pContentArray->AppendNew<CPDF_Reference>(doc, pContentObj->GetObjNum());
+ pPageDict->SetNewFor<CPDF_Reference>(pdfium::page_object::kContents, doc,
pContentArray->GetObjNum());
}
}
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 786063e..3a2fb8e 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -317,12 +317,12 @@
}
FPDF_EXPORT int FPDF_CALLCONV FPDF_GetFormType(FPDF_DOCUMENT document) {
- const CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ const CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return FORMTYPE_NONE;
}
- const CPDF_Dictionary* pRoot = pDoc->GetRoot();
+ const CPDF_Dictionary* pRoot = doc->GetRoot();
if (!pRoot) {
return FORMTYPE_NONE;
}
@@ -343,12 +343,12 @@
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document) {
#ifdef PDF_ENABLE_XFA
- auto* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ auto* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return false;
}
- auto* pContext = static_cast<CPDFXFA_Context*>(pDoc->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(doc->GetExtension());
if (pContext) {
return pContext->LoadXFADoc();
}
@@ -396,19 +396,19 @@
}
*fileVersion = 0;
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
- if (!pDoc) {
+ CPDF_Document* document = CPDFDocumentFromFPDFDocument(doc);
+ if (!document) {
return false;
}
- const CPDF_Parser* pParser = pDoc->GetParser();
+ const CPDF_Parser* pParser = document->GetParser();
if (!pParser) {
return false;
}
*fileVersion = pParser->GetFileVersion();
- const CPDF_Dictionary* root_dict = pDoc->GetRoot();
+ const CPDF_Dictionary* root_dict = document->GetRoot();
if (root_dict) {
ByteString version = root_dict->GetNameFor("Version");
if (!version.IsEmpty()) {
@@ -430,47 +430,47 @@
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_DocumentHasValidCrossReferenceTable(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- return pDoc && pDoc->has_valid_cross_reference_table();
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ return doc && doc->has_valid_cross_reference_table();
}
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_GetDocPermissions(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- return pDoc ? pDoc->GetUserPermissions(/*get_owner_perms=*/true) : 0;
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ return doc ? doc->GetUserPermissions(/*get_owner_perms=*/true) : 0;
}
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_GetDocUserPermissions(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- return pDoc ? pDoc->GetUserPermissions(/*get_owner_perms=*/false) : 0;
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ return doc ? doc->GetUserPermissions(/*get_owner_perms=*/false) : 0;
}
FPDF_EXPORT int FPDF_CALLCONV
FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc || !pDoc->GetParser()) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc || !doc->GetParser()) {
return -1;
}
- RetainPtr<const CPDF_Dictionary> dict = pDoc->GetParser()->GetEncryptDict();
+ RetainPtr<const CPDF_Dictionary> dict = doc->GetParser()->GetEncryptDict();
return dict ? dict->GetIntegerFor("R") : -1;
}
FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageCount(FPDF_DOCUMENT document) {
- auto* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ auto* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return 0;
}
- auto* pExtension = pDoc->GetExtension();
- return pExtension ? pExtension->GetPageCount() : pDoc->GetPageCount();
+ auto* pExtension = doc->GetExtension();
+ return pExtension ? pExtension->GetPageCount() : doc->GetPageCount();
}
FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,
int page_index) {
- auto* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ auto* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
@@ -479,19 +479,19 @@
}
#ifdef PDF_ENABLE_XFA
- auto* pContext = static_cast<CPDFXFA_Context*>(pDoc->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(doc->GetExtension());
if (pContext) {
return FPDFPageFromIPDFPage(
pContext->GetOrCreateXFAPage(page_index).Leak());
}
#endif // PDF_ENABLE_XFA
- RetainPtr<CPDF_Dictionary> dict = pDoc->GetMutablePageDictionary(page_index);
+ RetainPtr<CPDF_Dictionary> dict = doc->GetMutablePageDictionary(page_index);
if (!dict) {
return nullptr;
}
- auto pPage = pdfium::MakeRetain<CPDF_Page>(pDoc, std::move(dict));
+ auto pPage = pdfium::MakeRetain<CPDF_Page>(doc, std::move(dict));
pPage->AddPageImageCache();
pPage->ParseContent();
@@ -1112,8 +1112,8 @@
return false;
}
- auto* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ auto* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return false;
}
@@ -1122,7 +1122,7 @@
return false;
}
- auto* pContext = static_cast<CPDFXFA_Context*>(pDoc->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(doc->GetExtension());
if (pContext) {
RetainPtr<CPDFXFA_Page> pPage = pContext->GetOrCreateXFAPage(page_index);
if (!pPage) {
@@ -1135,12 +1135,12 @@
}
#endif // PDF_ENABLE_XFA
- RetainPtr<CPDF_Dictionary> dict = pDoc->GetMutablePageDictionary(page_index);
+ RetainPtr<CPDF_Dictionary> dict = doc->GetMutablePageDictionary(page_index);
if (!dict) {
return false;
}
- auto page = pdfium::MakeRetain<CPDF_Page>(pDoc, std::move(dict));
+ auto page = pdfium::MakeRetain<CPDF_Page>(doc, std::move(dict));
page->AddPageImageCache();
size->width = page->GetPageWidth();
size->height = page->GetPageHeight();
@@ -1167,31 +1167,31 @@
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document) {
- const CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ const CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return true;
}
- CPDF_ViewerPreferences viewRef(pDoc);
+ CPDF_ViewerPreferences viewRef(doc);
return viewRef.PrintScaling();
}
FPDF_EXPORT int FPDF_CALLCONV
FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document) {
- const CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ const CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return 1;
}
- CPDF_ViewerPreferences viewRef(pDoc);
+ CPDF_ViewerPreferences viewRef(doc);
return viewRef.NumCopies();
}
FPDF_EXPORT FPDF_PAGERANGE FPDF_CALLCONV
FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document) {
- const CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ const CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
- CPDF_ViewerPreferences viewRef(pDoc);
+ CPDF_ViewerPreferences viewRef(doc);
// Unretained reference in public API. NOLINTNEXTLINE
return FPDFPageRangeFromCPDFArray(viewRef.PrintPageRange());
@@ -1215,11 +1215,11 @@
FPDF_EXPORT FPDF_DUPLEXTYPE FPDF_CALLCONV
FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document) {
- const CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ const CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return DuplexUndefined;
}
- CPDF_ViewerPreferences viewRef(pDoc);
+ CPDF_ViewerPreferences viewRef(doc);
ByteString duplex = viewRef.Duplex();
if ("Simplex" == duplex) {
return Simplex;
@@ -1238,12 +1238,12 @@
FPDF_BYTESTRING key,
char* buffer,
unsigned long length) {
- const CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ const CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return 0;
}
- CPDF_ViewerPreferences viewRef(pDoc);
+ CPDF_ViewerPreferences viewRef(doc);
std::optional<ByteString> bsVal = viewRef.GenericName(key);
if (!bsVal.has_value()) {
return 0;
@@ -1255,17 +1255,17 @@
FPDF_EXPORT FPDF_DWORD FPDF_CALLCONV
FPDF_CountNamedDests(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return 0;
}
- const CPDF_Dictionary* pRoot = pDoc->GetRoot();
+ const CPDF_Dictionary* pRoot = doc->GetRoot();
if (!pRoot) {
return 0;
}
- auto name_tree = CPDF_NameTree::Create(pDoc, "Dests");
+ auto name_tree = CPDF_NameTree::Create(doc, "Dests");
FX_SAFE_UINT32 count = name_tree ? name_tree->GetCount() : 0;
RetainPtr<const CPDF_Dictionary> pOldStyleDests = pRoot->GetDictFor("Dests");
if (pOldStyleDests) {
@@ -1280,8 +1280,8 @@
return nullptr;
}
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
@@ -1289,7 +1289,7 @@
// TODO(tsepez): murky ownership, should caller get a reference?
// Unretained reference in public API. NOLINTNEXTLINE
- return FPDFDestFromCPDFArray(CPDF_NameTree::LookupNamedDest(pDoc, dest_name));
+ return FPDFDestFromCPDFArray(CPDF_NameTree::LookupNamedDest(doc, dest_name));
}
#ifdef PDF_ENABLE_V8
@@ -1377,17 +1377,17 @@
return nullptr;
}
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc) {
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document);
+ if (!doc) {
return nullptr;
}
- const CPDF_Dictionary* pRoot = pDoc->GetRoot();
+ const CPDF_Dictionary* pRoot = doc->GetRoot();
if (!pRoot) {
return nullptr;
}
- auto name_tree = CPDF_NameTree::Create(pDoc, "Dests");
+ auto name_tree = CPDF_NameTree::Create(doc, "Dests");
size_t name_tree_count = name_tree ? name_tree->GetCount() : 0;
RetainPtr<const CPDF_Object> pDestObj;
WideString wsName;
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp
index 2e1c0e8..08be8d4 100644
--- a/fpdfsdk/fpdf_view_embeddertest.cpp
+++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -1217,12 +1217,12 @@
EXPECT_FLOAT_EQ(200.0f, size.width);
EXPECT_FLOAT_EQ(300.0f, size.height);
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document());
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document());
#ifdef PDF_ENABLE_XFA
// TODO(tsepez): XFA must obtain this size without parsing.
- EXPECT_EQ(1u, pDoc->GetParsedPageCountForTesting());
+ EXPECT_EQ(1u, doc->GetParsedPageCountForTesting());
#else // PDF_ENABLE_XFA
- EXPECT_EQ(0u, pDoc->GetParsedPageCountForTesting());
+ EXPECT_EQ(0u, doc->GetParsedPageCountForTesting());
#endif // PDF_ENABLE_XFA
// Double-check against values from when page is actually parsed.
@@ -1230,7 +1230,7 @@
ASSERT_TRUE(page);
EXPECT_FLOAT_EQ(size.width, FPDF_GetPageWidthF(page.get()));
EXPECT_FLOAT_EQ(size.height, FPDF_GetPageHeightF(page.get()));
- EXPECT_EQ(1u, pDoc->GetParsedPageCountForTesting());
+ EXPECT_EQ(1u, doc->GetParsedPageCountForTesting());
}
TEST_F(FPDFViewEmbedderTest, FPDFGetPageSizeByIndex) {
@@ -1254,12 +1254,12 @@
EXPECT_EQ(200.0, width);
EXPECT_EQ(300.0, height);
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document());
+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document());
#ifdef PDF_ENABLE_XFA
// TODO(tsepez): XFA must obtain this size without parsing.
- EXPECT_EQ(1u, pDoc->GetParsedPageCountForTesting());
+ EXPECT_EQ(1u, doc->GetParsedPageCountForTesting());
#else // PDF_ENABLE_XFA
- EXPECT_EQ(0u, pDoc->GetParsedPageCountForTesting());
+ EXPECT_EQ(0u, doc->GetParsedPageCountForTesting());
#endif // PDF_ENABLE_XFA
// Double-check against values from when page is actually parsed.
@@ -1267,7 +1267,7 @@
ASSERT_TRUE(page);
EXPECT_EQ(width, FPDF_GetPageWidth(page.get()));
EXPECT_EQ(height, FPDF_GetPageHeight(page.get()));
- EXPECT_EQ(1u, pDoc->GetParsedPageCountForTesting());
+ EXPECT_EQ(1u, doc->GetParsedPageCountForTesting());
}
TEST_F(FPDFViewEmbedderTest, GetXFAArrayData) {
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index 7f58cc2..d06028f 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -59,10 +59,10 @@
// static
RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadStockFont(
- CPDF_Document* pDoc,
+ CPDF_Document* doc,
const ByteString& font_family) {
RetainPtr<CPDF_Font> stock_font =
- CPDF_Font::GetStockFont(pDoc, font_family.AsStringView());
+ CPDF_Font::GetStockFont(doc, font_family.AsStringView());
return stock_font ? CFGAS_GEFont::LoadFont(std::move(stock_font)) : nullptr;
}
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index a275156..ae736d6 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -36,7 +36,7 @@
FX_CodePage wCodePage);
static RetainPtr<CFGAS_GEFont> LoadFont(RetainPtr<CPDF_Font> font);
static RetainPtr<CFGAS_GEFont> LoadFont(std::unique_ptr<CFX_Font> font);
- static RetainPtr<CFGAS_GEFont> LoadStockFont(CPDF_Document* pDoc,
+ static RetainPtr<CFGAS_GEFont> LoadStockFont(CPDF_Document* doc,
const ByteString& font_family);
uint32_t GetFontStyles() const;
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp
index 14c3595..e957f41 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.cpp
+++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp
@@ -132,8 +132,8 @@
} // namespace
-CFGAS_PDFFontMgr::CFGAS_PDFFontMgr(const CPDF_Document* pDoc) : doc_(pDoc) {
- DCHECK(pDoc);
+CFGAS_PDFFontMgr::CFGAS_PDFFontMgr(const CPDF_Document* doc) : doc_(doc) {
+ DCHECK(doc);
}
CFGAS_PDFFontMgr::~CFGAS_PDFFontMgr() = default;
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.h b/xfa/fgas/font/cfgas_pdffontmgr.h
index 237a9ed..fac6829 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.h
+++ b/xfa/fgas/font/cfgas_pdffontmgr.h
@@ -20,7 +20,7 @@
class CFGAS_PDFFontMgr final {
public:
- explicit CFGAS_PDFFontMgr(const CPDF_Document* pDoc);
+ explicit CFGAS_PDFFontMgr(const CPDF_Document* doc);
~CFGAS_PDFFontMgr();
RetainPtr<CFGAS_GEFont> GetFont(const WideString& wsFontFamily,
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index a63993c..9b16652 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -89,7 +89,7 @@
doc_view_->UpdateDocView();
}
-CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc) : doc_(pDoc) {}
+CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* doc) : doc_(doc) {}
CXFA_FFDocView::~CXFA_FFDocView() = default;
diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h
index a575e3d..d17e1f3a 100644
--- a/xfa/fxfa/cxfa_ffdocview.h
+++ b/xfa/fxfa/cxfa_ffdocview.h
@@ -103,7 +103,7 @@
void AddNullTestMsg(const WideString& msg);
private:
- explicit CXFA_FFDocView(CXFA_FFDoc* pDoc);
+ explicit CXFA_FFDocView(CXFA_FFDoc* doc);
bool RunEventLayoutReady();
void RunBindItems();
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index e354f2e..b5d35b9 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -43,7 +43,7 @@
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_passwordedit.h"
-CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : doc_(pDoc) {}
+CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* doc) : doc_(doc) {}
CXFA_FFNotify::~CXFA_FFNotify() = default;
diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h
index 33e9e76..4606223 100644
--- a/xfa/fxfa/cxfa_ffnotify.h
+++ b/xfa/fxfa/cxfa_ffnotify.h
@@ -80,7 +80,7 @@
void SetFocusWidgetNode(CXFA_Node* pNode);
private:
- explicit CXFA_FFNotify(CXFA_FFDoc* pDoc);
+ explicit CXFA_FFNotify(CXFA_FFDoc* doc);
cppgc::Member<CXFA_FFDoc> const doc_;
};
diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp
index 28b38f8..0fc2dc8 100644
--- a/xfa/fxfa/cxfa_fontmgr.cpp
+++ b/xfa/fxfa/cxfa_fontmgr.cpp
@@ -21,7 +21,7 @@
void CXFA_FontMgr::Trace(cppgc::Visitor* visitor) const {}
-RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(CXFA_FFDoc* pDoc,
+RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(CXFA_FFDoc* doc,
const WideString& wsFontFamily,
uint32_t dwFontStyles) {
auto key = std::make_pair(wsFontFamily, dwFontStyles);
@@ -32,14 +32,14 @@
WideString wsEnglishName = FGAS_FontNameToEnglishName(wsFontFamily);
RetainPtr<CFGAS_GEFont> font =
- pDoc->GetPDFFont(wsEnglishName, dwFontStyles, true);
+ doc->GetPDFFont(wsEnglishName, dwFontStyles, true);
if (font) {
return font;
}
font = CFGAS_DefaultFontManager::GetFont(wsFontFamily, dwFontStyles);
if (!font) {
- font = pDoc->GetPDFFont(wsEnglishName, dwFontStyles, false);
+ font = doc->GetPDFFont(wsEnglishName, dwFontStyles, false);
if (font) {
return font;
}
@@ -49,7 +49,7 @@
}
if (!font) {
font = CFGAS_GEFont::LoadStockFont(
- pDoc->GetPDFDoc(), ByteString::Format("%ls", wsFontFamily.c_str()));
+ doc->GetPDFDoc(), ByteString::Format("%ls", wsFontFamily.c_str()));
}
if (!font) {
return nullptr;
diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp
index 7377f9f..8d1afbb 100644
--- a/xfa/fxfa/parser/cxfa_box.cpp
+++ b/xfa/fxfa/parser/cxfa_box.cpp
@@ -64,7 +64,7 @@
} // namespace
-CXFA_Box::CXFA_Box(CXFA_Document* pDoc,
+CXFA_Box::CXFA_Box(CXFA_Document* doc,
XFA_PacketType ePacket,
Mask<XFA_XDPPACKET> validPackets,
XFA_ObjectType oType,
@@ -72,7 +72,7 @@
pdfium::span<const PropertyData> properties,
pdfium::span<const AttributeData> attributes,
CJX_Object* js_node)
- : CXFA_Node(pDoc,
+ : CXFA_Node(doc,
ePacket,
validPackets,
oType,
diff --git a/xfa/fxfa/parser/cxfa_box.h b/xfa/fxfa/parser/cxfa_box.h
index b906573..b0f5594 100644
--- a/xfa/fxfa/parser/cxfa_box.h
+++ b/xfa/fxfa/parser/cxfa_box.h
@@ -39,7 +39,7 @@
bool forceRound);
protected:
- CXFA_Box(CXFA_Document* pDoc,
+ CXFA_Box(CXFA_Document* doc,
XFA_PacketType ePacket,
Mask<XFA_XDPPACKET> validPackets,
XFA_ObjectType oType,
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 63c7edf..1b7bd67 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -478,7 +478,7 @@
return FXCODEC_IMAGE_UNKNOWN;
}
-RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc,
+RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* doc,
CXFA_Image* pImage,
bool& bNameImage,
int32_t& iImageXDpi,
@@ -509,13 +509,13 @@
if (!(wsURL.First(7).EqualsASCII("http://") ||
wsURL.First(6).EqualsASCII("ftp://"))) {
RetainPtr<CFX_DIBitmap> pBitmap =
- pDoc->GetPDFNamedImage(wsURL.AsStringView(), iImageXDpi, iImageYDpi);
+ doc->GetPDFNamedImage(wsURL.AsStringView(), iImageXDpi, iImageYDpi);
if (pBitmap) {
bNameImage = true;
return pBitmap;
}
}
- pImageFileRead = pDoc->OpenLinkedFile(wsURL);
+ pImageFileRead = doc->OpenLinkedFile(wsURL);
}
if (!pImageFileRead) {
return nullptr;
@@ -1029,7 +1029,7 @@
RetainPtr<CFX_DIBitmap> dibitmap_;
};
-CXFA_Node::CXFA_Node(CXFA_Document* pDoc,
+CXFA_Node::CXFA_Node(CXFA_Document* doc,
XFA_PacketType ePacket,
Mask<XFA_XDPPACKET> validPackets,
XFA_ObjectType oType,
@@ -1037,7 +1037,7 @@
pdfium::span<const PropertyData> properties,
pdfium::span<const AttributeData> attributes,
CJX_Object* js_object)
- : CXFA_Object(pDoc, oType, eType, js_object),
+ : CXFA_Object(doc, oType, eType, js_object),
properties_(properties),
attributes_(attributes),
valid_packets_(validPackets),
@@ -2950,8 +2950,8 @@
return {XFA_EventError::kSuccess, false};
}
- CXFA_FFDoc* pDoc = pDocView->GetDoc();
- CFXJSE_Engine* pContext = pDoc->GetXFADoc()->GetScriptContext();
+ CXFA_FFDoc* doc = pDocView->GetDoc();
+ CFXJSE_Engine* pContext = doc->GetXFADoc()->GetScriptContext();
CFXJSE_Engine::EventParamScope paramScope(
pContext, pEventParam->targeted_ ? this : nullptr, pEventParam);
pContext->SetRunAtType(script->GetRunAt());
@@ -2998,7 +2998,7 @@
}
CJX_Object::CalcData* pGlobalData =
- pRefNode->JSObject()->GetOrCreateCalcData(pDoc->GetHeap());
+ pRefNode->JSObject()->GetOrCreateCalcData(doc->GetHeap());
if (!pdfium::Contains(pGlobalData->globals_, this)) {
pGlobalData->globals_.push_back(this);
}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 9d51ab5..47f2335 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -424,7 +424,7 @@
bool IsProperty() const;
protected:
- CXFA_Node(CXFA_Document* pDoc,
+ CXFA_Node(CXFA_Document* doc,
XFA_PacketType ePacket,
Mask<XFA_XDPPACKET> validPackets,
XFA_ObjectType oType,
diff --git a/xfa/fxfa/parser/cxfa_rectangle.cpp b/xfa/fxfa/parser/cxfa_rectangle.cpp
index f10923c..fbb745a 100644
--- a/xfa/fxfa/parser/cxfa_rectangle.cpp
+++ b/xfa/fxfa/parser/cxfa_rectangle.cpp
@@ -55,7 +55,7 @@
doc->GetHeap()->GetAllocationHandle(),
this)) {}
-CXFA_Rectangle::CXFA_Rectangle(CXFA_Document* pDoc,
+CXFA_Rectangle::CXFA_Rectangle(CXFA_Document* doc,
XFA_PacketType ePacket,
Mask<XFA_XDPPACKET> validPackets,
XFA_ObjectType oType,
@@ -63,7 +63,7 @@
pdfium::span<const PropertyData> properties,
pdfium::span<const AttributeData> attributes,
CJX_Object* js_node)
- : CXFA_Box(pDoc,
+ : CXFA_Box(doc,
ePacket,
validPackets,
oType,
diff --git a/xfa/fxfa/parser/cxfa_rectangle.h b/xfa/fxfa/parser/cxfa_rectangle.h
index ac69a77..432ff8d 100644
--- a/xfa/fxfa/parser/cxfa_rectangle.h
+++ b/xfa/fxfa/parser/cxfa_rectangle.h
@@ -29,7 +29,7 @@
protected:
CXFA_Rectangle(CXFA_Document* doc, XFA_PacketType packet);
- CXFA_Rectangle(CXFA_Document* pDoc,
+ CXFA_Rectangle(CXFA_Document* doc,
XFA_PacketType ePacket,
Mask<XFA_XDPPACKET> validPackets,
XFA_ObjectType oType,
diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp
index aeb78fb..1038cf8 100644
--- a/xfa/fxfa/parser/cxfa_stroke.cpp
+++ b/xfa/fxfa/parser/cxfa_stroke.cpp
@@ -66,7 +66,7 @@
}
}
-CXFA_Stroke::CXFA_Stroke(CXFA_Document* pDoc,
+CXFA_Stroke::CXFA_Stroke(CXFA_Document* doc,
XFA_PacketType ePacket,
Mask<XFA_XDPPACKET> validPackets,
XFA_ObjectType oType,
@@ -74,7 +74,7 @@
pdfium::span<const PropertyData> properties,
pdfium::span<const AttributeData> attributes,
CJX_Object* js_node)
- : CXFA_Node(pDoc,
+ : CXFA_Node(doc,
ePacket,
validPackets,
oType,
diff --git a/xfa/fxfa/parser/cxfa_stroke.h b/xfa/fxfa/parser/cxfa_stroke.h
index 1f98117..303d003 100644
--- a/xfa/fxfa/parser/cxfa_stroke.h
+++ b/xfa/fxfa/parser/cxfa_stroke.h
@@ -52,7 +52,7 @@
const CFX_Matrix& matrix);
protected:
- CXFA_Stroke(CXFA_Document* pDoc,
+ CXFA_Stroke(CXFA_Document* doc,
XFA_PacketType ePacket,
Mask<XFA_XDPPACKET> validPackets,
XFA_ObjectType oType,