summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-07 18:57:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-07 18:57:47 -0800
commit1306b180a6a8e306a7d00db9cdaa983784c354ed (patch)
treecaaa0d7896e6f87003f7bce6a6ad016397596c4f
parentda911bc12558667555266425d0b7e83296e8cc7d (diff)
downloadpdfium-1306b180a6a8e306a7d00db9cdaa983784c354ed.tar.xz
Replace CFX_ByteStringArray with std::vector.
Also convernt one nearby array to vector as well. Review-Url: https://codereview.chromium.org/2559903002
-rw-r--r--core/fxcrt/fx_basic.h1
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.cpp39
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.h4
3 files changed, 19 insertions, 25 deletions
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h
index 2f581b0d5e..184b73bd42 100644
--- a/core/fxcrt/fx_basic.h
+++ b/core/fxcrt/fx_basic.h
@@ -423,7 +423,6 @@ class CFX_ObjectArray : public CFX_BasicArray {
CFX_BasicArray::SetSize(0);
}
};
-typedef CFX_ObjectArray<CFX_ByteString> CFX_ByteStringArray;
typedef CFX_ObjectArray<CFX_WideString> CFX_WideStringArray;
#endif // PDF_ENABLE_XFA
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index d7e7e8ed84..6f998a9975 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -501,40 +501,38 @@ CFX_FontDescriptor::~CFX_FontDescriptor() {}
CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() {
for (size_t i = 0; i < FX_ArraySize(g_FontFolders); ++i)
- m_FolderPaths.Add(g_FontFolders[i]);
+ m_FolderPaths.push_back(g_FontFolders[i]);
}
CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {}
CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() {
FX_FileHandle* pCurHandle =
- m_FolderQueue.GetSize() != 0
- ? m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle
- : nullptr;
+ !m_FolderQueue.empty() ? m_FolderQueue.back().pFileHandle : nullptr;
if (!pCurHandle) {
- if (m_FolderPaths.GetSize() < 1)
+ if (m_FolderPaths.empty())
return "";
- pCurHandle =
- FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1].c_str());
+ pCurHandle = FX_OpenFolder(m_FolderPaths.back().c_str());
FX_HandleParentPath hpp;
hpp.pFileHandle = pCurHandle;
- hpp.bsParentPath = m_FolderPaths[m_FolderPaths.GetSize() - 1];
- m_FolderQueue.Add(hpp);
+ hpp.bsParentPath = m_FolderPaths.back();
+ m_FolderQueue.push_back(hpp);
}
CFX_ByteString bsName;
bool bFolder;
- CFX_ByteString bsFolderSpearator =
+ CFX_ByteString bsFolderSeparator =
CFX_ByteString::FromUnicode(CFX_WideString(FX_GetFolderSeparator()));
while (true) {
if (!FX_GetNextFile(pCurHandle, &bsName, &bFolder)) {
FX_CloseFolder(pCurHandle);
- m_FolderQueue.RemoveAt(m_FolderQueue.GetSize() - 1);
- if (m_FolderQueue.GetSize() == 0) {
- m_FolderPaths.RemoveAt(m_FolderPaths.GetSize() - 1);
- return m_FolderPaths.GetSize() != 0 ? GetNextFile() : "";
+ if (!m_FolderQueue.empty())
+ m_FolderQueue.pop_back();
+ if (!m_FolderQueue.empty()) {
+ if (!m_FolderPaths.empty())
+ m_FolderPaths.pop_back();
+ return !m_FolderPaths.empty() ? GetNextFile() : "";
}
- pCurHandle =
- m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle;
+ pCurHandle = m_FolderQueue.back().pFileHandle;
continue;
}
if (bsName == "." || bsName == "..")
@@ -542,18 +540,15 @@ CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() {
if (bFolder) {
FX_HandleParentPath hpp;
hpp.bsParentPath =
- m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath +
- bsFolderSpearator + bsName;
+ m_FolderQueue.back().bsParentPath + bsFolderSeparator + bsName;
hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str());
if (!hpp.pFileHandle)
continue;
- m_FolderQueue.Add(hpp);
+ m_FolderQueue.push_back(hpp);
pCurHandle = hpp.pFileHandle;
continue;
}
- bsName =
- m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath +
- bsFolderSpearator + bsName;
+ bsName = m_FolderQueue.back().bsParentPath + bsFolderSeparator + bsName;
break;
}
return bsName;
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h
index d3eb8f1a85..ce87b4e2b8 100644
--- a/xfa/fgas/font/cfgas_fontmgr.h
+++ b/xfa/fgas/font/cfgas_fontmgr.h
@@ -185,8 +185,8 @@ class CFX_FontSourceEnum_File {
CFX_ByteString GetNextFile();
CFX_WideString m_wsNext;
- CFX_ObjectArray<FX_HandleParentPath> m_FolderQueue;
- CFX_ByteStringArray m_FolderPaths;
+ std::vector<FX_HandleParentPath> m_FolderQueue;
+ std::vector<CFX_ByteString> m_FolderPaths;
};
class CFGAS_FontMgr {