summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-26 16:33:01 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-26 16:33:01 -0700
commit3bd3841291b46bd7ae31cfb8dc8035e5b4ed4e40 (patch)
tree46aba6b22f524abe514b56a3e0980a2047051fb3 /core/fxcrt
parent2f1e05a44bbc38a4afea3fde8c8018dc127b8659 (diff)
downloadpdfium-3bd3841291b46bd7ae31cfb8dc8035e5b4ed4e40.tar.xz
Remove checks for _WIN32_WCE.
Review-Url: https://codereview.chromium.org/2011563006
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/fx_basic_util.cpp55
1 files changed, 18 insertions, 37 deletions
diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp
index be5200fc6f..02e09ce057 100644
--- a/core/fxcrt/fx_basic_util.cpp
+++ b/core/fxcrt/fx_basic_util.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <cctype>
+#include <memory>
#ifdef PDF_ENABLE_XFA
CFX_PrivateData::CFX_PrivateData() {}
@@ -208,41 +209,35 @@ class CFindFileDataW : public CFindFileData {
WIN32_FIND_DATAW m_FindData;
};
#endif
+
void* FX_OpenFolder(const FX_CHAR* path) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#ifndef _WIN32_WCE
- CFindFileDataA* pData = new CFindFileDataA;
+ std::unique_ptr<CFindFileDataA> pData(new CFindFileDataA);
pData->m_Handle = FindFirstFileExA((CFX_ByteString(path) + "/*.*").c_str(),
FindExInfoStandard, &pData->m_FindData,
- FindExSearchNameMatch, NULL, 0);
-#else
- CFindFileDataW* pData = new CFindFileDataW;
- pData->m_Handle = FindFirstFileW(CFX_WideString::FromLocal(path) + L"/*.*",
- &pData->m_FindData);
-#endif
- if (pData->m_Handle == INVALID_HANDLE_VALUE) {
- delete pData;
- return NULL;
- }
+ FindExSearchNameMatch, nullptr, 0);
+ if (pData->m_Handle == INVALID_HANDLE_VALUE)
+ return nullptr;
+
pData->m_bEnd = FALSE;
- return pData;
+ return pData.release();
#else
DIR* dir = opendir(path);
return dir;
#endif
}
+
void* FX_OpenFolder(const FX_WCHAR* path) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- CFindFileDataW* pData = new CFindFileDataW;
+ std::unique_ptr<CFindFileDataW> pData(new CFindFileDataW);
pData->m_Handle = FindFirstFileExW((CFX_WideString(path) + L"/*.*").c_str(),
FindExInfoStandard, &pData->m_FindData,
- FindExSearchNameMatch, NULL, 0);
- if (pData->m_Handle == INVALID_HANDLE_VALUE) {
- delete pData;
- return NULL;
- }
+ FindExSearchNameMatch, nullptr, 0);
+ if (pData->m_Handle == INVALID_HANDLE_VALUE)
+ return nullptr;
+
pData->m_bEnd = FALSE;
- return pData;
+ return pData.release();
#else
DIR* dir = opendir(CFX_ByteString::FromUnicode(path).c_str());
return dir;
@@ -255,29 +250,15 @@ FX_BOOL FX_GetNextFile(void* handle,
return FALSE;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#ifndef _WIN32_WCE
CFindFileDataA* pData = (CFindFileDataA*)handle;
- if (pData->m_bEnd) {
+ if (pData->m_bEnd)
return FALSE;
- }
+
filename = pData->m_FindData.cFileName;
bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
- if (!FindNextFileA(pData->m_Handle, &pData->m_FindData)) {
+ if (!FindNextFileA(pData->m_Handle, &pData->m_FindData))
pData->m_bEnd = TRUE;
- }
- return TRUE;
-#else
- CFindFileDataW* pData = (CFindFileDataW*)handle;
- if (pData->m_bEnd) {
- return FALSE;
- }
- filename = CFX_ByteString::FromUnicode(pData->m_FindData.cFileName);
- bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
- if (!FindNextFileW(pData->m_Handle, &pData->m_FindData)) {
- pData->m_bEnd = TRUE;
- }
return TRUE;
-#endif
#elif defined(__native_client__)
abort();
return FALSE;