From 34965459f4f53a77f6c925292304eface57d12c6 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 18 Jul 2016 13:14:49 -0700 Subject: Cleanup fgas/crt. This CL removes unused methods and default parameters from the fgas/crt code. Review-Url: https://codereview.chromium.org/2162503003 --- xfa/fde/cfde_txtedtpage.cpp | 3 ++- xfa/fde/css/fde_css.h | 2 -- xfa/fde/css/fde_csscache.cpp | 4 ++-- xfa/fde/css/fde_csscache.h | 5 ++--- xfa/fde/css/fde_cssstylesheet.cpp | 16 +++++++++------- xfa/fde/css/fde_cssstylesheet.h | 22 +++++++++++----------- xfa/fde/css/fde_csssyntax.cpp | 5 ++++- xfa/fde/fde_iterator.cpp | 7 ++++--- xfa/fde/tto/fde_textout.cpp | 4 ++-- xfa/fde/xml/fde_xml_imp.cpp | 4 ++-- xfa/fde/xml/fde_xml_imp.h | 2 +- 11 files changed, 39 insertions(+), 35 deletions(-) (limited to 'xfa/fde') diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index 3af29f26cd..a31997fc65 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -30,6 +30,7 @@ IFDE_TxtEdtPage* IFDE_TxtEdtPage::Create(CFDE_TxtEdtEngine* pEngine, CFDE_TxtEdtPage::CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nPageIndex) : m_pTextSet(nullptr), + m_PieceMassArr(100), m_pBgnParag(nullptr), m_pEndParag(nullptr), m_nRefCount(0), @@ -446,7 +447,7 @@ void CFDE_TxtEdtPage::UnloadPage(const CFX_RectF* pClipBox) { if (m_nRefCount != 0) return; - m_PieceMassArr.RemoveAll(); + m_PieceMassArr.RemoveAll(FALSE); delete m_pTextSet; m_pTextSet = nullptr; delete[] m_pCharWidth; diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index a0ede3d9f7..74a0ef609a 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -718,8 +718,6 @@ class IFDE_CSSRule { virtual FDE_CSSRULETYPE GetType() const = 0; }; -typedef CFX_MassArrayTemplate CFDE_CSSRuleArray; - class IFDE_CSSStyleRule : public IFDE_CSSRule { public: // IFDE_CSSValue diff --git a/xfa/fde/css/fde_csscache.cpp b/xfa/fde/css/fde_csscache.cpp index a355a43c61..2343c993a2 100644 --- a/xfa/fde/css/fde_csscache.cpp +++ b/xfa/fde/css/fde_csscache.cpp @@ -53,12 +53,12 @@ FDE_CSSTagCache::FDE_CSSTagCache(const FDE_CSSTagCache& it) iClassIndex(0), dwClassHashs(1) { if (it.dwClassHashs.GetSize() > 0) - dwClassHashs.Copy(it.dwClassHashs); + dwClassHashs.Copy(it.dwClassHashs, 0, -1); } FDE_CSSTagCache::~FDE_CSSTagCache() {} -CFDE_CSSAccelerator::CFDE_CSSAccelerator() {} +CFDE_CSSAccelerator::CFDE_CSSAccelerator() : m_Stack(100) {} CFDE_CSSAccelerator::~CFDE_CSSAccelerator() {} diff --git a/xfa/fde/css/fde_csscache.h b/xfa/fde/css/fde_csscache.h index bab86ea880..8f4f2a78c7 100644 --- a/xfa/fde/css/fde_csscache.h +++ b/xfa/fde/css/fde_csscache.h @@ -49,7 +49,6 @@ class FDE_CSSTagCache : public CFX_Target { int32_t iClassIndex; CFX_BaseArrayTemplate dwClassHashs; }; -typedef CFX_ObjectStackTemplate CFDE_CSSTagStack; class CFDE_CSSAccelerator : public CFX_Target { public: @@ -59,12 +58,12 @@ class CFDE_CSSAccelerator : public CFX_Target { void OnEnterTag(CXFA_CSSTagProvider* pTag); void OnLeaveTag(CXFA_CSSTagProvider* pTag); - void Clear() { m_Stack.RemoveAll(); } + void Clear() { m_Stack.RemoveAll(FALSE); } FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } protected: - CFDE_CSSTagStack m_Stack; + CFX_ObjectStackTemplate m_Stack; }; #endif // XFA_FDE_CSS_FDE_CSSCACHE_H_ diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index 87137c4259..99beab8cf6 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -78,7 +78,8 @@ CFDE_CSSStyleSheet::CFDE_CSSStyleSheet(uint32_t dwMediaList) : m_wCodePage(FX_CODEPAGE_UTF8), m_wRefCount(1), m_dwMediaList(dwMediaList), - m_pAllocator(nullptr) { + m_pAllocator(nullptr), + m_RuleArray(100) { ASSERT(m_dwMediaList > 0); } @@ -104,7 +105,7 @@ void CFDE_CSSStyleSheet::Reset() { break; } } - m_RuleArray.RemoveAll(); + m_RuleArray.RemoveAll(FALSE); m_Selectors.RemoveAll(); m_StringCache.clear(); delete m_pAllocator; @@ -241,7 +242,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule( FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule( CFDE_CSSSyntaxParser* pSyntax, - CFDE_CSSRuleArray& ruleArray) { + CFX_MassArrayTemplate& ruleArray) { m_Selectors.RemoveAt(0, m_Selectors.GetSize()); CFDE_CSSStyleRule* pStyleRule = nullptr; const FX_WCHAR* pszValue = nullptr; @@ -306,7 +307,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule( FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule( CFDE_CSSSyntaxParser* pSyntax, - CFDE_CSSRuleArray& ruleArray) { + CFX_MassArrayTemplate& ruleArray) { CFDE_CSSFontFaceRule* pFontFaceRule = nullptr; const FX_WCHAR* pszValue = nullptr; int32_t iValueLen = 0; @@ -392,8 +393,9 @@ CFDE_CSSDeclaration* CFDE_CSSStyleRule::GetDeclaration() { return &m_Declaration; } -void CFDE_CSSStyleRule::SetSelector(IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSSelectorArray& list) { +void CFDE_CSSStyleRule::SetSelector( + IFX_MemoryAllocator* pStaticStore, + const CFX_ArrayTemplate& list) { ASSERT(!m_ppSelector); m_iSelectors = list.GetSize(); m_ppSelector = static_cast( @@ -404,7 +406,7 @@ void CFDE_CSSStyleRule::SetSelector(IFX_MemoryAllocator* pStaticStore, } CFDE_CSSMediaRule::CFDE_CSSMediaRule(uint32_t dwMediaList) - : m_dwMediaList(dwMediaList) {} + : m_dwMediaList(dwMediaList), m_RuleArray(100) {} CFDE_CSSMediaRule::~CFDE_CSSMediaRule() { for (int32_t i = m_RuleArray.GetSize() - 1; i >= 0; --i) { diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index 83eac993e7..d4781f8a8d 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -39,8 +39,6 @@ class CFDE_CSSSelector : public CFX_Target { CFDE_CSSSelector* m_pNext; }; -typedef CFX_ArrayTemplate CFDE_CSSSelectorArray; - class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target { public: CFDE_CSSStyleRule(); @@ -52,7 +50,7 @@ class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target { CFDE_CSSDeclaration& GetDeclImp() { return m_Declaration; } void SetSelector(IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSSelectorArray& list); + const CFX_ArrayTemplate& list); protected: CFDE_CSSDeclaration m_Declaration; @@ -70,11 +68,11 @@ class CFDE_CSSMediaRule : public IFDE_CSSMediaRule, public CFX_Target { int32_t CountRules() const override; IFDE_CSSRule* GetRule(int32_t index) override; - CFDE_CSSRuleArray& GetArray() { return m_RuleArray; } + CFX_MassArrayTemplate& GetArray() { return m_RuleArray; } protected: uint32_t m_dwMediaList; - CFDE_CSSRuleArray m_RuleArray; + CFX_MassArrayTemplate m_RuleArray; }; class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule, public CFX_Target { @@ -122,21 +120,23 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { protected: void Reset(); FX_BOOL LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax); - FDE_CSSSYNTAXSTATUS LoadStyleRule(CFDE_CSSSyntaxParser* pSyntax, - CFDE_CSSRuleArray& ruleArray); + FDE_CSSSYNTAXSTATUS LoadStyleRule( + CFDE_CSSSyntaxParser* pSyntax, + CFX_MassArrayTemplate& ruleArray); FDE_CSSSYNTAXSTATUS LoadImportRule(CFDE_CSSSyntaxParser* pSyntax); FDE_CSSSYNTAXSTATUS LoadPageRule(CFDE_CSSSyntaxParser* pSyntax); FDE_CSSSYNTAXSTATUS LoadMediaRule(CFDE_CSSSyntaxParser* pSyntax); - FDE_CSSSYNTAXSTATUS LoadFontFaceRule(CFDE_CSSSyntaxParser* pSyntax, - CFDE_CSSRuleArray& ruleArray); + FDE_CSSSYNTAXSTATUS LoadFontFaceRule( + CFDE_CSSSyntaxParser* pSyntax, + CFX_MassArrayTemplate& ruleArray); FDE_CSSSYNTAXSTATUS SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax); uint16_t m_wCodePage; uint16_t m_wRefCount; uint32_t m_dwMediaList; IFX_MemoryAllocator* m_pAllocator; - CFDE_CSSRuleArray m_RuleArray; + CFX_MassArrayTemplate m_RuleArray; CFX_WideString m_szUrl; - CFDE_CSSSelectorArray m_Selectors; + CFX_ArrayTemplate m_Selectors; std::unordered_map m_StringCache; }; diff --git a/xfa/fde/css/fde_csssyntax.cpp b/xfa/fde/css/fde_csssyntax.cpp index 4595396c13..c2b0265a6e 100644 --- a/xfa/fde/css/fde_csssyntax.cpp +++ b/xfa/fde/css/fde_csssyntax.cpp @@ -25,11 +25,14 @@ CFDE_CSSSyntaxParser::CFDE_CSSSyntaxParser() m_iTextDatLen(0), m_dwCheck((uint32_t)-1), m_eMode(FDE_CSSSYNTAXMODE_RuleSet), - m_eStatus(FDE_CSSSYNTAXSTATUS_None) {} + m_eStatus(FDE_CSSSYNTAXSTATUS_None), + m_ModeStack(100) {} + CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() { m_TextData.Reset(); m_TextPlane.Reset(); } + FX_BOOL CFDE_CSSSyntaxParser::Init(IFX_Stream* pStream, int32_t iCSSPlaneSize, int32_t iTextDataSize, diff --git a/xfa/fde/fde_iterator.cpp b/xfa/fde/fde_iterator.cpp index 6e8ca0061a..a51b8ad90a 100644 --- a/xfa/fde/fde_iterator.cpp +++ b/xfa/fde/fde_iterator.cpp @@ -8,16 +8,17 @@ #include "xfa/fgas/crt/fgas_utils.h" -CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {} +CFDE_VisualSetIterator::CFDE_VisualSetIterator() + : m_dwFilter(0), m_CanvasStack(100) {} CFDE_VisualSetIterator::~CFDE_VisualSetIterator() { - m_CanvasStack.RemoveAll(); + m_CanvasStack.RemoveAll(FALSE); } FX_BOOL CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) { ASSERT(pCanvas); - m_CanvasStack.RemoveAll(); + m_CanvasStack.RemoveAll(FALSE); FDE_CANVASITEM canvas; canvas.hCanvas = nullptr; canvas.pCanvas = pCanvas; diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index b0c4bdd234..a29a420216 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -51,7 +51,7 @@ CFDE_TextOut::~CFDE_TextOut() { FX_Free(m_pCharWidths); FX_Free(m_pEllCharWidths); FX_Free(m_pCharPos); - m_ttoLines.RemoveAll(); + m_ttoLines.RemoveAll(FALSE); } void CFDE_TextOut::SetFont(CFGAS_GEFont* pFont) { ASSERT(pFont); @@ -907,7 +907,7 @@ CFDE_TTOLine::CFDE_TTOLine() CFDE_TTOLine::CFDE_TTOLine(const CFDE_TTOLine& ttoLine) : m_pieces(5) { m_bNewReload = ttoLine.m_bNewReload; m_iPieceCount = ttoLine.m_iPieceCount; - m_pieces.Copy(ttoLine.m_pieces); + m_pieces.Copy(ttoLine.m_pieces, 0, -1); } CFDE_TTOLine::~CFDE_TTOLine() {} diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp index da7e0a2fca..4c6dcf989c 100644 --- a/xfa/fde/xml/fde_xml_imp.cpp +++ b/xfa/fde/xml/fde_xml_imp.cpp @@ -625,7 +625,7 @@ FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName, int32_t iCount = m_Attributes.GetSize(); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { - return FX_wcstof(m_Attributes[i + 1].c_str()); + return FX_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr); } } return fDefValue; @@ -841,7 +841,7 @@ FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName, int32_t iCount = m_Attributes.GetSize(); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { - return FX_wcstof(m_Attributes[i + 1].c_str()); + return FX_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr); } } return fDefValue; diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h index 2667a106b7..b7892d6ff4 100644 --- a/xfa/fde/xml/fde_xml_imp.h +++ b/xfa/fde/xml/fde_xml_imp.h @@ -344,7 +344,7 @@ class CFDE_XMLSyntaxParser : public CFX_Target { FDE_XmlSyntaxState m_syntaxParserState; FX_WCHAR m_wQuotationMark; int32_t m_iEntityStart; - CFX_DWordStack m_SkipStack; + CFX_StackTemplate m_SkipStack; FX_WCHAR m_SkipChar; }; -- cgit v1.2.3