summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-03 17:55:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-03 17:55:58 +0000
commitce8fa87cb384ffc3309313332fc46638aeb74351 (patch)
treeb24964af113a0897a0fca58fbb9ab9d6feda24ed
parent3c219effd1c33f2e32e9b88dba3d1de78a9ad074 (diff)
downloadpdfium-ce8fa87cb384ffc3309313332fc46638aeb74351.tar.xz
Fix nits in CFX_FontSourceEnum_File.
Change-Id: I116745419311b4cd37ce69c85f6ce6972d5325f4 Reviewed-on: https://pdfium-review.googlesource.com/43351 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--xfa/fgas/font/cfx_fontsourceenum_file.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/xfa/fgas/font/cfx_fontsourceenum_file.cpp b/xfa/fgas/font/cfx_fontsourceenum_file.cpp
index c92fba5eea..05483b93cf 100644
--- a/xfa/fgas/font/cfx_fontsourceenum_file.cpp
+++ b/xfa/fgas/font/cfx_fontsourceenum_file.cpp
@@ -6,9 +6,11 @@
#include "xfa/fgas/font/cfx_fontsourceenum_file.h"
+#include <iterator>
+
namespace {
-constexpr wchar_t kFolderSeparator = L'/';
+constexpr char kFolderSeparator = '/';
constexpr const char* g_FontFolders[] = {
#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
@@ -23,12 +25,10 @@ constexpr const char* g_FontFolders[] = {
} // namespace
-CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() {
- for (size_t i = 0; i < FX_ArraySize(g_FontFolders); ++i)
- m_FolderPaths.push_back(g_FontFolders[i]);
-}
+CFX_FontSourceEnum_File::CFX_FontSourceEnum_File()
+ : m_FolderPaths(std::begin(g_FontFolders), std::end(g_FontFolders)) {}
-CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {}
+CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() = default;
ByteString CFX_FontSourceEnum_File::GetNextFile() {
FX_FileHandle* pCurHandle =
@@ -44,7 +44,6 @@ ByteString CFX_FontSourceEnum_File::GetNextFile() {
}
ByteString bsName;
bool bFolder;
- ByteString bsFolderSeparator = WideString(kFolderSeparator).ToDefANSI();
while (true) {
if (!FX_GetNextFile(pCurHandle, &bsName, &bFolder)) {
FX_CloseFolder(pCurHandle);
@@ -63,7 +62,7 @@ ByteString CFX_FontSourceEnum_File::GetNextFile() {
if (bFolder) {
HandleParentPath hpp;
hpp.bsParentPath =
- m_FolderQueue.back().bsParentPath + bsFolderSeparator + bsName;
+ m_FolderQueue.back().bsParentPath + kFolderSeparator + bsName;
hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str());
if (!hpp.pFileHandle)
continue;
@@ -71,7 +70,7 @@ ByteString CFX_FontSourceEnum_File::GetNextFile() {
pCurHandle = hpp.pFileHandle;
continue;
}
- bsName = m_FolderQueue.back().bsParentPath + bsFolderSeparator + bsName;
+ bsName = m_FolderQueue.back().bsParentPath + kFolderSeparator + bsName;
break;
}
return bsName;