Move FDFToURLEncodedData() into an anonymous namespace.

Change-Id: Iac581765f343f464f73a892b300ae20923c3bb32
Reviewed-on: https://pdfium-review.googlesource.com/39971
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 6a4b591..3cd1b67 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -78,6 +78,45 @@
 }
 #endif  // PDF_ENABLE_XFA
 
+bool FDFToURLEncodedData(uint8_t*& pBuf, size_t& nBufSize) {
+  std::unique_ptr<CFDF_Document> pFDF =
+      CFDF_Document::ParseMemory(pBuf, nBufSize);
+  if (!pFDF)
+    return true;
+
+  CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictFor("FDF");
+  if (!pMainDict)
+    return false;
+
+  CPDF_Array* pFields = pMainDict->GetArrayFor("Fields");
+  if (!pFields)
+    return false;
+
+  std::ostringstream fdfEncodedData;
+  for (uint32_t i = 0; i < pFields->GetCount(); i++) {
+    CPDF_Dictionary* pField = pFields->GetDictAt(i);
+    if (!pField)
+      continue;
+    WideString name;
+    name = pField->GetUnicodeTextFor("T");
+    ByteString name_b = name.ToDefANSI();
+    ByteString csBValue = pField->GetStringFor("V");
+    WideString csWValue = PDF_DecodeText(csBValue);
+    ByteString csValue_b = csWValue.ToDefANSI();
+    fdfEncodedData << name_b << "=" << csValue_b;
+    if (i != pFields->GetCount() - 1)
+      fdfEncodedData << "&";
+  }
+
+  nBufSize = fdfEncodedData.tellp();
+  if (nBufSize <= 0)
+    return false;
+
+  pBuf = FX_Alloc(uint8_t, nBufSize);
+  memcpy(pBuf, fdfEncodedData.str().c_str(), nBufSize);
+  return true;
+}
+
 }  // namespace
 
 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_FormFillEnvironment* pFormFillEnv)
@@ -485,45 +524,6 @@
   return true;
 }
 
-bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, size_t& nBufSize) {
-  std::unique_ptr<CFDF_Document> pFDF =
-      CFDF_Document::ParseMemory(pBuf, nBufSize);
-  if (!pFDF)
-    return true;
-
-  CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictFor("FDF");
-  if (!pMainDict)
-    return false;
-
-  CPDF_Array* pFields = pMainDict->GetArrayFor("Fields");
-  if (!pFields)
-    return false;
-
-  std::ostringstream fdfEncodedData;
-  for (uint32_t i = 0; i < pFields->GetCount(); i++) {
-    CPDF_Dictionary* pField = pFields->GetDictAt(i);
-    if (!pField)
-      continue;
-    WideString name;
-    name = pField->GetUnicodeTextFor("T");
-    ByteString name_b = name.ToDefANSI();
-    ByteString csBValue = pField->GetStringFor("V");
-    WideString csWValue = PDF_DecodeText(csBValue);
-    ByteString csValue_b = csWValue.ToDefANSI();
-    fdfEncodedData << name_b << "=" << csValue_b;
-    if (i != pFields->GetCount() - 1)
-      fdfEncodedData << "&";
-  }
-
-  nBufSize = fdfEncodedData.tellp();
-  if (nBufSize <= 0)
-    return false;
-
-  pBuf = FX_Alloc(uint8_t, nBufSize);
-  memcpy(pBuf, fdfEncodedData.str().c_str(), nBufSize);
-  return true;
-}
-
 ByteString CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
     const std::vector<CPDF_FormField*>& fields,
     bool bIncludeOrExclude) {
diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h
index bb6d7fc..14772ef 100644
--- a/fpdfsdk/cpdfsdk_interform.h
+++ b/fpdfsdk/cpdfsdk_interform.h
@@ -111,7 +111,6 @@
   void AfterCheckedStatusChange(CPDF_FormField* pField) override;
   void AfterFormReset(CPDF_InterForm* pForm) override;
 
-  bool FDFToURLEncodedData(uint8_t*& pBuf, size_t& nBufSize);
   int GetPageIndexByAnnotDict(CPDF_Document* pDocument,
                               CPDF_Dictionary* pAnnotDict) const;