diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-09-28 08:51:48 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-28 15:27:49 +0000 |
commit | 9c392c82abee05ac2fd42e69984e2de8e48b797a (patch) | |
tree | 0922ea5a2db6b1d2df95e6129663a00ba47499a7 | |
parent | 94df367590a2ccd4f799df8958ddc014f496edb1 (diff) | |
download | pdfium-9c392c82abee05ac2fd42e69984e2de8e48b797a.tar.xz |
Simplify some OS checks to PLATFORM checks
This CL simplifies the OS == WIN{32|64} checks to be PLATFORM == WINDOWS
checks.
Change-Id: I1493d316dd457b0228e4ef39db4cf1d2b8abf97d
Reviewed-on: https://pdfium-review.googlesource.com/14870
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | core/fxcodec/codec/ccodec_faxmodule.h | 4 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_jpegmodule.h | 4 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_fax.cpp | 4 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_jpeg.cpp | 8 | ||||
-rw-r--r-- | core/fxcrt/cfx_datetime.cpp | 6 | ||||
-rw-r--r-- | core/fxcrt/cfx_seekablestreamproxy.cpp | 4 | ||||
-rw-r--r-- | fxbarcode/utils.h | 25 | ||||
-rw-r--r-- | xfa/fwl/cfwl_notedriver.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widgetmgr.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widgetmgr.h | 8 |
10 files changed, 36 insertions, 40 deletions
diff --git a/core/fxcodec/codec/ccodec_faxmodule.h b/core/fxcodec/codec/ccodec_faxmodule.h index 58889d142b..4f8ab78ac4 100644 --- a/core/fxcodec/codec/ccodec_faxmodule.h +++ b/core/fxcodec/codec/ccodec_faxmodule.h @@ -26,14 +26,14 @@ class CCodec_FaxModule { bool BlackIs1, int Columns, int Rows); -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ static void FaxEncode(const uint8_t* src_buf, int width, int height, int pitch, std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf, uint32_t* dest_size); -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ }; #endif // CORE_FXCODEC_CODEC_CCODEC_FAXMODULE_H_ diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h index ca561317aa..9f4c80d08d 100644 --- a/core/fxcodec/codec/ccodec_jpegmodule.h +++ b/core/fxcodec/codec/ccodec_jpegmodule.h @@ -57,11 +57,11 @@ class CCodec_JpegModule { bool ReadScanline(Context* pContext, uint8_t* dest_buf); uint32_t GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr); -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ static bool JpegEncode(const RetainPtr<CFX_DIBSource>& pSource, uint8_t** dest_buf, size_t* dest_size); -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ }; #endif // CORE_FXCODEC_CODEC_CCODEC_JPEGMODULE_H_ diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index 83ff5f7b3a..c800fda283 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp @@ -607,7 +607,7 @@ std::unique_ptr<CCodec_ScanlineDecoder> CCodec_FaxModule::CreateDecoder( EncodedByteAlign, BlackIs1); } -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ namespace { const uint8_t BlackRunTerminator[128] = { 0x37, 10, 0x02, 3, 0x03, 2, 0x02, 2, 0x03, 3, 0x03, 4, 0x02, 4, @@ -801,4 +801,4 @@ void CCodec_FaxModule::FaxEncode( encoder.Encode(dest_buf, dest_size); } -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index b1dffbb210..5b3c25d0f7 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -88,13 +88,13 @@ static void _error_do_nothing1(j_common_ptr cinfo, int) {} static void _error_do_nothing2(j_common_ptr cinfo, char*) {} -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ static void _dest_do_nothing(j_compress_ptr cinfo) {} static boolean _dest_empty(j_compress_ptr cinfo) { return false; } -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ } // extern "C" #define JPEG_MARKER_ICC (JPEG_APP0 + 2) @@ -506,7 +506,7 @@ uint32_t CCodec_JpegModule::GetAvailInput(Context* pContext, return (uint32_t)ctx->m_SrcMgr.bytes_in_buffer; } -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #define JPEG_BLOCK_SIZE 1048576 bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBSource>& pSource, uint8_t** dest_buf, @@ -607,4 +607,4 @@ bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBSource>& pSource, return true; } -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ diff --git a/core/fxcrt/cfx_datetime.cpp b/core/fxcrt/cfx_datetime.cpp index 521e07cb67..38dad0d6ac 100644 --- a/core/fxcrt/cfx_datetime.cpp +++ b/core/fxcrt/cfx_datetime.cpp @@ -92,9 +92,9 @@ bool FX_IsLeapYear(int32_t iYear) { void CFX_DateTime::Now() { FXUT_SYSTEMTIME utLocal; -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ ::GetLocalTime((LPSYSTEMTIME)&utLocal); -#else // _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ timeval curTime; gettimeofday(&curTime, nullptr); @@ -108,7 +108,7 @@ void CFX_DateTime::Now() { utLocal.wMinute = st.tm_min; utLocal.wSecond = st.tm_sec; utLocal.wMillisecond = curTime.tv_usec / 1000; -#endif // _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ year_ = utLocal.wYear; month_ = static_cast<uint8_t>(utLocal.wMonth); diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp index f2590ecfd6..989c440db1 100644 --- a/core/fxcrt/cfx_seekablestreamproxy.cpp +++ b/core/fxcrt/cfx_seekablestreamproxy.cpp @@ -6,9 +6,9 @@ #include "core/fxcrt/cfx_seekablestreamproxy.h" -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #include <io.h> -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #include <algorithm> #include <limits> diff --git a/fxbarcode/utils.h b/fxbarcode/utils.h index 55d1c96af0..9e6c70fe7c 100644 --- a/fxbarcode/utils.h +++ b/fxbarcode/utils.h @@ -19,26 +19,23 @@ bool BC_FX_ByteString_Replace(ByteString& dst, void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c); void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba); -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #include <limits> -#elif _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ -#include <limits.h> -#endif - -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ #define FXSYS_isnan(x) _isnan(x) -#elif _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ || \ +#define FXSYS_nan() (std::numeric_limits<float>::quiet_NaN()) +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ + +#if _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ || \ _FX_OS_ == _FX_OS_ANDROID_ +#if _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ +#include <limits.h> +#endif // _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ + #include <cmath> #define FXSYS_isnan(x) std::isnan(x) -#endif - -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ -#define FXSYS_nan() (std::numeric_limits<float>::quiet_NaN()) -#elif _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ || \ - _FX_OS_ == _FX_OS_ANDROID_ #define FXSYS_nan() NAN -#endif +#endif // _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ || \ + // _FX_OS_ == _FX_OS_ANDROID_ enum BCFORMAT { BCFORMAT_UNSPECIFY = -1, diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp index e6b869da58..9a19f4b8a7 100644 --- a/xfa/fwl/cfwl_notedriver.cpp +++ b/xfa/fwl/cfwl_notedriver.cpp @@ -106,15 +106,14 @@ bool CFWL_NoteDriver::SetFocus(CFWL_Widget* pFocus) { } void CFWL_NoteDriver::Run() { -#if _FX_OS_ == _FX_OS_LINUX_ || _FX_OS_ == _FX_OS_WIN32_ || \ - _FX_OS_ == _FX_OS_WIN64_ +#if _FX_OS_ == _FX_OS_LINUX_ || _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ for (;;) { CFWL_NoteLoop* pTopLoop = GetTopLoop(); if (!pTopLoop || !pTopLoop->ContinueModal()) break; UnqueueMessageAndProcess(pTopLoop); } -#endif +#endif // _FX_OS_ == _FX_OS_LINUX_ || _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ } void CFWL_NoteDriver::NotifyTargetHide(CFWL_Widget* pNoteTarget) { diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index e98233bebf..3082b182ad 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -33,9 +33,9 @@ CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) m_pAdapter(pAdapterNative->GetFWLAdapterWidgetMgr()) { ASSERT(m_pAdapter); m_mapWidgetItem[nullptr] = pdfium::MakeUnique<Item>(); -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ m_rtScreen.Reset(); -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ } CFWL_WidgetMgr::~CFWL_WidgetMgr() {} @@ -606,10 +606,10 @@ CFWL_WidgetMgr::Item::Item(CFWL_Widget* widget) pNext(nullptr), pWidget(widget), iRedrawCounter(0) -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ , bOutsideChanged(false) -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ { } diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h index 550f1d40bf..153d0a903e 100644 --- a/xfa/fwl/cfwl_widgetmgr.h +++ b/xfa/fwl/cfwl_widgetmgr.h @@ -81,9 +81,9 @@ class CFWL_WidgetMgr { CFWL_Widget* const pWidget; std::unique_ptr<CXFA_Graphics> pOffscreen; int32_t iRedrawCounter; -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ bool bOutsideChanged; -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ }; CFWL_Widget* GetFirstSiblingWidget(CFWL_Widget* pWidget) const; @@ -114,9 +114,9 @@ class CFWL_WidgetMgr { uint32_t m_dwCapability; std::map<CFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem; UnownedPtr<CXFA_FWLAdapterWidgetMgr> const m_pAdapter; -#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ CFX_RectF m_rtScreen; -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ }; #endif // XFA_FWL_CFWL_WIDGETMGR_H_ |