diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-13 16:43:37 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-14 14:14:51 +0000 |
commit | 812e96c2b4c5908a1979da5e27cdcecda0d1dfc9 (patch) | |
tree | f0b0607f6b757eb22237527215094bd87b5d03ba /xfa/fde/css | |
parent | 893822aa5b6254591f8e80fbffcbb4fa6ad849aa (diff) | |
download | pdfium-812e96c2b4c5908a1979da5e27cdcecda0d1dfc9.tar.xz |
Replace FX_CHAR and FX_WCHAR with underlying types.
Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8
Reviewed-on: https://pdfium-review.googlesource.com/2967
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde/css')
-rw-r--r-- | xfa/fde/css/cfde_cssdeclaration.cpp | 26 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssdeclaration.h | 20 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssselector.cpp | 18 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssselector.h | 2 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssstylesheet.cpp | 2 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssstylesheet.h | 4 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssstylesheet_unittest.cpp | 8 | ||||
-rw-r--r-- | xfa/fde/css/cfde_csssyntaxparser.cpp | 8 | ||||
-rw-r--r-- | xfa/fde/css/cfde_csssyntaxparser.h | 4 | ||||
-rw-r--r-- | xfa/fde/css/cfde_csstextbuf.cpp | 10 | ||||
-rw-r--r-- | xfa/fde/css/cfde_csstextbuf.h | 14 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssvaluelistparser.cpp | 12 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssvaluelistparser.h | 14 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp | 8 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdatatable.h | 4 |
15 files changed, 76 insertions, 78 deletions
diff --git a/xfa/fde/css/cfde_cssdeclaration.cpp b/xfa/fde/css/cfde_cssdeclaration.cpp index 3c776ca771..2d1e707caa 100644 --- a/xfa/fde/css/cfde_cssdeclaration.cpp +++ b/xfa/fde/css/cfde_cssdeclaration.cpp @@ -23,7 +23,7 @@ uint8_t Hex2Dec(uint8_t hexHigh, uint8_t hexLow) { return (FXSYS_toHexDigit(hexHigh) << 4) + FXSYS_toHexDigit(hexLow); } -bool ParseCSSNumber(const FX_WCHAR* pszValue, +bool ParseCSSNumber(const wchar_t* pszValue, int32_t iValueLen, FX_FLOAT& fValue, FDE_CSSNumberType& eUnit) { @@ -50,7 +50,7 @@ bool ParseCSSNumber(const FX_WCHAR* pszValue, } // namespace // static -bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, +bool CFDE_CSSDeclaration::ParseCSSString(const wchar_t* pszValue, int32_t iValueLen, int32_t* iOffset, int32_t* iLength) { @@ -58,7 +58,7 @@ bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, *iOffset = 0; *iLength = iValueLen; if (iValueLen >= 2) { - FX_WCHAR first = pszValue[0], last = pszValue[iValueLen - 1]; + wchar_t first = pszValue[0], last = pszValue[iValueLen - 1]; if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) { *iOffset = 1; *iLength -= 2; @@ -68,7 +68,7 @@ bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, } // static. -bool CFDE_CSSDeclaration::ParseCSSColor(const FX_WCHAR* pszValue, +bool CFDE_CSSDeclaration::ParseCSSColor(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor) { ASSERT(pszValue && iValueLen > 0); @@ -159,7 +159,7 @@ void CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyTable* pTable, const CFX_WideStringC& value) { ASSERT(!value.IsEmpty()); - const FX_WCHAR* pszValue = value.c_str(); + const wchar_t* pszValue = value.c_str(); int32_t iValueLen = value.GetLength(); bool bImportant = false; @@ -277,7 +277,7 @@ void CFDE_CSSDeclaration::AddProperty(const CFX_WideString& prop, } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { FX_FLOAT fValue; FDE_CSSNumberType eUnit; @@ -287,7 +287,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseEnum( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); @@ -296,7 +296,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseEnum( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseColor( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { FX_ARGB dwColor; if (!ParseCSSColor(pszValue, iValueLen, &dwColor)) @@ -305,7 +305,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseColor( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseString( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { int32_t iOffset; if (!ParseCSSString(pszValue, iValueLen, &iOffset, &iValueLen)) @@ -320,10 +320,10 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseString( void CFDE_CSSDeclaration::ParseValueListProperty( const FDE_CSSPropertyTable* pTable, - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, bool bImportant) { - FX_WCHAR separator = + wchar_t separator = (pTable->eName == FDE_CSSProperty::FontFamily) ? ',' : ' '; CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); @@ -444,7 +444,7 @@ void CFDE_CSSDeclaration::Add4ValuesProperty( } bool CFDE_CSSDeclaration::ParseBorderProperty( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, CFX_RetainPtr<CFDE_CSSValue>& pWidth) const { pWidth.Reset(nullptr); @@ -497,7 +497,7 @@ bool CFDE_CSSDeclaration::ParseBorderProperty( return true; } -void CFDE_CSSDeclaration::ParseFontProperty(const FX_WCHAR* pszValue, +void CFDE_CSSDeclaration::ParseFontProperty(const wchar_t* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); diff --git a/xfa/fde/css/cfde_cssdeclaration.h b/xfa/fde/css/cfde_cssdeclaration.h index eb287308f8..3c2e058a43 100644 --- a/xfa/fde/css/cfde_cssdeclaration.h +++ b/xfa/fde/css/cfde_cssdeclaration.h @@ -23,11 +23,11 @@ class CFDE_CSSDeclaration { using const_custom_iterator = std::vector<std::unique_ptr<CFDE_CSSCustomProperty>>::const_iterator; - static bool ParseCSSString(const FX_WCHAR* pszValue, + static bool ParseCSSString(const wchar_t* pszValue, int32_t iValueLen, int32_t* iOffset, int32_t* iLength); - static bool ParseCSSColor(const FX_WCHAR* pszValue, + static bool ParseCSSColor(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor); @@ -53,19 +53,19 @@ class CFDE_CSSDeclaration { size_t PropertyCountForTesting() const; - FX_ARGB ParseColorForTest(const FX_WCHAR* pszValue, + FX_ARGB ParseColorForTest(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor) const; private: - void ParseFontProperty(const FX_WCHAR* pszValue, + void ParseFontProperty(const wchar_t* pszValue, int32_t iValueLen, bool bImportant); - bool ParseBorderProperty(const FX_WCHAR* pszValue, + bool ParseBorderProperty(const wchar_t* pszValue, int32_t iValueLen, CFX_RetainPtr<CFDE_CSSValue>& pWidth) const; void ParseValueListProperty(const FDE_CSSPropertyTable* pTable, - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, bool bImportant); void Add4ValuesProperty(const std::vector<CFX_RetainPtr<CFDE_CSSValue>>& list, @@ -74,13 +74,13 @@ class CFDE_CSSDeclaration { FDE_CSSProperty eTop, FDE_CSSProperty eRight, FDE_CSSProperty eBottom); - CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseColor(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseColor(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseString(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseString(const wchar_t* pszValue, int32_t iValueLen); void AddPropertyHolder(FDE_CSSProperty eProperty, CFX_RetainPtr<CFDE_CSSValue> pValue, diff --git a/xfa/fde/css/cfde_cssselector.cpp b/xfa/fde/css/cfde_cssselector.cpp index 03580236f5..6842d58738 100644 --- a/xfa/fde/css/cfde_cssselector.cpp +++ b/xfa/fde/css/cfde_cssselector.cpp @@ -12,14 +12,14 @@ namespace { -bool IsCSSChar(FX_WCHAR wch) { +bool IsCSSChar(wchar_t wch) { return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } -int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { - const FX_WCHAR* pStart = psz; +int32_t GetCSSNameLen(const wchar_t* psz, const wchar_t* pEnd) { + const wchar_t* pStart = psz; while (psz < pEnd) { - FX_WCHAR wch = *psz; + wchar_t wch = *psz; if (IsCSSChar(wch) || (wch >= '0' && wch <= '9') || wch == '_' || wch == '-') { ++psz; @@ -33,7 +33,7 @@ int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { } // namespace CFDE_CSSSelector::CFDE_CSSSelector(FDE_CSSSelectorType eType, - const FX_WCHAR* psz, + const wchar_t* psz, int32_t iLen, bool bIgnoreCase) : m_eType(eType), @@ -58,9 +58,9 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString( const CFX_WideStringC& str) { ASSERT(!str.IsEmpty()); - const FX_WCHAR* psz = str.c_str(); - const FX_WCHAR* pStart = psz; - const FX_WCHAR* pEnd = psz + str.GetLength(); + const wchar_t* psz = str.c_str(); + const wchar_t* pStart = psz; + const wchar_t* pEnd = psz + str.GetLength(); for (; psz < pEnd; ++psz) { switch (*psz) { case '>': @@ -72,7 +72,7 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString( std::unique_ptr<CFDE_CSSSelector> pFirst = nullptr; for (psz = pStart; psz < pEnd;) { - FX_WCHAR wch = *psz; + wchar_t wch = *psz; if (IsCSSChar(wch) || wch == '*') { int32_t iNameLen = wch == '*' ? 1 : GetCSSNameLen(psz, pEnd); auto p = pdfium::MakeUnique<CFDE_CSSSelector>( diff --git a/xfa/fde/css/cfde_cssselector.h b/xfa/fde/css/cfde_cssselector.h index d585b3f368..048c51339e 100644 --- a/xfa/fde/css/cfde_cssselector.h +++ b/xfa/fde/css/cfde_cssselector.h @@ -19,7 +19,7 @@ class CFDE_CSSSelector { const CFX_WideStringC& str); CFDE_CSSSelector(FDE_CSSSelectorType eType, - const FX_WCHAR* psz, + const wchar_t* psz, int32_t iLen, bool bIgnoreCase); ~CFDE_CSSSelector(); diff --git a/xfa/fde/css/cfde_cssstylesheet.cpp b/xfa/fde/css/cfde_cssstylesheet.cpp index e259e2f332..175289be11 100644 --- a/xfa/fde/css/cfde_cssstylesheet.cpp +++ b/xfa/fde/css/cfde_cssstylesheet.cpp @@ -34,7 +34,7 @@ CFDE_CSSStyleRule* CFDE_CSSStyleSheet::GetRule(int32_t index) const { return m_RuleArray[index].get(); } -bool CFDE_CSSStyleSheet::LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize) { +bool CFDE_CSSStyleSheet::LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize) { ASSERT(pBuffer && iBufSize > 0); auto pSyntax = pdfium::MakeUnique<CFDE_CSSSyntaxParser>(); diff --git a/xfa/fde/css/cfde_cssstylesheet.h b/xfa/fde/css/cfde_cssstylesheet.h index 4de377219c..fa73460634 100644 --- a/xfa/fde/css/cfde_cssstylesheet.h +++ b/xfa/fde/css/cfde_cssstylesheet.h @@ -21,7 +21,7 @@ class CFDE_CSSStyleSheet { CFDE_CSSStyleSheet(); ~CFDE_CSSStyleSheet(); - bool LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize); + bool LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize); int32_t CountRules() const; CFDE_CSSStyleRule* GetRule(int32_t index) const; @@ -34,7 +34,7 @@ class CFDE_CSSStyleSheet { void SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax); std::vector<std::unique_ptr<CFDE_CSSStyleRule>> m_RuleArray; - std::unordered_map<uint32_t, FX_WCHAR*> m_StringCache; + std::unordered_map<uint32_t, wchar_t*> m_StringCache; }; #endif // XFA_FDE_CSS_CFDE_CSSSTYLESHEET_H_ diff --git a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp index 9d8ecb9347..0f450e9c3a 100644 --- a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp +++ b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp @@ -27,7 +27,7 @@ class CFDE_CSSStyleSheetTest : public testing::Test { void TearDown() override { decl_ = nullptr; } - void LoadAndVerifyDecl(const FX_WCHAR* buf, + void LoadAndVerifyDecl(const wchar_t* buf, const std::vector<CFX_WideString>& selectors, size_t decl_count) { ASSERT(sheet_); @@ -87,7 +87,7 @@ class CFDE_CSSStyleSheetTest : public testing::Test { }; TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) { - const FX_WCHAR* buf = + const wchar_t* buf = L"a { border: 10px; }\nb { text-decoration: underline; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(2, sheet_->CountRules()); @@ -136,7 +136,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) { } TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) { - const FX_WCHAR* buf = L"a b c { border: 10px; }"; + const wchar_t* buf = L"a b c { border: 10px; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(1, sheet_->CountRules()); @@ -171,7 +171,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) { } TEST_F(CFDE_CSSStyleSheetTest, ParseUnhandledSelectors) { - const FX_WCHAR* buf = L"a > b { padding: 0; }"; + const wchar_t* buf = L"a > b { padding: 0; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(0, sheet_->CountRules()); diff --git a/xfa/fde/css/cfde_csssyntaxparser.cpp b/xfa/fde/css/cfde_csssyntaxparser.cpp index 2f7bcce9d7..fada76b6b1 100644 --- a/xfa/fde/css/cfde_csssyntaxparser.cpp +++ b/xfa/fde/css/cfde_csssyntaxparser.cpp @@ -14,7 +14,7 @@ namespace { -bool IsSelectorStart(FX_WCHAR wch) { +bool IsSelectorStart(wchar_t wch) { return wch == '.' || wch == '#' || wch == '*' || (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } @@ -32,7 +32,7 @@ CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() { m_TextPlane.Reset(); } -bool CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer, +bool CFDE_CSSSyntaxParser::Init(const wchar_t* pBuffer, int32_t iBufferSize, int32_t iTextDatSize, bool bOnlyDeclaration) { @@ -65,7 +65,7 @@ FDE_CSSSyntaxStatus CFDE_CSSSyntaxParser::DoSyntaxParse() { m_eStatus = FDE_CSSSyntaxStatus::EOS; return m_eStatus; } - FX_WCHAR wch; + wchar_t wch; while (!m_TextPlane.IsEOF()) { wch = m_TextPlane.GetChar(); switch (m_eMode) { @@ -198,7 +198,7 @@ bool CFDE_CSSSyntaxParser::IsImportEnabled() const { return true; } -bool CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) { +bool CFDE_CSSSyntaxParser::AppendChar(wchar_t wch) { m_TextPlane.MoveNext(); if (m_TextData.GetLength() > 0 || wch > ' ') { m_TextData.AppendChar(wch); diff --git a/xfa/fde/css/cfde_csssyntaxparser.h b/xfa/fde/css/cfde_csssyntaxparser.h index b583b98b15..a5e79d50e5 100644 --- a/xfa/fde/css/cfde_csssyntaxparser.h +++ b/xfa/fde/css/cfde_csssyntaxparser.h @@ -40,7 +40,7 @@ class CFDE_CSSSyntaxParser { CFDE_CSSSyntaxParser(); ~CFDE_CSSSyntaxParser(); - bool Init(const FX_WCHAR* pBuffer, + bool Init(const wchar_t* pBuffer, int32_t iBufferSize, int32_t iTextDatSize = 32, bool bOnlyDeclaration = false); @@ -53,7 +53,7 @@ class CFDE_CSSSyntaxParser { int32_t SwitchToComment(); bool RestoreMode(); - bool AppendChar(FX_WCHAR wch); + bool AppendChar(wchar_t wch); int32_t SaveTextData(); bool IsCharsetEnabled() const { return (m_dwCheck & FDE_CSSSYNTAXCHECK_AllowCharset) != 0; diff --git a/xfa/fde/css/cfde_csstextbuf.cpp b/xfa/fde/css/cfde_csstextbuf.cpp index 83b2899f19..5df09f0936 100644 --- a/xfa/fde/css/cfde_csstextbuf.cpp +++ b/xfa/fde/css/cfde_csstextbuf.cpp @@ -27,9 +27,9 @@ void CFDE_CSSTextBuf::Reset() { m_iDatPos = m_iDatLen = m_iBufLen; } -bool CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen) { +bool CFDE_CSSTextBuf::AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen) { Reset(); - m_pBuffer = const_cast<FX_WCHAR*>(pBuffer); + m_pBuffer = const_cast<wchar_t*>(pBuffer); m_iDatLen = m_iBufLen = iBufLen; return m_bExtBuf = true; } @@ -63,9 +63,9 @@ bool CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) { if (m_bExtBuf) return false; if (!m_pBuffer) - m_pBuffer = FX_Alloc(FX_WCHAR, iDesiredSize); + m_pBuffer = FX_Alloc(wchar_t, iDesiredSize); else if (m_iBufLen != iDesiredSize) - m_pBuffer = FX_Realloc(FX_WCHAR, m_pBuffer, iDesiredSize); + m_pBuffer = FX_Realloc(wchar_t, m_pBuffer, iDesiredSize); else return true; @@ -81,6 +81,6 @@ void CFDE_CSSTextBuf::Subtract(int32_t iStart, int32_t iLength) { ASSERT(iStart >= 0 && iLength >= 0); iLength = std::max(std::min(iLength, m_iDatLen - iStart), 0); - FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(FX_WCHAR)); + FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(wchar_t)); m_iDatLen = iLength; } diff --git a/xfa/fde/css/cfde_csstextbuf.h b/xfa/fde/css/cfde_csstextbuf.h index df151e02d8..9ade44be8a 100644 --- a/xfa/fde/css/cfde_csstextbuf.h +++ b/xfa/fde/css/cfde_csstextbuf.h @@ -17,13 +17,13 @@ class CFDE_CSSTextBuf { CFDE_CSSTextBuf(); ~CFDE_CSSTextBuf(); - bool AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); + bool AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen); bool EstimateSize(int32_t iAllocSize); int32_t LoadFromStream(const CFX_RetainPtr<IFGAS_Stream>& pTxtStream, int32_t iStreamOffset, int32_t iMaxChars, bool& bEOS); - bool AppendChar(FX_WCHAR wch) { + bool AppendChar(wchar_t wch) { if (m_iDatLen >= m_iBufLen && !ExpandBuf(m_iBufLen * 2)) return false; m_pBuffer[m_iDatLen++] = wch; @@ -43,21 +43,21 @@ class CFDE_CSSTextBuf { void Subtract(int32_t iStart, int32_t iLength); bool IsEOF() const { return m_iDatPos >= m_iDatLen; } - FX_WCHAR GetAt(int32_t index) const { return m_pBuffer[index]; } - FX_WCHAR GetChar() const { return m_pBuffer[m_iDatPos]; } - FX_WCHAR GetNextChar() const { + wchar_t GetAt(int32_t index) const { return m_pBuffer[index]; } + wchar_t GetChar() const { return m_pBuffer[m_iDatPos]; } + wchar_t GetNextChar() const { return (m_iDatPos + 1 >= m_iDatLen) ? 0 : m_pBuffer[m_iDatPos + 1]; } void MoveNext() { m_iDatPos++; } int32_t GetLength() const { return m_iDatLen; } - const FX_WCHAR* GetBuffer() const { return m_pBuffer; } + const wchar_t* GetBuffer() const { return m_pBuffer; } protected: bool ExpandBuf(int32_t iDesiredSize); bool m_bExtBuf; - FX_WCHAR* m_pBuffer; + wchar_t* m_pBuffer; int32_t m_iBufLen; int32_t m_iDatLen; int32_t m_iDatPos; diff --git a/xfa/fde/css/cfde_cssvaluelistparser.cpp b/xfa/fde/css/cfde_cssvaluelistparser.cpp index 42c3296865..36d5edc3c7 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser.cpp +++ b/xfa/fde/css/cfde_cssvaluelistparser.cpp @@ -6,15 +6,15 @@ #include "xfa/fde/css/cfde_cssvaluelistparser.h" -CFDE_CSSValueListParser::CFDE_CSSValueListParser(const FX_WCHAR* psz, +CFDE_CSSValueListParser::CFDE_CSSValueListParser(const wchar_t* psz, int32_t iLen, - FX_WCHAR separator) + wchar_t separator) : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { ASSERT(psz && iLen > 0); } bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, - const FX_WCHAR*& pStart, + const wchar_t*& pStart, int32_t& iLength) { while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) ++m_pCur; @@ -25,7 +25,7 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, eType = FDE_CSSPrimitiveType::Unknown; pStart = m_pCur; iLength = 0; - FX_WCHAR wch = *m_pCur; + wchar_t wch = *m_pCur; if (wch == '#') { iLength = SkipTo(' ', false, false); if (iLength == 4 || iLength == 7) @@ -56,10 +56,10 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, return m_pCur <= m_pEnd && iLength > 0; } -int32_t CFDE_CSSValueListParser::SkipTo(FX_WCHAR wch, +int32_t CFDE_CSSValueListParser::SkipTo(wchar_t wch, bool breakOnSpace, bool matchBrackets) { - const FX_WCHAR* pStart = m_pCur; + const wchar_t* pStart = m_pCur; int32_t bracketCount = 0; while (m_pCur < m_pEnd && *m_pCur != wch) { if (breakOnSpace && *m_pCur <= ' ') diff --git a/xfa/fde/css/cfde_cssvaluelistparser.h b/xfa/fde/css/cfde_cssvaluelistparser.h index 734aed8a52..e41ee5c313 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser.h +++ b/xfa/fde/css/cfde_cssvaluelistparser.h @@ -12,21 +12,19 @@ class CFDE_CSSValueListParser { public: - CFDE_CSSValueListParser(const FX_WCHAR* psz, - int32_t iLen, - FX_WCHAR separator); + CFDE_CSSValueListParser(const wchar_t* psz, int32_t iLen, wchar_t separator); bool NextValue(FDE_CSSPrimitiveType& eType, - const FX_WCHAR*& pStart, + const wchar_t*& pStart, int32_t& iLength); - FX_WCHAR m_Separator; + wchar_t m_Separator; private: - int32_t SkipTo(FX_WCHAR wch, bool breakOnSpace, bool matchBrackets); + int32_t SkipTo(wchar_t wch, bool breakOnSpace, bool matchBrackets); - const FX_WCHAR* m_pCur; - const FX_WCHAR* m_pEnd; + const wchar_t* m_pCur; + const wchar_t* m_pEnd; }; #endif // XFA_FDE_CSS_CFDE_CSSVALUELISTPARSER_H_ diff --git a/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp b/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp index 71bb807f3d..2864c842ad 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp +++ b/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp @@ -11,7 +11,7 @@ TEST(CFDE_CSSValueListParser, rgb_short) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = pdfium::MakeUnique<CFDE_CSSValueListParser>(L"#abc", 4, L' '); @@ -42,7 +42,7 @@ TEST(CFDE_CSSValueListParser, rgb_short) { TEST(CFDE_CSSValueListParser, number_parsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = pdfium::MakeUnique<CFDE_CSSValueListParser>(L"1234", 4, L' '); @@ -84,7 +84,7 @@ TEST(CFDE_CSSValueListParser, number_parsing) { TEST(CFDE_CSSValueListParser, string_parsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = @@ -107,7 +107,7 @@ TEST(CFDE_CSSValueListParser, string_parsing) { TEST(CFDE_CSSValueListParser, multiparsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index afb0b8502d..d1745f5d50 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -20,14 +20,14 @@ struct FDE_CSSPropertyTable { FDE_CSSProperty eName; - const FX_WCHAR* pszName; + const wchar_t* pszName; uint32_t dwHash; uint32_t dwType; }; struct FDE_CSSPropertyValueTable { FDE_CSSPropertyValue eName; - const FX_WCHAR* pszName; + const wchar_t* pszName; uint32_t dwHash; }; |