Fix 22 ClangTidy - Readability/Naming findings in fpdfsdk.

PiperOrigin-RevId: 254772057
Change-Id: I1ae3f0022adbc88501eb27b52610a3bd3e699ddf
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56834
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp
index 58e2b5d..6552b8a 100644
--- a/fpdfsdk/fpdf_doc.cpp
+++ b/fpdfsdk/fpdf_doc.cpp
@@ -68,36 +68,39 @@
 }  // namespace
 
 FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
-FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
+FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark) {
   CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pDoc)
     return nullptr;
   CPDF_BookmarkTree tree(pDoc);
-  CPDF_Bookmark bookmark(CPDFDictionaryFromFPDFBookmark(pDict));
-  return FPDFBookmarkFromCPDFDictionary(tree.GetFirstChild(bookmark).GetDict());
+  CPDF_Bookmark cBookmark(CPDFDictionaryFromFPDFBookmark(bookmark));
+  return FPDFBookmarkFromCPDFDictionary(
+      tree.GetFirstChild(cBookmark).GetDict());
 }
 
 FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
-FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
+FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark) {
   CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pDoc)
     return nullptr;
 
-  if (!pDict)
+  if (!bookmark)
     return nullptr;
 
   CPDF_BookmarkTree tree(pDoc);
-  CPDF_Bookmark bookmark(CPDFDictionaryFromFPDFBookmark(pDict));
+  CPDF_Bookmark cBookmark(CPDFDictionaryFromFPDFBookmark(bookmark));
   return FPDFBookmarkFromCPDFDictionary(
-      tree.GetNextSibling(bookmark).GetDict());
+      tree.GetNextSibling(cBookmark).GetDict());
 }
 
 FPDF_EXPORT unsigned long FPDF_CALLCONV
-FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict, void* buffer, unsigned long buflen) {
-  if (!pDict)
+FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
+                      void* buffer,
+                      unsigned long buflen) {
+  if (!bookmark)
     return 0;
-  CPDF_Bookmark bookmark(CPDFDictionaryFromFPDFBookmark(pDict));
-  WideString title = bookmark.GetTitle();
+  CPDF_Bookmark cBookmark(CPDFDictionaryFromFPDFBookmark(bookmark));
+  WideString title = cBookmark.GetTitle();
   return Utf16EncodeMaybeCopyAndReturnLength(title, buffer, buflen);
 }
 
@@ -117,42 +120,42 @@
       FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict());
 }
 
-FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFBookmark_GetDest(FPDF_DOCUMENT document,
-                                                         FPDF_BOOKMARK pDict) {
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
+FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark) {
   CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pDoc)
     return nullptr;
 
-  if (!pDict)
+  if (!bookmark)
     return nullptr;
 
-  CPDF_Bookmark bookmark(CPDFDictionaryFromFPDFBookmark(pDict));
-  CPDF_Dest dest = bookmark.GetDest(pDoc);
+  CPDF_Bookmark cBookmark(CPDFDictionaryFromFPDFBookmark(bookmark));
+  CPDF_Dest dest = cBookmark.GetDest(pDoc);
   if (dest.GetArray())
     return FPDFDestFromCPDFArray(dest.GetArray());
   // If this bookmark is not directly associated with a dest, we try to get
   // action
-  CPDF_Action action = bookmark.GetAction();
+  CPDF_Action action = cBookmark.GetAction();
   if (!action.GetDict())
     return nullptr;
   return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
 }
 
 FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV
-FPDFBookmark_GetAction(FPDF_BOOKMARK pDict) {
-  if (!pDict)
+FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark) {
+  if (!bookmark)
     return nullptr;
 
-  CPDF_Bookmark bookmark(CPDFDictionaryFromFPDFBookmark(pDict));
-  return FPDFActionFromCPDFDictionary(bookmark.GetAction().GetDict());
+  CPDF_Bookmark cBookmark(CPDFDictionaryFromFPDFBookmark(bookmark));
+  return FPDFActionFromCPDFDictionary(cBookmark.GetAction().GetDict());
 }
 
-FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION pDict) {
-  if (!pDict)
+FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action) {
+  if (!action)
     return PDFACTION_UNSUPPORTED;
 
-  CPDF_Action action(CPDFDictionaryFromFPDFAction(pDict));
-  CPDF_Action::ActionType type = action.GetType();
+  CPDF_Action cAction(CPDFDictionaryFromFPDFAction(action));
+  CPDF_Action::ActionType type = cAction.GetType();
   switch (type) {
     case CPDF_Action::GoTo:
       return PDFACTION_GOTO;
@@ -168,27 +171,27 @@
 }
 
 FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
-                                                       FPDF_ACTION pDict) {
+                                                       FPDF_ACTION action) {
   CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pDoc)
     return nullptr;
 
-  unsigned long type = FPDFAction_GetType(pDict);
+  unsigned long type = FPDFAction_GetType(action);
   if (type != PDFACTION_GOTO && type != PDFACTION_REMOTEGOTO)
     return nullptr;
 
-  CPDF_Action action(CPDFDictionaryFromFPDFAction(pDict));
-  return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
+  CPDF_Action cAction(CPDFDictionaryFromFPDFAction(action));
+  return FPDFDestFromCPDFArray(cAction.GetDest(pDoc).GetArray());
 }
 
 FPDF_EXPORT unsigned long FPDF_CALLCONV
-FPDFAction_GetFilePath(FPDF_ACTION pDict, void* buffer, unsigned long buflen) {
-  unsigned long type = FPDFAction_GetType(pDict);
+FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen) {
+  unsigned long type = FPDFAction_GetType(action);
   if (type != PDFACTION_REMOTEGOTO && type != PDFACTION_LAUNCH)
     return 0;
 
-  CPDF_Action action(CPDFDictionaryFromFPDFAction(pDict));
-  ByteString path = action.GetFilePath().ToUTF8();
+  CPDF_Action cAction(CPDFDictionaryFromFPDFAction(action));
+  ByteString path = cAction.GetFilePath().ToUTF8();
   unsigned long len = path.GetLength() + 1;
   if (buffer && len <= buflen)
     memcpy(buffer, path.c_str(), len);
@@ -197,19 +200,19 @@
 
 FPDF_EXPORT unsigned long FPDF_CALLCONV
 FPDFAction_GetURIPath(FPDF_DOCUMENT document,
-                      FPDF_ACTION pDict,
+                      FPDF_ACTION action,
                       void* buffer,
                       unsigned long buflen) {
   CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pDoc)
     return 0;
 
-  unsigned long type = FPDFAction_GetType(pDict);
+  unsigned long type = FPDFAction_GetType(action);
   if (type != PDFACTION_URI)
     return 0;
 
-  CPDF_Action action(CPDFDictionaryFromFPDFAction(pDict));
-  ByteString path = action.GetURI(pDoc);
+  CPDF_Action cAction(CPDFDictionaryFromFPDFAction(action));
+  ByteString path = cAction.GetURI(pDoc);
   unsigned long len = path.GetLength() + 1;
   if (buffer && len <= buflen)
     memcpy(buffer, path.c_str(), len);
@@ -230,15 +233,15 @@
 }
 
 FPDF_EXPORT unsigned long FPDF_CALLCONV
-FPDFDest_GetView(FPDF_DEST pDict,
+FPDFDest_GetView(FPDF_DEST dest,
                  unsigned long* pNumParams,
                  FS_FLOAT* pParams) {
-  if (!pDict) {
+  if (!dest) {
     *pNumParams = 0;
     return 0;
   }
 
-  CPDF_Dest destination(CPDFArrayFromFPDFDest(pDict));
+  CPDF_Dest destination(CPDFArrayFromFPDFDest(dest));
   unsigned long nParams = destination.GetNumParams();
   ASSERT(nParams <= 4);
   *pNumParams = nParams;
@@ -248,23 +251,23 @@
 }
 
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-FPDFDest_GetLocationInPage(FPDF_DEST pDict,
+FPDFDest_GetLocationInPage(FPDF_DEST dest,
                            FPDF_BOOL* hasXVal,
                            FPDF_BOOL* hasYVal,
                            FPDF_BOOL* hasZoomVal,
                            FS_FLOAT* x,
                            FS_FLOAT* y,
                            FS_FLOAT* zoom) {
-  if (!pDict)
+  if (!dest)
     return false;
 
-  auto dest = pdfium::MakeUnique<CPDF_Dest>(CPDFArrayFromFPDFDest(pDict));
+  auto destination = pdfium::MakeUnique<CPDF_Dest>(CPDFArrayFromFPDFDest(dest));
 
   // FPDF_BOOL is an int, GetXYZ expects bools.
   bool bHasX;
   bool bHasY;
   bool bHasZoom;
-  if (!dest->GetXYZ(&bHasX, &bHasY, &bHasZoom, x, y, zoom))
+  if (!destination->GetXYZ(&bHasX, &bHasY, &bHasZoom, x, y, zoom))
     return false;
 
   *hasXVal = bHasX;
@@ -309,29 +312,29 @@
 }
 
 FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document,
-                                                     FPDF_LINK pDict) {
-  if (!pDict)
+                                                     FPDF_LINK link) {
+  if (!link)
     return nullptr;
   CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pDoc)
     return nullptr;
-  CPDF_Link link(CPDFDictionaryFromFPDFLink(pDict));
-  FPDF_DEST dest = FPDFDestFromCPDFArray(link.GetDest(pDoc).GetArray());
+  CPDF_Link cLink(CPDFDictionaryFromFPDFLink(link));
+  FPDF_DEST dest = FPDFDestFromCPDFArray(cLink.GetDest(pDoc).GetArray());
   if (dest)
     return dest;
   // If this link is not directly associated with a dest, we try to get action
-  CPDF_Action action = link.GetAction();
+  CPDF_Action action = cLink.GetAction();
   if (!action.GetDict())
     return nullptr;
   return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
 }
 
-FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK pDict) {
-  if (!pDict)
+FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link) {
+  if (!link)
     return nullptr;
 
-  CPDF_Link link(CPDFDictionaryFromFPDFLink(pDict));
-  return FPDFActionFromCPDFDictionary(link.GetAction().GetDict());
+  CPDF_Link cLink(CPDFDictionaryFromFPDFLink(link));
+  return FPDFActionFromCPDFDictionary(cLink.GetAction().GetDict());
 }
 
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page,
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 47ce64d..c9124dc 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -478,8 +478,8 @@
 }
 
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) {
-  CPDF_PageObject* pPageObj = CPDFPageObjectFromFPDFPageObject(pageObject);
+FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT page_object) {
+  CPDF_PageObject* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
   if (!pPageObj)
     return false;
 
@@ -590,8 +590,8 @@
   return true;
 }
 
-FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT pageObject) {
-  CPDF_PageObject* pPageObj = CPDFPageObjectFromFPDFPageObject(pageObject);
+FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT page_object) {
+  CPDF_PageObject* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
   return pPageObj ? pPageObj->GetType() : FPDF_PAGEOBJ_UNKNOWN;
 }
 
@@ -714,12 +714,12 @@
 }
 
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-FPDFPageObj_GetBounds(FPDF_PAGEOBJECT pageObject,
+FPDFPageObj_GetBounds(FPDF_PAGEOBJECT page_object,
                       float* left,
                       float* bottom,
                       float* right,
                       float* top) {
-  CPDF_PageObject* pPageObj = CPDFPageObjectFromFPDFPageObject(pageObject);
+  CPDF_PageObject* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
   if (!pPageObj)
     return false;
 
@@ -839,8 +839,8 @@
 }
 
 FPDF_EXPORT int FPDF_CALLCONV
-FPDFFormObj_CountObjects(FPDF_PAGEOBJECT page_object) {
-  const auto* pObjectList = CPDFPageObjHolderFromFPDFFormObject(page_object);
+FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object) {
+  const auto* pObjectList = CPDFPageObjHolderFromFPDFFormObject(form_object);
   return pObjectList ? pObjectList->GetPageObjectCount() : -1;
 }
 
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 31fc64c..5264639 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -107,10 +107,10 @@
 };
 
 FPDF_EXPORT void FPDF_CALLCONV FPDF_AddInstalledFont(void* mapper,
-                                                     const char* name,
+                                                     const char* face,
                                                      int charset) {
   CFX_FontMapper* pMapper = static_cast<CFX_FontMapper*>(mapper);
-  pMapper->AddInstalledFont(name, charset);
+  pMapper->AddInstalledFont(face, charset);
 }
 
 FPDF_EXPORT void FPDF_CALLCONV
@@ -217,6 +217,6 @@
 }
 
 FPDF_EXPORT void FPDF_CALLCONV
-FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pDefaultFontInfo) {
-  FX_Free(static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pDefaultFontInfo));
+FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo) {
+  FX_Free(static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pFontInfo));
 }
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index 86f9ccf..cc965bd 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -174,14 +174,14 @@
 }
 
 FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE page,
-                                               int char_start,
+                                               int start_index,
                                                int char_count,
                                                unsigned short* result) {
-  if (!page || char_start < 0 || char_count < 0 || !result)
+  if (!page || start_index < 0 || char_count < 0 || !result)
     return 0;
 
   CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(page);
-  int char_available = textpage->CountChars() - char_start;
+  int char_available = textpage->CountChars() - start_index;
   if (char_available <= 0)
     return 0;
 
@@ -192,7 +192,7 @@
     return 1;
   }
 
-  WideString str = textpage->GetPageText(char_start, char_count);
+  WideString str = textpage->GetPageText(start_index, char_count);
 
   if (str.GetLength() > static_cast<size_t>(char_count))
     str = str.Left(static_cast<size_t>(char_count));
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 8cf515c..e695152 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -172,19 +172,19 @@
 }
 
 FPDF_EXPORT void FPDF_CALLCONV
-FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* cfg) {
+FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config) {
   if (g_bLibraryInitialized)
     return;
 
   FXMEM_InitializePartitionAlloc();
-  CFX_GEModule::Create(cfg ? cfg->m_pUserFontPaths : nullptr);
+  CFX_GEModule::Create(config ? config->m_pUserFontPaths : nullptr);
   CPDF_ModuleMgr::Create();
 
 #ifdef PDF_ENABLE_XFA
   BC_Library_Init();
 #endif  // PDF_ENABLE_XFA
-  if (cfg && cfg->version >= 2)
-    IJS_Runtime::Initialize(cfg->m_v8EmbedderSlot, cfg->m_pIsolate);
+  if (config && config->version >= 2)
+    IJS_Runtime::Initialize(config->m_v8EmbedderSlot, config->m_pIsolate);
 
   g_bLibraryInitialized = true;
 }
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
index 97d1bb5..b2865b1 100644
--- a/public/fpdf_edit.h
+++ b/public/fpdf_edit.h
@@ -219,7 +219,7 @@
 //
 //   page_object - handle to a page object.
 //
-// Returns TRUE if |pageObject| contains transparency.
+// Returns TRUE if |page_object| contains transparency.
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT page_object);