Rename "FX_FileHandle" to "FX_FolderHandle"

The type "FX_FileHandle" is actually a type of directory handle, its
name is confusing, this commit changes it to "FX_FolderHandle".

Change-Id: I6ab91622fcaad7e7dcd0c966112d1e5c15a6ea05
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52130
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index 51766e9..ac8c0ec 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -111,7 +111,7 @@
   return WriteBlock(str.unterminated_c_str(), str.GetLength());
 }
 
-FX_FileHandle* FX_OpenFolder(const char* path) {
+FX_FolderHandle* FX_OpenFolder(const char* path) {
 #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
   auto pData = pdfium::MakeUnique<CFindFileDataA>();
   pData->m_Handle =
@@ -127,7 +127,7 @@
 #endif
 }
 
-bool FX_GetNextFile(FX_FileHandle* handle,
+bool FX_GetNextFile(FX_FolderHandle* handle,
                     ByteString* filename,
                     bool* bFolder) {
   if (!handle)
@@ -153,7 +153,7 @@
 #endif
 }
 
-void FX_CloseFolder(FX_FileHandle* handle) {
+void FX_CloseFolder(FX_FolderHandle* handle) {
   if (!handle)
     return;
 
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index f049467..3fec402 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -14,23 +14,25 @@
 #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
 
 struct CFindFileDataA;
-typedef CFindFileDataA FX_FileHandle;
+typedef CFindFileDataA FX_FolderHandle;
 
 #else  // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
 
 #include <dirent.h>
 #include <sys/types.h>
-typedef DIR FX_FileHandle;
+typedef DIR FX_FolderHandle;
 
 #endif  // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
 
-FX_FileHandle* FX_OpenFolder(const char* path);
-bool FX_GetNextFile(FX_FileHandle* handle, ByteString* filename, bool* bFolder);
-void FX_CloseFolder(FX_FileHandle* handle);
+FX_FolderHandle* FX_OpenFolder(const char* path);
+bool FX_GetNextFile(FX_FolderHandle* handle,
+                    ByteString* filename,
+                    bool* bFolder);
+void FX_CloseFolder(FX_FolderHandle* handle);
 
 // Used with std::unique_ptr to automatically call FX_CloseFolder().
 struct FxFolderHandleCloser {
-  inline void operator()(FX_FileHandle* h) const { FX_CloseFolder(h); }
+  inline void operator()(FX_FolderHandle* h) const { FX_CloseFolder(h); }
 };
 
 #define FX_FILEMODE_ReadOnly 1
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index c7685af..ee4fdd9 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -349,7 +349,7 @@
 }
 
 void CFPF_SkiaFontMgr::ScanPath(const ByteString& path) {
-  std::unique_ptr<FX_FileHandle, FxFolderHandleCloser> handle(
+  std::unique_ptr<FX_FolderHandle, FxFolderHandleCloser> handle(
       FX_OpenFolder(path.c_str()));
   if (!handle)
     return;
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index ed1aed5..3dfbedb 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -139,7 +139,7 @@
 }
 
 void CFX_FolderFontInfo::ScanPath(const ByteString& path) {
-  std::unique_ptr<FX_FileHandle, FxFolderHandleCloser> handle(
+  std::unique_ptr<FX_FolderHandle, FxFolderHandleCloser> handle(
       FX_OpenFolder(path.c_str()));
   if (!handle)
     return;
diff --git a/xfa/fgas/font/cfx_fontsourceenum_file.cpp b/xfa/fgas/font/cfx_fontsourceenum_file.cpp
index 6cdf3dc..f14d09b 100644
--- a/xfa/fgas/font/cfx_fontsourceenum_file.cpp
+++ b/xfa/fgas/font/cfx_fontsourceenum_file.cpp
@@ -31,14 +31,14 @@
 CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() = default;
 
 ByteString CFX_FontSourceEnum_File::GetNextFile() {
-  FX_FileHandle* pCurHandle =
-      !m_FolderQueue.empty() ? m_FolderQueue.back().pFileHandle : nullptr;
+  FX_FolderHandle* pCurHandle =
+      !m_FolderQueue.empty() ? m_FolderQueue.back().pFolderHandle : nullptr;
   if (!pCurHandle) {
     if (m_FolderPaths.empty())
       return ByteString();
     pCurHandle = FX_OpenFolder(m_FolderPaths.back().c_str());
     HandleParentPath hpp;
-    hpp.pFileHandle = pCurHandle;
+    hpp.pFolderHandle = pCurHandle;
     hpp.bsParentPath = m_FolderPaths.back();
     m_FolderQueue.push_back(hpp);
   }
@@ -54,7 +54,7 @@
           m_FolderPaths.pop_back();
         return !m_FolderPaths.empty() ? GetNextFile() : ByteString();
       }
-      pCurHandle = m_FolderQueue.back().pFileHandle;
+      pCurHandle = m_FolderQueue.back().pFolderHandle;
       continue;
     }
     if (bsName == "." || bsName == "..")
@@ -63,11 +63,11 @@
       HandleParentPath hpp;
       hpp.bsParentPath =
           m_FolderQueue.back().bsParentPath + kFolderSeparator + bsName;
-      hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str());
-      if (!hpp.pFileHandle)
+      hpp.pFolderHandle = FX_OpenFolder(hpp.bsParentPath.c_str());
+      if (!hpp.pFolderHandle)
         continue;
       m_FolderQueue.push_back(hpp);
-      pCurHandle = hpp.pFileHandle;
+      pCurHandle = hpp.pFolderHandle;
       continue;
     }
     bsName = m_FolderQueue.back().bsParentPath + kFolderSeparator + bsName;
diff --git a/xfa/fgas/font/cfx_fontsourceenum_file.h b/xfa/fgas/font/cfx_fontsourceenum_file.h
index ce3f961..07eab2f 100644
--- a/xfa/fgas/font/cfx_fontsourceenum_file.h
+++ b/xfa/fgas/font/cfx_fontsourceenum_file.h
@@ -31,10 +31,10 @@
   struct HandleParentPath {
     HandleParentPath() = default;
     HandleParentPath(const HandleParentPath& x) {
-      pFileHandle = x.pFileHandle;
+      pFolderHandle = x.pFolderHandle;
       bsParentPath = x.bsParentPath;
     }
-    FX_FileHandle* pFileHandle;
+    FX_FolderHandle* pFolderHandle;
     ByteString bsParentPath;
   };