From 698aed79d6ad6e8e3a0c7a500c108d69f944b82d Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 26 Sep 2017 16:24:49 -0400 Subject: Cleanup FX macros This CL renames the FX_OS defines to have _OS_ in their names and drops the _DESKTOP suffix. The FXM defines have been changed to just FX. Change-Id: Iab172fba541713b5f6d14fb8098baf68e3364c74 Reviewed-on: https://pdfium-review.googlesource.com/14833 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fpdfdoc/cpdf_filespec.cpp | 16 ++++++++-------- core/fpdfdoc/cpdf_filespec_unittest.cpp | 16 ++++++++-------- core/fpdfdoc/cpdf_interform.cpp | 10 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'core/fpdfdoc') diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp index 803c4148c7..2f999bcf4e 100644 --- a/core/fpdfdoc/cpdf_filespec.cpp +++ b/core/fpdfdoc/cpdf_filespec.cpp @@ -18,13 +18,13 @@ namespace { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ - _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || \ + _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ WideString ChangeSlashToPlatform(const wchar_t* str) { WideString result; while (*str) { if (*str == '/') { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ +#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ result += L':'; #else result += L'\\'; @@ -49,7 +49,7 @@ WideString ChangeSlashToPDF(const wchar_t* str) { } return result; } -#endif // _FXM_PLATFORM_APPLE_ || _FXM_PLATFORM_WINDOWS_ +#endif // _FX_PLATFORM_APPLE_ || _FX_PLATFORM_WINDOWS_ } // namespace @@ -63,11 +63,11 @@ WideString CPDF_FileSpec::DecodeFileName(const WideString& filepath) { if (filepath.GetLength() <= 1) return WideString(); -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ +#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ if (filepath.Left(sizeof("/Mac") - 1) == WideStringView(L"/Mac")) return ChangeSlashToPlatform(filepath.c_str() + 1); return ChangeSlashToPlatform(filepath.c_str()); -#elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ if (filepath[0] != L'/') return ChangeSlashToPlatform(filepath.c_str()); @@ -157,7 +157,7 @@ WideString CPDF_FileSpec::EncodeFileName(const WideString& filepath) { if (filepath.GetLength() <= 1) return WideString(); -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ if (filepath[1] == L':') { WideString result(L'/'); result += filepath[0]; @@ -173,7 +173,7 @@ WideString CPDF_FileSpec::EncodeFileName(const WideString& filepath) { if (filepath[0] == L'\\') return L'/' + ChangeSlashToPDF(filepath.c_str()); return ChangeSlashToPDF(filepath.c_str()); -#elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ +#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ if (filepath.Left(sizeof("Mac") - 1) == L"Mac") return L'/' + ChangeSlashToPDF(filepath.c_str()); return ChangeSlashToPDF(filepath.c_str()); diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp index 8d151c9dd8..5537473e2c 100644 --- a/core/fpdfdoc/cpdf_filespec_unittest.cpp +++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp @@ -22,7 +22,7 @@ TEST(cpdf_filespec, EncodeDecodeFileName) { {L"", L""}, // only file name. {L"test.pdf", L"test.pdf"}, -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ // With drive identifier. {L"r:\\pdfdocs\\spec.pdf", L"/r/pdfdocs/spec.pdf"}, // Relative path. @@ -33,7 +33,7 @@ TEST(cpdf_filespec, EncodeDecodeFileName) { {L"\\\\pdfdocs\\spec.pdf", L"/pdfdocs/spec.pdf"}, // Network resource name. It is not supported yet. // {L"pclib/eng:\\pdfdocs\\spec.pdf", L"/pclib/eng/pdfdocs/spec.pdf"}, -#elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ +#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ // Absolute path with colon separator. {L"Mac HD:PDFDocs:spec.pdf", L"/Mac HD/PDFDocs/spec.pdf"}, // Relative path with colon separator. @@ -60,10 +60,10 @@ TEST(cpdf_filespec, GetFileName) { { // String object. pdfium::NullTermWstrFuncTestData test_data = { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ L"/C/docs/test.pdf", L"C:\\docs\\test.pdf" -#elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ +#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ L"/Mac HD/docs/test.pdf", L"Mac HD:docs:test.pdf" #else @@ -78,13 +78,13 @@ TEST(cpdf_filespec, GetFileName) { { // Dictionary object. pdfium::NullTermWstrFuncTestData test_data[5] = { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ {L"/C/docs/test.pdf", L"C:\\docs\\test.pdf"}, {L"/D/docs/test.pdf", L"D:\\docs\\test.pdf"}, {L"/E/docs/test.pdf", L"E:\\docs\\test.pdf"}, {L"/F/docs/test.pdf", L"F:\\docs\\test.pdf"}, {L"/G/docs/test.pdf", L"G:\\docs\\test.pdf"}, -#elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ +#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ {L"/Mac HD/docs1/test.pdf", L"Mac HD:docs1:test.pdf"}, {L"/Mac HD/docs2/test.pdf", L"Mac HD:docs2:test.pdf"}, {L"/Mac HD/docs3/test.pdf", L"Mac HD:docs3:test.pdf"}, @@ -123,10 +123,10 @@ TEST(cpdf_filespec, GetFileName) { TEST(cpdf_filespec, SetFileName) { pdfium::NullTermWstrFuncTestData test_data = { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ L"C:\\docs\\test.pdf", L"/C/docs/test.pdf" -#elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ +#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ L"Mac HD:docs:test.pdf", L"/Mac HD/docs/test.pdf" #else diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index 3bbb50b9ec..f17e543e70 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -322,7 +322,7 @@ class CFieldNameExtractor { const wchar_t* m_pEnd; }; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ typedef struct { bool bFind; LOGFONTA lf; @@ -368,7 +368,7 @@ bool RetrieveSpecificFont(uint8_t charSet, } return RetrieveSpecificFont(lf); } -#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ int CompareFieldName(const WideString& name1, const WideString& name2) { const wchar_t* ptr1 = name1.c_str(); @@ -578,7 +578,7 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, // static uint8_t CPDF_InterForm::GetNativeCharSet() { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ uint8_t charSet = FX_CHARSET_ANSI; UINT iCodePage = ::GetACP(); switch (iCodePage) { @@ -738,7 +738,7 @@ CPDF_Font* CPDF_InterForm::AddStandardFont(CPDF_Document* pDocument, ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { ByteString csFontName; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ LOGFONTA lf = {}; if (charSet == FX_CHARSET_ANSI) { csFontName = "Helvetica"; @@ -783,7 +783,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, if (!pDocument) return nullptr; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ LOGFONTA lf; ByteString csFontName = GetNativeFont(charSet, &lf); if (!csFontName.IsEmpty()) { -- cgit v1.2.3