summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn8
-rw-r--r--core/fxcrt/cfx_fileaccess_posix.cpp6
-rw-r--r--core/fxcrt/cfx_fileaccess_posix.h11
-rw-r--r--core/fxcrt/cfx_fileaccess_windows.cpp15
-rw-r--r--core/fxcrt/cfx_fileaccess_windows.h7
5 files changed, 18 insertions, 29 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 85e819fab4..09cf28597c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -854,8 +854,6 @@ jumbo_static_library("fxcrt") {
"core/fxcrt/cfx_bitstream.h",
"core/fxcrt/cfx_datetime.cpp",
"core/fxcrt/cfx_datetime.h",
- "core/fxcrt/cfx_fileaccess_windows.cpp",
- "core/fxcrt/cfx_fileaccess_windows.h",
"core/fxcrt/cfx_fixedbufgrow.h",
"core/fxcrt/cfx_memorystream.cpp",
"core/fxcrt/cfx_memorystream.h",
@@ -934,6 +932,12 @@ jumbo_static_library("fxcrt") {
"core/fxcrt/cfx_fileaccess_posix.h",
]
}
+ if (is_win) {
+ sources += [
+ "core/fxcrt/cfx_fileaccess_windows.cpp",
+ "core/fxcrt/cfx_fileaccess_windows.h",
+ ]
+ }
if (pdf_enable_xfa) {
sources += [
"core/fxcrt/cfx_char.cpp",
diff --git a/core/fxcrt/cfx_fileaccess_posix.cpp b/core/fxcrt/cfx_fileaccess_posix.cpp
index fdcf4ae6bb..fdba53b71e 100644
--- a/core/fxcrt/cfx_fileaccess_posix.cpp
+++ b/core/fxcrt/cfx_fileaccess_posix.cpp
@@ -22,10 +22,6 @@
#define O_LARGEFILE 0
#endif // O_LARGEFILE
-#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_ || \
- _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || \
- _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_
-
namespace {
void GetFileMode(uint32_t dwModes, int32_t& nFlags, int32_t& nMasks) {
@@ -153,5 +149,3 @@ bool CFX_FileAccess_Posix::Truncate(FX_FILESIZE szFile) {
return !ftruncate(m_nFD, szFile);
}
-
-#endif
diff --git a/core/fxcrt/cfx_fileaccess_posix.h b/core/fxcrt/cfx_fileaccess_posix.h
index 84fc81bd98..381f115a13 100644
--- a/core/fxcrt/cfx_fileaccess_posix.h
+++ b/core/fxcrt/cfx_fileaccess_posix.h
@@ -8,10 +8,14 @@
#define CORE_FXCRT_CFX_FILEACCESS_POSIX_H_
#include "core/fxcrt/fileaccess_iface.h"
+#include "core/fxcrt/fx_system.h"
+
+#if _FX_PLATFORM_ != _FX_PLATFORM_LINUX_ && \
+ _FX_PLATFORM_ != _FX_PLATFORM_APPLE_ && \
+ _FX_PLATFORM_ != _FX_PLATFORM_ANDROID_
+#error "Included on the wrong platform"
+#endif
-#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_ || \
- _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || \
- _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_
class CFX_FileAccess_Posix : public FileAccessIface {
public:
CFX_FileAccess_Posix();
@@ -36,6 +40,5 @@ class CFX_FileAccess_Posix : public FileAccessIface {
protected:
int32_t m_nFD;
};
-#endif
#endif // CORE_FXCRT_CFX_FILEACCESS_POSIX_H_
diff --git a/core/fxcrt/cfx_fileaccess_windows.cpp b/core/fxcrt/cfx_fileaccess_windows.cpp
index f416bb6b77..242c202984 100644
--- a/core/fxcrt/cfx_fileaccess_windows.cpp
+++ b/core/fxcrt/cfx_fileaccess_windows.cpp
@@ -11,8 +11,6 @@
#include "core/fxcrt/fx_string.h"
#include "third_party/base/ptr_util.h"
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
-
namespace {
void GetFileMode(uint32_t dwMode,
@@ -36,18 +34,6 @@ std::unique_ptr<FileAccessIface> FileAccessIface::Create() {
return pdfium::MakeUnique<CFX_FileAccess_Windows>();
}
-#ifdef __cplusplus
-extern "C" {
-#endif
-WINBASEAPI BOOL WINAPI GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize);
-WINBASEAPI BOOL WINAPI SetFilePointerEx(HANDLE hFile,
- LARGE_INTEGER liDistanceToMove,
- PLARGE_INTEGER lpNewFilePointer,
- DWORD dwMoveMethod);
-#ifdef __cplusplus
-}
-#endif
-
CFX_FileAccess_Windows::CFX_FileAccess_Windows() : m_hFile(nullptr) {}
CFX_FileAccess_Windows::~CFX_FileAccess_Windows() {
@@ -193,4 +179,3 @@ bool CFX_FileAccess_Windows::Truncate(FX_FILESIZE szFile) {
return !!::SetEndOfFile(m_hFile);
}
-#endif
diff --git a/core/fxcrt/cfx_fileaccess_windows.h b/core/fxcrt/cfx_fileaccess_windows.h
index 451462bbca..4352a2b521 100644
--- a/core/fxcrt/cfx_fileaccess_windows.h
+++ b/core/fxcrt/cfx_fileaccess_windows.h
@@ -8,8 +8,12 @@
#define CORE_FXCRT_CFX_FILEACCESS_WINDOWS_H_
#include "core/fxcrt/fileaccess_iface.h"
+#include "core/fxcrt/fx_system.h"
+
+#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#error "Included on the wrong platform"
+#endif
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
class CFX_FileAccess_Windows : public FileAccessIface {
public:
CFX_FileAccess_Windows();
@@ -34,6 +38,5 @@ class CFX_FileAccess_Windows : public FileAccessIface {
protected:
void* m_hFile;
};
-#endif
#endif // CORE_FXCRT_CFX_FILEACCESS_WINDOWS_H_