Make CPDF_{Array,Dictionary} methods returning pointers internal-only.

-- Make some methods return retained references.
-- Make other methods return void to prevent misuse.
-- Use `auto` when type already appears on the same line.

Change-Id: Ie02b2324cd111684350c8b59f863323031536f95
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98271
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdf_attachment.cpp b/fpdfsdk/fpdf_attachment.cpp
index b1461bb..de02785 100644
--- a/fpdfsdk/fpdf_attachment.cpp
+++ b/fpdfsdk/fpdf_attachment.cpp
@@ -216,8 +216,7 @@
 
   // Create a dictionary for the new embedded file stream.
   auto pFileStreamDict = pdfium::MakeRetain<CPDF_Dictionary>();
-  CPDF_Dictionary* pParamsDict =
-      pFileStreamDict->SetNewFor<CPDF_Dictionary>("Params");
+  auto pParamsDict = pFileStreamDict->SetNewFor<CPDF_Dictionary>("Params");
 
   // Set the size of the new file in the dictionary.
   pFileStreamDict->SetNewFor<CPDF_Number>(pdfium::stream::kDL,
@@ -244,8 +243,7 @@
   memcpy(stream.get(), contents, len);
   auto pFileStream = pDoc->NewIndirect<CPDF_Stream>(std::move(stream), len,
                                                     std::move(pFileStreamDict));
-  CPDF_Dictionary* pEFDict =
-      pFile->AsMutableDictionary()->SetNewFor<CPDF_Dictionary>("EF");
+  auto pEFDict = pFile->AsMutableDictionary()->SetNewFor<CPDF_Dictionary>("EF");
   pEFDict->SetNewFor<CPDF_Reference>("F", pDoc, pFileStream->GetObjNum());
   return true;
 }