Change CPDF_NameTree::LookupValueAndName() to take a size_t.

Pass a size_t index through to the internal implementation. Do the same
for DeleteValueAndName(). All callers have been audited. They either
pass in size_t already, or checks int indices to make sure they are not
negative.

Change-Id: Iea472f96b5b012e682e3bdf78227638d4983de8e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/86938
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp
index fb37cad..afc70e4 100644
--- a/core/fpdfdoc/cpdf_nametree.cpp
+++ b/core/fpdfdoc/cpdf_nametree.cpp
@@ -485,7 +485,7 @@
   return true;
 }
 
-bool CPDF_NameTree::DeleteValueAndName(int nIndex) {
+bool CPDF_NameTree::DeleteValueAndName(size_t nIndex) {
   absl::optional<IndexSearchResult> result =
       SearchNameNodeByIndex(m_pRoot.Get(), nIndex);
   if (!result) {
@@ -503,7 +503,7 @@
   return true;
 }
 
-CPDF_Object* CPDF_NameTree::LookupValueAndName(int nIndex,
+CPDF_Object* CPDF_NameTree::LookupValueAndName(size_t nIndex,
                                                WideString* csName) const {
   absl::optional<IndexSearchResult> result =
       SearchNameNodeByIndex(m_pRoot.Get(), nIndex);
diff --git a/core/fpdfdoc/cpdf_nametree.h b/core/fpdfdoc/cpdf_nametree.h
index b443b7b..e27f5b1 100644
--- a/core/fpdfdoc/cpdf_nametree.h
+++ b/core/fpdfdoc/cpdf_nametree.h
@@ -7,6 +7,8 @@
 #ifndef CORE_FPDFDOC_CPDF_NAMETREE_H_
 #define CORE_FPDFDOC_CPDF_NAMETREE_H_
 
+#include <stddef.h>
+
 #include <memory>
 
 #include "core/fxcrt/fx_string.h"
@@ -40,9 +42,9 @@
                                      const ByteString& name);
 
   bool AddValueAndName(RetainPtr<CPDF_Object> pObj, const WideString& name);
-  bool DeleteValueAndName(int nIndex);
+  bool DeleteValueAndName(size_t nIndex);
 
-  CPDF_Object* LookupValueAndName(int nIndex, WideString* csName) const;
+  CPDF_Object* LookupValueAndName(size_t nIndex, WideString* csName) const;
   CPDF_Object* LookupValue(const WideString& csName) const;
 
   size_t GetCount() const;