summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-07-18 13:14:49 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-18 13:14:49 -0700
commit34965459f4f53a77f6c925292304eface57d12c6 (patch)
tree788cb62af316f8b5c5d520583eaa0313dd48144e /xfa
parentaae4566ee8b2eaffb182861047c466ed1ec04902 (diff)
downloadpdfium-34965459f4f53a77f6c925292304eface57d12c6.tar.xz
Cleanup fgas/crt.
This CL removes unused methods and default parameters from the fgas/crt code. Review-Url: https://codereview.chromium.org/2162503003
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp3
-rw-r--r--xfa/fde/css/fde_css.h2
-rw-r--r--xfa/fde/css/fde_csscache.cpp4
-rw-r--r--xfa/fde/css/fde_csscache.h5
-rw-r--r--xfa/fde/css/fde_cssstylesheet.cpp16
-rw-r--r--xfa/fde/css/fde_cssstylesheet.h22
-rw-r--r--xfa/fde/css/fde_csssyntax.cpp5
-rw-r--r--xfa/fde/fde_iterator.cpp7
-rw-r--r--xfa/fde/tto/fde_textout.cpp4
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp4
-rw-r--r--xfa/fde/xml/fde_xml_imp.h2
-rw-r--r--xfa/fgas/crt/fgas_codepage.cpp40
-rw-r--r--xfa/fgas/crt/fgas_codepage.h4
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp54
-rw-r--r--xfa/fgas/crt/fgas_stream.h19
-rw-r--r--xfa/fgas/crt/fgas_system.h4
-rw-r--r--xfa/fgas/crt/fgas_utils.cpp4
-rw-r--r--xfa/fgas/crt/fgas_utils.h213
-rw-r--r--xfa/fgas/font/fgas_gefont.cpp6
-rw-r--r--xfa/fgas/font/fgas_gefont.h2
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp6
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp2
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_xml_parser.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_basic_imp.cpp3
-rw-r--r--xfa/fxfa/parser/xfa_basic_imp.h3
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_utils.h12
28 files changed, 134 insertions, 318 deletions
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<IFDE_CSSRule*> 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<uint32_t> dwClassHashs;
};
-typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> 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<FDE_CSSTagCache> 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<IFDE_CSSRule*>& 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<IFDE_CSSRule*>& 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<CFDE_CSSSelector*>& list) {
ASSERT(!m_ppSelector);
m_iSelectors = list.GetSize();
m_ppSelector = static_cast<CFDE_CSSSelector**>(
@@ -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_CSSSelector*> 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<CFDE_CSSSelector*>& 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<IFDE_CSSRule*>& GetArray() { return m_RuleArray; }
protected:
uint32_t m_dwMediaList;
- CFDE_CSSRuleArray m_RuleArray;
+ CFX_MassArrayTemplate<IFDE_CSSRule*> 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<IFDE_CSSRule*>& 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<IFDE_CSSRule*>& 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<IFDE_CSSRule*> m_RuleArray;
CFX_WideString m_szUrl;
- CFDE_CSSSelectorArray m_Selectors;
+ CFX_ArrayTemplate<CFDE_CSSSelector*> m_Selectors;
std::unordered_map<uint32_t, FX_WCHAR*> 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<uint32_t> m_SkipStack;
FX_WCHAR m_SkipChar;
};
diff --git a/xfa/fgas/crt/fgas_codepage.cpp b/xfa/fgas/crt/fgas_codepage.cpp
index 834056eddd..57f3e1e322 100644
--- a/xfa/fgas/crt/fgas_codepage.cpp
+++ b/xfa/fgas/crt/fgas_codepage.cpp
@@ -35,16 +35,6 @@ const FX_CHARSET_MAP g_FXCharset2CodePageTable[] = {
{255, 850},
};
-const FX_CHARSET_MAP g_FXCodepage2CharsetTable[] = {
- {1, 0}, {2, 42}, {254, 437}, {255, 850}, {222, 874},
- {128, 932}, {134, 936}, {129, 949}, {136, 950}, {238, 1250},
- {204, 1251}, {0, 1252}, {161, 1253}, {162, 1254}, {177, 1255},
- {178, 1256}, {186, 1257}, {163, 1258}, {130, 1361}, {77, 10000},
- {78, 10001}, {79, 10003}, {80, 10008}, {81, 10002}, {83, 10005},
- {84, 10004}, {85, 10006}, {86, 10081}, {87, 10021}, {88, 10029},
- {89, 10007},
-};
-
const FX_LANG2CPMAP g_FXLang2CodepageTable[] = {
{FX_LANG_Arabic_SaudiArabia, FX_CODEPAGE_MSWin_Arabic},
{FX_LANG_Bulgarian_Bulgaria, FX_CODEPAGE_MSWin_Cyrillic},
@@ -317,24 +307,6 @@ uint16_t FX_GetCodePageFromCharset(uint8_t charset) {
return 0xFFFF;
}
-uint16_t FX_GetCharsetFromCodePage(uint16_t codepage) {
- int32_t iEnd = sizeof(g_FXCodepage2CharsetTable) / sizeof(FX_CHARSET_MAP) - 1;
- ASSERT(iEnd >= 0);
- int32_t iStart = 0, iMid;
- do {
- iMid = (iStart + iEnd) / 2;
- const FX_CHARSET_MAP& cp = g_FXCodepage2CharsetTable[iMid];
- if (codepage == cp.codepage) {
- return cp.charset;
- } else if (codepage < cp.codepage) {
- iEnd = iMid - 1;
- } else {
- iStart = iMid + 1;
- }
- } while (iStart <= iEnd);
- return 0xFFFF;
-}
-
uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage) {
int32_t iEnd = sizeof(g_FXLang2CodepageTable) / sizeof(FX_LANG2CPMAP) - 1;
ASSERT(iEnd >= 0);
@@ -403,18 +375,6 @@ void FX_UTF16ToWChar(void* pBuffer, int32_t iLength) {
}
}
-void FX_WCharToUTF16(void* pBuffer, int32_t iLength) {
- ASSERT(pBuffer && iLength > 0);
- if (sizeof(FX_WCHAR) == 2) {
- return;
- }
- const FX_WCHAR* pSrc = (const FX_WCHAR*)pBuffer;
- uint16_t* pDst = (uint16_t*)pBuffer;
- while (--iLength >= 0) {
- *pDst++ = (uint16_t)*pSrc++;
- }
-}
-
int32_t FX_DecodeString(uint16_t wCodePage,
const FX_CHAR* pSrc,
int32_t* pSrcLen,
diff --git a/xfa/fgas/crt/fgas_codepage.h b/xfa/fgas/crt/fgas_codepage.h
index 5d867feb8e..78aee83219 100644
--- a/xfa/fgas/crt/fgas_codepage.h
+++ b/xfa/fgas/crt/fgas_codepage.h
@@ -134,19 +134,17 @@
#define FX_CHARSET_OEM 255
uint16_t FX_GetCodePageFromCharset(uint8_t charset);
-uint16_t FX_GetCharsetFromCodePage(uint16_t codepage);
uint16_t FX_GetCodePageFromStringW(const FX_WCHAR* pStr, int32_t iLength);
uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage);
void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength);
void FX_UTF16ToWChar(void* pBuffer, int32_t iLength);
-void FX_WCharToUTF16(void* pBuffer, int32_t iLength);
int32_t FX_DecodeString(uint16_t wCodePage,
const FX_CHAR* pSrc,
int32_t* pSrcLen,
FX_WCHAR* pDst,
int32_t* pDstLen,
- FX_BOOL bErrBreak = FALSE);
+ FX_BOOL bErrBreak);
int32_t FX_UTF8Decode(const FX_CHAR* pSrc,
int32_t* pSrcLen,
FX_WCHAR* pDst,
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index dd54fbed28..25d8514257 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -227,8 +227,7 @@ class CFX_Stream : public IFX_Stream {
int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
int32_t ReadString(FX_WCHAR* pStr,
int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize = nullptr) override;
+ FX_BOOL& bEOS) override;
int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
void Flush() override;
@@ -267,8 +266,7 @@ class CFX_TextStream : public IFX_Stream {
int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
int32_t ReadString(FX_WCHAR* pStr,
int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize = nullptr) override;
+ FX_BOOL& bEOS) override;
int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
void Flush() override;
@@ -338,21 +336,7 @@ FX_BOOL FileSetSize(FXSYS_FILE* file, int32_t size) {
} // namespace
-IFX_Stream* IFX_Stream::CreateStream(IFX_BufferRead* pBufferRead,
- uint32_t dwAccess,
- int32_t iFileSize,
- FX_BOOL bReleaseBufferRead) {
- CFX_Stream* pSR = new CFX_Stream;
- if (!pSR->LoadBufferRead(pBufferRead, iFileSize, dwAccess,
- bReleaseBufferRead)) {
- pSR->Release();
- return nullptr;
- }
- if (dwAccess & FX_STREAMACCESS_Text) {
- return new CFX_TextStream(pSR, TRUE);
- }
- return pSR;
-}
+// static
IFX_Stream* IFX_Stream::CreateStream(IFX_FileRead* pFileRead,
uint32_t dwAccess) {
CFX_Stream* pSR = new CFX_Stream;
@@ -365,6 +349,8 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_FileRead* pFileRead,
}
return pSR;
}
+
+// static
IFX_Stream* IFX_Stream::CreateStream(IFX_FileWrite* pFileWrite,
uint32_t dwAccess) {
CFX_Stream* pSR = new CFX_Stream;
@@ -377,18 +363,8 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_FileWrite* pFileWrite,
}
return pSR;
}
-IFX_Stream* IFX_Stream::CreateStream(const FX_WCHAR* pszFileName,
- uint32_t dwAccess) {
- CFX_Stream* pSR = new CFX_Stream;
- if (!pSR->LoadFile(pszFileName, dwAccess)) {
- pSR->Release();
- return nullptr;
- }
- if (dwAccess & FX_STREAMACCESS_Text) {
- return new CFX_TextStream(pSR, TRUE);
- }
- return pSR;
-}
+
+// static
IFX_Stream* IFX_Stream::CreateStream(uint8_t* pData,
int32_t length,
uint32_t dwAccess) {
@@ -932,11 +908,14 @@ int32_t CFX_BufferStreamImp::WriteString(const FX_WCHAR* pStr,
}
return iLen;
}
+
+// static
IFX_Stream* IFX_Stream::CreateTextStream(IFX_Stream* pBaseStream,
FX_BOOL bDeleteOnRelease) {
ASSERT(pBaseStream);
return new CFX_TextStream(pBaseStream, bDeleteOnRelease);
}
+
CFX_TextStream::CFX_TextStream(IFX_Stream* pStream, FX_BOOL bDelStream)
: m_wCodePage(FX_CODEPAGE_DefANSI),
m_wBOMLength(0),
@@ -1073,8 +1052,7 @@ uint16_t CFX_TextStream::SetCodePage(uint16_t wCodePage) {
}
int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr,
int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize) {
+ FX_BOOL& bEOS) {
ASSERT(pStr && iMaxLength > 0);
if (!m_pStreamImp) {
return -1;
@@ -1082,7 +1060,7 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr,
int32_t iLen;
if (m_wCodePage == FX_CODEPAGE_UTF16LE ||
m_wCodePage == FX_CODEPAGE_UTF16BE) {
- int32_t iBytes = pByteSize ? *pByteSize : iMaxLength * 2;
+ int32_t iBytes = iMaxLength * 2;
iLen = m_pStreamImp->ReadData((uint8_t*)pStr, iBytes);
iMaxLength = iLen / 2;
if (sizeof(FX_WCHAR) > 2) {
@@ -1099,7 +1077,7 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr,
#endif
} else {
int32_t pos = m_pStreamImp->GetPosition();
- int32_t iBytes = pByteSize ? *pByteSize : iMaxLength;
+ int32_t iBytes = iMaxLength;
iBytes = std::min(iBytes, m_pStreamImp->GetLength() - pos);
if (iBytes > 0) {
if (!m_pBuf) {
@@ -1341,17 +1319,13 @@ int32_t CFX_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
}
int32_t CFX_Stream::ReadString(FX_WCHAR* pStr,
int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize) {
+ FX_BOOL& bEOS) {
ASSERT(pStr && iMaxLength > 0);
if (!m_pStreamImp) {
return -1;
}
int32_t iEnd = m_iStart + m_iLength;
int32_t iLen = iEnd - m_iPosition;
- if (pByteSize) {
- iLen = std::min(iLen, *pByteSize);
- }
iLen = std::min(iEnd / 2, iMaxLength);
if (iLen <= 0) {
return 0;
diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h
index 5cd2a3daa7..443e8c7f5c 100644
--- a/xfa/fgas/crt/fgas_stream.h
+++ b/xfa/fgas/crt/fgas_stream.h
@@ -13,7 +13,7 @@
class IFX_Stream;
IFX_FileRead* FX_CreateFileRead(IFX_Stream* pBaseStream,
- FX_BOOL bReleaseStream = FALSE);
+ FX_BOOL bReleaseStream);
enum FX_STREAMACCESS {
FX_STREAMACCESS_Binary = 0x00,
@@ -35,20 +35,19 @@ class IFX_Stream {
public:
static IFX_Stream* CreateStream(IFX_FileRead* pFileRead, uint32_t dwAccess);
static IFX_Stream* CreateStream(IFX_FileWrite* pFileWrite, uint32_t dwAccess);
- static IFX_Stream* CreateStream(const FX_WCHAR* pszFileName,
- uint32_t dwAccess);
static IFX_Stream* CreateStream(uint8_t* pData,
int32_t length,
uint32_t dwAccess);
- static IFX_Stream* CreateStream(IFX_BufferRead* pBufferRead,
- uint32_t dwAccess,
- int32_t iFileSize = -1,
- FX_BOOL bReleaseBufferRead = TRUE);
static IFX_Stream* CreateTextStream(IFX_Stream* pBaseStream,
FX_BOOL bDeleteOnRelease);
virtual ~IFX_Stream() {}
virtual void Release() = 0;
virtual IFX_Stream* Retain() = 0;
+
+ virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) = 0;
+
virtual uint32_t GetAccessModes() const = 0;
virtual int32_t GetLength() const = 0;
virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0;
@@ -57,8 +56,7 @@ class IFX_Stream {
virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0;
virtual int32_t ReadString(FX_WCHAR* pStr,
int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize = nullptr) = 0;
+ FX_BOOL& bEOS) = 0;
virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0;
virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0;
virtual void Flush() = 0;
@@ -66,9 +64,6 @@ class IFX_Stream {
virtual int32_t GetBOM(uint8_t bom[4]) const = 0;
virtual uint16_t GetCodePage() const = 0;
virtual uint16_t SetCodePage(uint16_t wCodePage) = 0;
- virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) = 0;
};
#endif // XFA_FGAS_CRT_FGAS_STREAM_H_
diff --git a/xfa/fgas/crt/fgas_system.h b/xfa/fgas/crt/fgas_system.h
index 83c67735dc..6cf628f9d4 100644
--- a/xfa/fgas/crt/fgas_system.h
+++ b/xfa/fgas/crt/fgas_system.h
@@ -9,9 +9,7 @@
#include "core/fxcrt/include/fx_system.h"
-FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr,
- int32_t iLength = -1,
- int32_t* pUsedLen = nullptr);
+FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen);
int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count);
#endif // XFA_FGAS_CRT_FGAS_SYSTEM_H_
diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp
index 7207f055e5..e1f7c477fd 100644
--- a/xfa/fgas/crt/fgas_utils.cpp
+++ b/xfa/fgas/crt/fgas_utils.cpp
@@ -38,7 +38,7 @@ CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) {
m_pData = new FX_BASEARRAYDATA(iGrowSize, iBlockSize);
}
CFX_BaseArray::~CFX_BaseArray() {
- RemoveAll();
+ RemoveAll(FALSE);
delete m_pData;
}
int32_t CFX_BaseArray::GetSize() const {
@@ -153,7 +153,7 @@ CFX_BaseMassArrayImp::CFX_BaseMassArrayImp(int32_t iChunkSize,
m_pData->SetSize(16);
}
CFX_BaseMassArrayImp::~CFX_BaseMassArrayImp() {
- RemoveAll();
+ RemoveAll(FALSE);
delete m_pData;
}
uint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) {
diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h
index 0cf853fa70..d7b753994c 100644
--- a/xfa/fgas/crt/fgas_utils.h
+++ b/xfa/fgas/crt/fgas_utils.h
@@ -22,14 +22,10 @@ class CFX_BaseArray : public CFX_Target {
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
uint8_t* GetBuffer() const;
- int32_t Append(const CFX_BaseArray& src,
- int32_t iStart = 0,
- int32_t iCount = -1);
- int32_t Copy(const CFX_BaseArray& src,
- int32_t iStart = 0,
- int32_t iCount = -1);
- int32_t RemoveLast(int32_t iCount = -1);
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE);
+ int32_t Append(const CFX_BaseArray& src, int32_t iStart, int32_t iCount);
+ int32_t Copy(const CFX_BaseArray& src, int32_t iStart, int32_t iCount);
+ int32_t RemoveLast(int32_t iCount);
+ void RemoveAll(FX_BOOL bLeaveMemory);
FX_BASEARRAYDATA* m_pData;
};
@@ -37,10 +33,11 @@ class CFX_BaseArray : public CFX_Target {
template <class baseType>
class CFX_BaseArrayTemplate : public CFX_BaseArray {
public:
- CFX_BaseArrayTemplate(int32_t iGrowSize = 100)
+ CFX_BaseArrayTemplate(int32_t iGrowSize)
: CFX_BaseArray(iGrowSize, sizeof(baseType)) {}
CFX_BaseArrayTemplate(int32_t iGrowSize, int32_t iBlockSize)
: CFX_BaseArray(iGrowSize, iBlockSize) {}
+
int32_t GetSize() const { return CFX_BaseArray::GetSize(); }
int32_t GetBlockSize() const { return CFX_BaseArray::GetBlockSize(); }
baseType* AddSpace() {
@@ -65,119 +62,19 @@ class CFX_BaseArrayTemplate : public CFX_BaseArray {
*(baseType*)CFX_BaseArray::AddSpaceTo(index) = element;
}
int32_t Append(const CFX_BaseArrayTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
+ int32_t iStart,
+ int32_t iCount) {
return CFX_BaseArray::Append(src, iStart, iCount);
}
int32_t Copy(const CFX_BaseArrayTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
+ int32_t iStart,
+ int32_t iCount) {
return CFX_BaseArray::Copy(src, iStart, iCount);
}
- int32_t RemoveLast(int32_t iCount = -1) {
+ int32_t RemoveLast(int32_t iCount) {
return CFX_BaseArray::RemoveLast(iCount);
}
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
- CFX_BaseArray::RemoveAll(bLeaveMemory);
- }
-};
-
-template <class baseType>
-class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray {
- public:
- CFX_ObjectBaseArrayTemplate(int32_t iGrowSize = 100)
- : CFX_BaseArray(iGrowSize, sizeof(baseType)) {}
- ~CFX_ObjectBaseArrayTemplate() { RemoveAll(FALSE); }
- int32_t GetSize() const { return CFX_BaseArray::GetSize(); }
- int32_t GetBlockSize() const { return CFX_BaseArray::GetBlockSize(); }
- int32_t Add(const baseType& element) {
- int32_t index = CFX_BaseArray::GetSize();
- baseType* p = (baseType*)CFX_BaseArray::AddSpaceTo(index);
- new ((void*)p) baseType(element);
- return index;
- }
- baseType& GetAt(int32_t index) const {
- return *(baseType*)CFX_BaseArray::GetAt(index);
- }
- baseType* GetPtrAt(int32_t index) const {
- return (baseType*)CFX_BaseArray::GetAt(index);
- }
- int32_t Append(const CFX_ObjectBaseArrayTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
- ASSERT(GetBlockSize() == src.GetBlockSize());
- if (iCount == 0) {
- return 0;
- }
- int32_t iSize = src.GetSize();
- ASSERT(iStart > -1 && iStart < iSize);
- if (iCount < 0) {
- iCount = iSize;
- }
- if (iStart + iCount > iSize) {
- iCount = iSize - iStart;
- }
- if (iCount < 1) {
- return 0;
- }
- iSize = CFX_BaseArray::GetSize();
- CFX_BaseArray::AddSpaceTo(iSize + iCount - 1);
- uint8_t** pStart = CFX_BaseArray::GetAt(iSize);
- int32_t iBlockSize = CFX_BaseArray::GetBlockSize();
- iSize = iStart + iCount;
- for (int32_t i = iStart; i < iSize; i++) {
- FXTARGET_NewWith((void*)pStart) baseType(src.GetAt(i));
- pStart += iBlockSize;
- }
- return iCount;
- }
- int32_t Copy(const CFX_ObjectBaseArrayTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
- ASSERT(GetBlockSize() == src.GetBlockSize());
- if (iCount == 0) {
- return 0;
- }
- int32_t iSize = src.GetSize();
- ASSERT(iStart > -1 && iStart < iSize);
- if (iCount < 0) {
- iCount = iSize;
- }
- if (iStart + iCount > iSize) {
- iCount = iSize - iStart;
- }
- if (iCount < 1) {
- return 0;
- }
- RemoveAll(TRUE);
- CFX_BaseArray::AddSpaceTo(iCount - 1);
- uint8_t** pStart = CFX_BaseArray::GetAt(0);
- int32_t iBlockSize = CFX_BaseArray::GetBlockSize();
- iSize = iStart + iCount;
- for (int32_t i = iStart; i < iSize; i++) {
- new ((void*)pStart) baseType(src.GetAt(i));
- pStart += iBlockSize;
- }
- return iCount;
- }
- int32_t RemoveLast(int32_t iCount = -1) {
- int32_t iSize = CFX_BaseArray::GetSize();
- if (iCount < 0 || iCount > iSize) {
- iCount = iSize;
- }
- if (iCount == 0) {
- return iSize;
- }
- for (int32_t i = iSize - iCount; i < iSize; i++) {
- ((baseType*)GetPtrAt(i))->~baseType();
- }
- return CFX_BaseArray::RemoveLast(iCount);
- }
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
- int32_t iSize = CFX_BaseArray::GetSize();
- for (int32_t i = 0; i < iSize; i++) {
- ((baseType*)GetPtrAt(i))->~baseType();
- }
+ void RemoveAll(FX_BOOL bLeaveMemory) {
CFX_BaseArray::RemoveAll(bLeaveMemory);
}
};
@@ -191,13 +88,11 @@ class CFX_BaseMassArrayImp : public CFX_Target {
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
int32_t Append(const CFX_BaseMassArrayImp& src,
- int32_t iStart = 0,
- int32_t iCount = -1);
- int32_t Copy(const CFX_BaseMassArrayImp& src,
- int32_t iStart = 0,
- int32_t iCount = -1);
- int32_t RemoveLast(int32_t iCount = -1);
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE);
+ int32_t iStart,
+ int32_t iCount);
+ int32_t Copy(const CFX_BaseMassArrayImp& src, int32_t iStart, int32_t iCount);
+ int32_t RemoveLast(int32_t iCount);
+ void RemoveAll(FX_BOOL bLeaveMemory);
int32_t m_iChunkSize;
int32_t m_iBlockSize;
@@ -208,8 +103,8 @@ class CFX_BaseMassArrayImp : public CFX_Target {
protected:
void Append(int32_t iDstStart,
const CFX_BaseMassArrayImp& src,
- int32_t iSrcStart = 0,
- int32_t iSrcCount = -1);
+ int32_t iSrcStart,
+ int32_t iSrcCount);
};
class CFX_BaseMassArray : public CFX_Target {
@@ -220,24 +115,21 @@ class CFX_BaseMassArray : public CFX_Target {
int32_t GetSize() const;
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
- int32_t Append(const CFX_BaseMassArray& src,
- int32_t iStart = 0,
- int32_t iCount = -1);
- int32_t Copy(const CFX_BaseMassArray& src,
- int32_t iStart = 0,
- int32_t iCount = -1);
- int32_t RemoveLast(int32_t iCount = -1);
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE);
+ int32_t Append(const CFX_BaseMassArray& src, int32_t iStart, int32_t iCount);
+ int32_t Copy(const CFX_BaseMassArray& src, int32_t iStart, int32_t iCount);
+ int32_t RemoveLast(int32_t iCount);
+ void RemoveAll(FX_BOOL bLeaveMemory);
CFX_BaseMassArrayImp* m_pData;
};
template <class baseType>
class CFX_MassArrayTemplate : public CFX_BaseMassArray {
public:
- CFX_MassArrayTemplate(int32_t iChunkSize = 100)
+ CFX_MassArrayTemplate(int32_t iChunkSize)
: CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {}
CFX_MassArrayTemplate(int32_t iChunkSize, int32_t iBlockSize)
: CFX_BaseMassArray(iChunkSize, iBlockSize) {}
+
int32_t GetSize() const { return CFX_BaseMassArray::GetSize(); }
baseType* AddSpace() {
return (baseType*)CFX_BaseMassArray::AddSpaceTo(
@@ -261,19 +153,19 @@ class CFX_MassArrayTemplate : public CFX_BaseMassArray {
*(baseType*)CFX_BaseMassArray::AddSpaceTo(index) = element;
}
int32_t Append(const CFX_MassArrayTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
+ int32_t iStart,
+ int32_t iCount) {
return CFX_BaseMassArray::Append(src, iStart, iCount);
}
int32_t Copy(const CFX_MassArrayTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
+ int32_t iStart,
+ int32_t iCount) {
return CFX_BaseMassArray::Copy(src, iStart, iCount);
}
- int32_t RemoveLast(int32_t iCount = -1) {
+ int32_t RemoveLast(int32_t iCount) {
return CFX_BaseMassArray::RemoveLast(iCount);
}
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
+ void RemoveAll(FX_BOOL bLeaveMemory) {
CFX_BaseMassArray::RemoveAll(bLeaveMemory);
}
};
@@ -281,9 +173,10 @@ class CFX_MassArrayTemplate : public CFX_BaseMassArray {
template <class baseType>
class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray {
public:
- CFX_ObjectMassArrayTemplate(int32_t iChunkSize = 100)
+ CFX_ObjectMassArrayTemplate(int32_t iChunkSize)
: CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {}
~CFX_ObjectMassArrayTemplate() { RemoveAll(FALSE); }
+
int32_t GetSize() const { return CFX_BaseMassArray::GetSize(); }
int32_t Add(const baseType& element) {
int32_t index = CFX_BaseMassArray::GetSize();
@@ -298,8 +191,8 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray {
return (baseType*)CFX_BaseMassArray::GetAt(index);
}
int32_t Append(const CFX_ObjectMassArrayTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
+ int32_t iStart,
+ int32_t iCount) {
if (iCount == 0) {
return CFX_BaseMassArray::GetSize();
}
@@ -318,8 +211,8 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray {
return CFX_BaseMassArray::GetSize();
}
int32_t Copy(const CFX_ObjectMassArrayTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
+ int32_t iStart,
+ int32_t iCount) {
if (iCount == 0) {
return CFX_BaseMassArray::GetSize();
}
@@ -338,7 +231,7 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray {
}
return CFX_BaseMassArray::GetSize();
}
- int32_t RemoveLast(int32_t iCount = -1) {
+ int32_t RemoveLast(int32_t iCount) {
int32_t iSize = CFX_BaseMassArray::GetSize();
if (iCount < 0 || iCount > iSize) {
iCount = iSize;
@@ -351,7 +244,7 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray {
}
return CFX_BaseMassArray::RemoveLast(iCount);
}
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
+ void RemoveAll(FX_BOOL bLeaveMemory) {
int32_t iSize = CFX_BaseMassArray::GetSize();
for (int32_t i = 0; i < iSize; i++) {
((baseType*)GetPtrAt(i))->~baseType();
@@ -374,8 +267,9 @@ class CFX_BaseDiscreteArray : public CFX_Target {
template <class baseType>
class CFX_DiscreteArrayTemplate : public CFX_BaseDiscreteArray {
public:
- CFX_DiscreteArrayTemplate(int32_t iChunkSize = 100)
+ CFX_DiscreteArrayTemplate(int32_t iChunkSize)
: CFX_BaseDiscreteArray(iChunkSize, sizeof(baseType)) {}
+
baseType& GetAt(int32_t index, const baseType& defValue) const {
baseType* p = (baseType*)CFX_BaseDiscreteArray::GetAt(index);
return p ? *p : (baseType&)defValue;
@@ -388,9 +282,6 @@ class CFX_DiscreteArrayTemplate : public CFX_BaseDiscreteArray {
}
void RemoveAll() { CFX_BaseDiscreteArray::RemoveAll(); }
};
-typedef CFX_DiscreteArrayTemplate<void*> CFX_PtrDiscreteArray;
-typedef CFX_DiscreteArrayTemplate<uint32_t> CFX_DWordDiscreteArray;
-typedef CFX_DiscreteArrayTemplate<uint16_t> CFX_WordDiscreteArray;
class CFX_BaseStack : public CFX_Target {
protected:
@@ -402,15 +293,16 @@ class CFX_BaseStack : public CFX_Target {
uint8_t* GetTopElement() const;
int32_t GetSize() const;
uint8_t* GetAt(int32_t index) const;
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE);
+ void RemoveAll(FX_BOOL bLeaveMemory);
CFX_BaseMassArrayImp* m_pData;
};
template <class baseType>
class CFX_StackTemplate : public CFX_BaseStack {
public:
- CFX_StackTemplate(int32_t iChunkSize = 100)
+ CFX_StackTemplate(int32_t iChunkSize)
: CFX_BaseStack(iChunkSize, sizeof(baseType)) {}
+
int32_t Push(const baseType& element) {
int32_t index = CFX_BaseStack::GetSize();
*(baseType*)CFX_BaseStack::Push() = element;
@@ -424,21 +316,18 @@ class CFX_StackTemplate : public CFX_BaseStack {
baseType* GetAt(int32_t index) const {
return (baseType*)CFX_BaseStack::GetAt(index);
}
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
+ void RemoveAll(FX_BOOL bLeaveMemory) {
CFX_BaseStack::RemoveAll(bLeaveMemory);
}
};
-typedef CFX_StackTemplate<void*> CFX_PtrStack;
-typedef CFX_StackTemplate<uint32_t> CFX_DWordStack;
-typedef CFX_StackTemplate<uint16_t> CFX_WordStack;
-typedef CFX_StackTemplate<int32_t> CFX_Int32Stack;
template <class baseType>
class CFX_ObjectStackTemplate : public CFX_BaseStack {
public:
- CFX_ObjectStackTemplate(int32_t iChunkSize = 100)
+ CFX_ObjectStackTemplate(int32_t iChunkSize)
: CFX_BaseStack(iChunkSize, sizeof(baseType)) {}
- ~CFX_ObjectStackTemplate() { RemoveAll(); }
+ ~CFX_ObjectStackTemplate() { RemoveAll(FALSE); }
+
int32_t Push(const baseType& element) {
int32_t index = CFX_BaseStack::GetSize();
baseType* p = (baseType*)CFX_BaseStack::Push();
@@ -459,7 +348,7 @@ class CFX_ObjectStackTemplate : public CFX_BaseStack {
baseType* GetAt(int32_t index) const {
return (baseType*)CFX_BaseStack::GetAt(index);
}
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
+ void RemoveAll(FX_BOOL bLeaveMemory) {
int32_t iSize = CFX_BaseStack::GetSize();
for (int32_t i = 0; i < iSize; i++) {
((baseType*)CFX_BaseStack::GetAt(i))->~baseType();
@@ -467,8 +356,8 @@ class CFX_ObjectStackTemplate : public CFX_BaseStack {
CFX_BaseStack::RemoveAll(bLeaveMemory);
}
int32_t Copy(const CFX_ObjectStackTemplate& src,
- int32_t iStart = 0,
- int32_t iCount = -1) {
+ int32_t iStart,
+ int32_t iCount) {
if (iCount == 0) {
return CFX_BaseStack::GetSize();
}
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index a7d8c49cbf..576f482df2 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -219,7 +219,7 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream,
if (bSaveStream) {
m_pStream = pFontStream;
}
- m_pFileRead = FX_CreateFileRead(pFontStream);
+ m_pFileRead = FX_CreateFileRead(pFontStream, FALSE);
m_pFont = new CFX_Font;
FX_BOOL bRet = m_pFont->LoadFile(m_pFileRead);
if (bRet) {
@@ -250,7 +250,7 @@ FX_BOOL CFGAS_GEFont::InitFont() {
return FALSE;
}
if (!m_pCharWidthMap)
- m_pCharWidthMap = new CFX_WordDiscreteArray(1024);
+ m_pCharWidthMap = new CFX_DiscreteArrayTemplate<uint16_t>(1024);
if (!m_pRectArray)
m_pRectArray = new CFX_MassArrayTemplate<CFX_Rect>(16);
if (!m_pBBoxMap)
@@ -473,7 +473,7 @@ void CFGAS_GEFont::Reset() {
m_pBBoxMap->RemoveAll();
}
if (m_pRectArray) {
- m_pRectArray->RemoveAll();
+ m_pRectArray->RemoveAll(FALSE);
}
}
CFGAS_GEFont* CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) const {
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index 5d7b664cf9..a94583fa65 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -98,7 +98,7 @@ class CFGAS_GEFont {
IFX_Stream* m_pStream;
IFX_FileRead* m_pFileRead;
CFX_UnicodeEncoding* m_pFontEncoding;
- CFX_WordDiscreteArray* m_pCharWidthMap;
+ CFX_DiscreteArrayTemplate<uint16_t>* m_pCharWidthMap;
CFX_MassArrayTemplate<CFX_Rect>* m_pRectArray;
CFX_MapPtrToPtr* m_pBBoxMap;
CXFA_PDFFontMgr* m_pProvider;
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 47ec72b807..8af3f22b9a 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -20,7 +20,7 @@ IFGAS_FontMgr* IFGAS_FontMgr::Create(FX_LPEnumAllFonts pEnumerator) {
CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator)
: m_pEnumerator(pEnumerator),
- m_FontFaces(),
+ m_FontFaces(100),
m_CPFonts(8),
m_FamilyFonts(16),
m_UnicodeFonts(16),
@@ -33,7 +33,7 @@ CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator)
}
CFGAS_StdFontMgrImp::~CFGAS_StdFontMgrImp() {
- m_FontFaces.RemoveAll();
+ m_FontFaces.RemoveAll(FALSE);
m_CPFonts.RemoveAll();
m_FamilyFonts.RemoveAll();
m_UnicodeFonts.RemoveAll();
@@ -298,7 +298,7 @@ FX_FONTDESCRIPTOR const* CFGAS_StdFontMgrImp::FindFont(
return pDesc;
}
if (pszFontFamily && m_pEnumerator) {
- CFX_FontDescriptors namedFonts;
+ CFX_FontDescriptors namedFonts(100);
m_pEnumerator(namedFonts, pszFontFamily, wUnicode);
params.pwsFamily = nullptr;
pDesc = FX_DefFontMatcher(&params, namedFonts);
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index 8a4f6eac2b..bfe3ca674f 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -646,7 +646,7 @@ uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) {
CFX_RTFLine* pNextLine =
(m_pCurLine == &m_RTFLine1) ? &m_RTFLine2 : &m_RTFLine1;
FX_BOOL bAllChars = (m_iAlignment > FX_RTFLINEALIGNMENT_Right);
- CFX_TPOArray tpos;
+ CFX_TPOArray tpos(100);
if (EndBreak_SplitLine(pNextLine, bAllChars, dwStatus)) {
goto EndBreak_Ret;
}
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index 0c1c6a2202..89b17ccb9b 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -951,7 +951,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
CFX_TxtLine* pNextLine =
(m_pCurLine == m_pTxtLine1) ? m_pTxtLine2 : m_pTxtLine1;
FX_BOOL bAllChars = (m_iCurAlignment > FX_TXTLINEALIGNMENT_Right);
- CFX_TPOArray tpos;
+ CFX_TPOArray tpos(100);
CFX_Char* pTC;
if (m_bArabicShapes) {
EndBreak_UpdateArabicShapes();
diff --git a/xfa/fxfa/parser/cxfa_xml_parser.cpp b/xfa/fxfa/parser/cxfa_xml_parser.cpp
index 268c8b1416..654a449a88 100644
--- a/xfa/fxfa/parser/cxfa_xml_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_xml_parser.cpp
@@ -23,7 +23,7 @@ CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream)
}
CXFA_XMLParser::~CXFA_XMLParser() {
- m_NodeStack.RemoveAll();
+ m_NodeStack.RemoveAll(FALSE);
m_ws1.clear();
m_ws2.clear();
}
diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp
index f236d0e8a3..4d3b128bdb 100644
--- a/xfa/fxfa/parser/xfa_basic_imp.cpp
+++ b/xfa/fxfa/parser/xfa_basic_imp.cpp
@@ -544,8 +544,7 @@ int32_t CXFA_WideTextRead::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
}
int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr,
int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize) {
+ FX_BOOL& bEOS) {
iMaxLength = std::min(iMaxLength, m_wsBuffer.GetLength() - m_iPosition);
if (iMaxLength == 0)
return 0;
diff --git a/xfa/fxfa/parser/xfa_basic_imp.h b/xfa/fxfa/parser/xfa_basic_imp.h
index 3badbb463e..8ca153b90f 100644
--- a/xfa/fxfa/parser/xfa_basic_imp.h
+++ b/xfa/fxfa/parser/xfa_basic_imp.h
@@ -36,8 +36,7 @@ class CXFA_WideTextRead : public IFX_Stream {
int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
int32_t ReadString(FX_WCHAR* pStr,
int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize = nullptr) override;
+ FX_BOOL& bEOS) override;
int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
void Flush() override {}
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index a9a5b29458..de2f804a4c 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -3625,7 +3625,7 @@ FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr,
case XFA_ATTRIBUTETYPE_Integer:
return SetInteger(
pAttr->eName,
- FXSYS_round(FX_wcstof(wsValue.c_str(), wsValue.GetLength())),
+ FXSYS_round(FX_wcstof(wsValue.c_str(), wsValue.GetLength(), nullptr)),
bNotify);
case XFA_ATTRIBUTETYPE_Measure:
return SetMeasure(pAttr->eName, CXFA_Measurement(wsValue), bNotify);
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index 0aa9064288..794624a8de 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -27,7 +27,7 @@ template <class NodeType, class TraverseStrategy>
class CXFA_NodeIteratorTemplate {
public:
CXFA_NodeIteratorTemplate(NodeType* pRootNode = nullptr)
- : m_pRoot(pRootNode) {
+ : m_pRoot(pRootNode), m_NodeStack(100) {
if (pRootNode) {
m_NodeStack.Push(pRootNode);
}
@@ -37,11 +37,11 @@ class CXFA_NodeIteratorTemplate {
return FALSE;
}
m_pRoot = pRootNode;
- m_NodeStack.RemoveAll();
+ m_NodeStack.RemoveAll(FALSE);
m_NodeStack.Push(pRootNode);
return TRUE;
}
- void Clear() { m_NodeStack.RemoveAll(); }
+ void Clear() { m_NodeStack.RemoveAll(FALSE); }
void Reset() {
Clear();
if (m_pRoot) {
@@ -49,9 +49,9 @@ class CXFA_NodeIteratorTemplate {
}
}
FX_BOOL SetCurrent(NodeType* pCurNode) {
- m_NodeStack.RemoveAll();
+ m_NodeStack.RemoveAll(FALSE);
if (pCurNode) {
- CFX_StackTemplate<NodeType*> revStack;
+ CFX_StackTemplate<NodeType*> revStack(100);
NodeType* pNode;
for (pNode = pCurNode; pNode && pNode != m_pRoot;
pNode = TraverseStrategy::GetParent(pNode)) {
@@ -94,7 +94,7 @@ class CXFA_NodeIteratorTemplate {
}
m_NodeStack.Push(pPrevItem);
} else {
- m_NodeStack.RemoveAll();
+ m_NodeStack.RemoveAll(FALSE);
if (m_pRoot) {
m_NodeStack.Push(m_pRoot);
}