summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp34
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.h2
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp15
-rw-r--r--xfa/fwl/core/fwl_noteimp.h6
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp2
-rw-r--r--xfa/fxfa/app/xfa_fontmgr.cpp7
-rw-r--r--xfa/fxfa/include/xfa_ffwidget.h5
-rw-r--r--xfa/fxfa/include/xfa_fontmgr.h2
-rw-r--r--xfa/fxfa/parser/xfa_localemgr.cpp34
-rw-r--r--xfa/fxfa/parser/xfa_localemgr.h4
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.cpp6
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.h2
-rw-r--r--xfa/fxgraphics/cfx_graphics.cpp3
-rw-r--r--xfa/fxgraphics/include/cfx_graphics.h2
14 files changed, 57 insertions, 67 deletions
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index a3964d2bb8..54dd641319 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -17,7 +17,6 @@ IFX_FontMgr* IFX_FontMgr::Create(FX_LPEnumAllFonts pEnumerator) {
CFX_StdFontMgrImp::CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator)
: m_pEnumerator(pEnumerator),
m_FontFaces(),
- m_Fonts(),
m_CPFonts(8),
m_FamilyFonts(16),
m_UnicodeFonts(16),
@@ -39,14 +38,10 @@ CFX_StdFontMgrImp::~CFX_StdFontMgrImp() {
m_FileFonts.RemoveAll();
m_StreamFonts.RemoveAll();
m_DeriveFonts.RemoveAll();
- for (int32_t i = m_Fonts.GetUpperBound(); i >= 0; i--) {
- IFX_Font* pFont = (IFX_Font*)m_Fonts[i];
- if (pFont != NULL) {
- pFont->Release();
- }
- }
- m_Fonts.RemoveAll();
+ for (int32_t i = m_Fonts.GetUpperBound(); i >= 0; i--)
+ m_Fonts[i]->Release();
}
+
IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
@@ -65,7 +60,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage(
}
ASSERT(pFD != NULL);
pFont = IFX_Font::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this);
- if (pFont != NULL) {
+ if (pFont) {
m_Fonts.Add(pFont);
m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
dwHash = FGAS_GetFontFamilyHash(pFD->wsFontFace, dwFontStyles, wCodePage);
@@ -149,7 +144,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily,
wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet);
}
pFont = IFX_Font::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this);
- if (pFont != NULL) {
+ if (pFont) {
m_Fonts.Add(pFont);
m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles);
@@ -167,7 +162,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) {
}
}
pFont = IFX_Font::LoadFont(pBuffer, iLength, this);
- if (pFont != NULL) {
+ if (pFont) {
m_Fonts.Add(pFont);
m_BufferFonts.SetAt((void*)pBuffer, pFont);
return pFont->Retain();
@@ -184,7 +179,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) {
}
}
pFont = IFX_Font::LoadFont(pszFileName, NULL);
- if (pFont != NULL) {
+ if (pFont) {
m_Fonts.Add(pFont);
m_FileFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
return pFont->Retain();
@@ -209,7 +204,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream,
}
}
pFont = IFX_Font::LoadFont(pFontStream, this, bSaveStream);
- if (pFont != NULL) {
+ if (pFont) {
m_Fonts.Add(pFont);
m_StreamFonts.SetAt((void*)pFontStream, (void*)pFont);
if (pszFontAlias != NULL) {
@@ -240,7 +235,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font* pSrcFont,
}
}
pFont = pSrcFont->Derive(dwFontStyles, wCodePage);
- if (pFont != NULL) {
+ if (pFont) {
m_DeriveFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
int32_t index = m_Fonts.Find(pFont);
if (index < 0) {
@@ -251,15 +246,12 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font* pSrcFont,
}
return NULL;
}
+
void CFX_StdFontMgrImp::ClearFontCache() {
- int32_t iCount = m_Fonts.GetSize();
- for (int32_t i = 0; i < iCount; i++) {
- IFX_Font* pFont = (IFX_Font*)m_Fonts[i];
- if (pFont != NULL) {
- pFont->Reset();
- }
- }
+ for (int32_t i = 0; i < m_Fonts.GetSize(); i++)
+ m_Fonts[i]->Reset();
}
+
void CFX_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, IFX_Font* pFont) {
FX_POSITION pos = fontMap.GetStartPosition();
void* pKey;
diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h
index cc11517e34..e66dd3131a 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.h
+++ b/xfa/fgas/font/fgas_stdfontmgr.h
@@ -64,7 +64,7 @@ class CFX_StdFontMgrImp : public IFX_FontMgr {
FX_LPEnumAllFonts m_pEnumerator;
CFX_FontDescriptors m_FontFaces;
- CFX_PtrArray m_Fonts;
+ CFX_ArrayTemplate<IFX_Font*> m_Fonts;
CFX_MapPtrToPtr m_CPFonts;
CFX_MapPtrToPtr m_FamilyFonts;
CFX_MapPtrToPtr m_UnicodeFonts;
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index 5cd643a81b..cc548a5728 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -164,8 +164,7 @@ IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
int32_t pos = m_noteLoopQueue.GetSize();
if (pos <= 0)
return NULL;
- IFWL_NoteLoop* p =
- static_cast<IFWL_NoteLoop*>(m_noteLoopQueue.GetAt(pos - 1));
+ IFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1);
m_noteLoopQueue.RemoveAt(pos - 1);
return p;
}
@@ -351,7 +350,7 @@ FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) {
if (m_noteQueue.GetSize() < 1) {
return FALSE;
}
- CFWL_Message* pMessage = static_cast<CFWL_Message*>(m_noteQueue[0]);
+ CFWL_Message* pMessage = m_noteQueue[0];
m_noteQueue.RemoveAt(0);
if (!IsValidMessage(pMessage)) {
pMessage->Release();
@@ -365,7 +364,7 @@ FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) {
CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() {
int32_t size = m_noteLoopQueue.GetSize();
if (size <= 0)
- return NULL;
+ return nullptr;
return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]);
}
int32_t CFWL_NoteDriver::CountLoop() {
@@ -885,14 +884,14 @@ void CFWL_ToolTipContainer::DeleteInstance() {
}
}
FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) {
- if (m_arrWidget.Find((void*)pTarget) < 0) {
- m_arrWidget.Add((void*)pTarget);
+ if (m_arrWidget.Find(pTarget) < 0) {
+ m_arrWidget.Add(pTarget);
return FWL_ERR_Succeeded;
}
return FWL_ERR_Indefinite;
}
FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) {
- int index = m_arrWidget.Find((void*)pTarget);
+ int index = m_arrWidget.Find(pTarget);
if (index >= 0) {
m_arrWidget.RemoveAt(index);
return FWL_ERR_Succeeded;
@@ -902,7 +901,7 @@ FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) {
FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) {
int32_t iCount = m_arrWidget.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ToolTipTarget* p = static_cast<IFWL_ToolTipTarget*>(m_arrWidget[i]);
+ IFWL_ToolTipTarget* p = m_arrWidget[i];
if (p->GetWidget() == pWedget) {
pCurTarget = p;
return TRUE;
diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h
index 927afd6c9d..f51f09cf00 100644
--- a/xfa/fwl/core/fwl_noteimp.h
+++ b/xfa/fwl/core/fwl_noteimp.h
@@ -97,8 +97,8 @@ class CFWL_NoteDriver : public IFWL_NoteDriver {
IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget);
void ClearInvalidEventTargets(FX_BOOL bRemoveAll);
CFX_ArrayTemplate<CFWL_TargetImp*> m_forms;
- CFX_PtrArray m_noteQueue;
- CFX_PtrArray m_noteLoopQueue;
+ CFX_ArrayTemplate<CFWL_Message*> m_noteQueue;
+ CFX_ArrayTemplate<IFWL_NoteLoop*> m_noteLoopQueue;
CFX_MapPtrToPtr m_eventTargets;
int32_t m_sendEventCalled;
IFWL_Widget* m_pHover;
@@ -147,7 +147,7 @@ class CFWL_ToolTipContainer {
IFWL_ToolTipTarget* pCurTarget;
CFWL_ToolTipImp* m_pToolTipImp;
CFWL_CoreToolTipDP* m_ToolTipDp;
- CFX_PtrArray m_arrWidget;
+ CFX_ArrayTemplate<IFWL_ToolTipTarget*> m_arrWidget;
private:
static CFWL_ToolTipContainer* s_pInstance;
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index c168e4b63d..d58b594e27 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -651,7 +651,7 @@ void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) {
(CXFA_CalcData*)pNodeChange->GetUserData(XFA_CalcData);
int32_t iCount = pGlobalData ? pGlobalData->m_Globals.GetSize() : 0;
for (int32_t i = 0; i < iCount; i++) {
- CXFA_WidgetAcc* pResultAcc = (CXFA_WidgetAcc*)pGlobalData->m_Globals[i];
+ CXFA_WidgetAcc* pResultAcc = pGlobalData->m_Globals[i];
if (pResultAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) {
continue;
}
diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp
index 69883674e5..608c9073c3 100644
--- a/xfa/fxfa/app/xfa_fontmgr.cpp
+++ b/xfa/fxfa/app/xfa_fontmgr.cpp
@@ -1737,11 +1737,8 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName(
}
CXFA_DefFontMgr::~CXFA_DefFontMgr() {
- int32_t iCounts = m_CacheFonts.GetSize();
- for (int32_t i = 0; i < iCounts; i++) {
- ((IFX_Font*)m_CacheFonts[i])->Release();
- }
- m_CacheFonts.RemoveAll();
+ for (int32_t i = 0; i < m_CacheFonts.GetSize(); i++)
+ m_CacheFonts[i]->Release();
}
IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc,
diff --git a/xfa/fxfa/include/xfa_ffwidget.h b/xfa/fxfa/include/xfa_ffwidget.h
index 0c0ba75791..a6ab999485 100644
--- a/xfa/fxfa/include/xfa_ffwidget.h
+++ b/xfa/fxfa/include/xfa_ffwidget.h
@@ -29,13 +29,16 @@ enum XFA_WIDGETITEM {
XFA_WIDGETITEM_NextSibling,
XFA_WIDGETITEM_PrevSibling,
};
+
class CXFA_CalcData {
public:
CXFA_CalcData() : m_iRefCount(0) {}
~CXFA_CalcData() { m_Globals.RemoveAll(); }
- CFX_PtrArray m_Globals;
+
+ CFX_ArrayTemplate<CXFA_WidgetAcc*> m_Globals;
int32_t m_iRefCount;
};
+
class CXFA_FFWidget : public CFX_PrivateData, public CXFA_ContentLayoutItem {
public:
CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc);
diff --git a/xfa/fxfa/include/xfa_fontmgr.h b/xfa/fxfa/include/xfa_fontmgr.h
index 8b3e20f5e3..c7358a4c2a 100644
--- a/xfa/fxfa/include/xfa_fontmgr.h
+++ b/xfa/fxfa/include/xfa_fontmgr.h
@@ -39,7 +39,7 @@ class CXFA_DefFontMgr {
uint16_t wCodePage = 0xFFFF);
protected:
- CFX_PtrArray m_CacheFonts;
+ CFX_ArrayTemplate<IFX_Font*> m_CacheFonts;
};
class CXFA_PDFFontMgr {
diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp
index 069279cdc5..519c4819bd 100644
--- a/xfa/fxfa/parser/xfa_localemgr.cpp
+++ b/xfa/fxfa/parser/xfa_localemgr.cpp
@@ -1134,14 +1134,11 @@ CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid)
m_pDefLocale = GetLocaleByName(wsDeflcid.AsStringC());
}
CXFA_LocaleMgr::~CXFA_LocaleMgr() {
- int32_t iCount = m_LocaleArray.GetSize();
- for (int32_t i = 0; i < iCount; i++) {
- ((IFX_Locale*)m_LocaleArray[i])->Release();
- }
- int32_t iXmls = m_XMLLocaleArray.GetSize();
- for (int32_t j = 0; j < iXmls; j++) {
- ((IFX_Locale*)m_XMLLocaleArray[j])->Release();
- }
+ for (int32_t i = 0; i < m_LocaleArray.GetSize(); i++)
+ m_LocaleArray[i]->Release();
+
+ for (int32_t j = 0; j < m_XMLLocaleArray.GetSize(); j++)
+ m_XMLLocaleArray[j]->Release();
}
void CXFA_LocaleMgr::Release() {
delete this;
@@ -1149,19 +1146,24 @@ void CXFA_LocaleMgr::Release() {
uint16_t CXFA_LocaleMgr::GetDefLocaleID() {
return m_dwDeflcid;
}
+
IFX_Locale* CXFA_LocaleMgr::GetDefLocale() {
- if (m_pDefLocale) {
+ if (m_pDefLocale)
return m_pDefLocale;
- } else if (m_LocaleArray.GetSize()) {
- return (IFX_Locale*)m_LocaleArray[0];
- } else if (m_XMLLocaleArray.GetSize()) {
- return (IFX_Locale*)m_XMLLocaleArray[0];
- }
+
+ if (m_LocaleArray.GetSize())
+ return m_LocaleArray[0];
+
+ if (m_XMLLocaleArray.GetSize())
+ return m_XMLLocaleArray[0];
+
m_pDefLocale = GetLocale(m_dwDeflcid);
if (m_pDefLocale)
m_XMLLocaleArray.Add(m_pDefLocale);
+
return m_pDefLocale;
}
+
IFX_Locale* CXFA_LocaleMgr::GetLocale(uint16_t lcid) {
IFX_Locale* pLocal = NULL;
switch (lcid) {
@@ -1219,7 +1221,7 @@ IFX_Locale* CXFA_LocaleMgr::GetLocaleByName(
int32_t iCount = m_LocaleArray.GetSize();
int32_t i = 0;
for (i = 0; i < iCount; i++) {
- IFX_Locale* pLocale = ((IFX_Locale*)m_LocaleArray[i]);
+ IFX_Locale* pLocale = m_LocaleArray[i];
if (pLocale->GetName() == wsLocaleName) {
return pLocale;
}
@@ -1230,7 +1232,7 @@ IFX_Locale* CXFA_LocaleMgr::GetLocaleByName(
}
iCount = m_XMLLocaleArray.GetSize();
for (i = 0; i < iCount; i++) {
- IFX_Locale* pLocale = ((IFX_Locale*)m_XMLLocaleArray[i]);
+ IFX_Locale* pLocale = m_XMLLocaleArray[i];
if (pLocale->GetName() == wsLocaleName) {
return pLocale;
}
diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/xfa_localemgr.h
index 2bdd1dd504..c82c47c7f3 100644
--- a/xfa/fxfa/parser/xfa_localemgr.h
+++ b/xfa/fxfa/parser/xfa_localemgr.h
@@ -43,8 +43,8 @@ class CXFA_LocaleMgr : public IFX_LocaleMgr {
CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig);
protected:
- CFX_PtrArray m_LocaleArray;
- CFX_PtrArray m_XMLLocaleArray;
+ CFX_ArrayTemplate<IFX_Locale*> m_LocaleArray;
+ CFX_ArrayTemplate<IFX_Locale*> m_XMLLocaleArray;
IFX_Locale* m_pDefLocale;
CFX_WideString m_wsConfigLocale;
uint16_t m_dwDeflcid;
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp
index 0c8aa1a838..ea16fd1e7c 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -58,10 +58,8 @@ CXFA_ScriptContext::~CXFA_ScriptContext() {
m_pResolveProcessor = NULL;
}
m_upObjectArray.RemoveAll();
- for (int32_t i = 0; i < m_CacheListArray.GetSize(); i++) {
- delete ((CXFA_NodeList*)m_CacheListArray[i]);
- }
- m_CacheListArray.RemoveAll();
+ for (int32_t i = 0; i < m_CacheListArray.GetSize(); i++)
+ delete m_CacheListArray[i];
}
void CXFA_ScriptContext::Initialize(FXJSE_HRUNTIME hRuntime) {
m_hJsRuntime = hRuntime;
diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h
index 414e403d19..1ff8f76745 100644
--- a/xfa/fxfa/parser/xfa_script_imp.h
+++ b/xfa/fxfa/parser/xfa_script_imp.h
@@ -113,7 +113,7 @@ class CXFA_ScriptContext {
CFX_MapPtrTemplate<CXFA_Object*, FXJSE_HCONTEXT> m_mapVariableToHValue;
CXFA_EventParam m_eventParam;
CXFA_NodeArray m_upObjectArray;
- CFX_PtrArray m_CacheListArray;
+ CFX_ArrayTemplate<CXFA_NodeList*> m_CacheListArray;
CXFA_NodeArray* m_pScriptNodeArray;
CXFA_ResolveProcessor* m_pResolveProcessor;
XFA_HFM2JSCONTEXT m_hFM2JSContext;
diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp
index 82017f49a0..fd85714254 100644
--- a/xfa/fxgraphics/cfx_graphics.cpp
+++ b/xfa/fxgraphics/cfx_graphics.cpp
@@ -644,8 +644,7 @@ FX_ERR CFX_Graphics::RestoreGraphState() {
return FX_ERR_Intermediate_Value_Invalid;
}
int32_t topIndex = size - 1;
- std::unique_ptr<TInfo> info(
- reinterpret_cast<TInfo*>(m_infoStack.GetAt(topIndex)));
+ std::unique_ptr<TInfo> info(m_infoStack.GetAt(topIndex));
if (!info)
return FX_ERR_Intermediate_Value_Invalid;
m_info = *info;
diff --git a/xfa/fxgraphics/include/cfx_graphics.h b/xfa/fxgraphics/include/cfx_graphics.h
index 1438acb7f4..7f456270a5 100644
--- a/xfa/fxgraphics/include/cfx_graphics.h
+++ b/xfa/fxgraphics/include/cfx_graphics.h
@@ -245,7 +245,7 @@ class CFX_Graphics {
CFX_RectF& rect);
CFX_RenderDevice* m_renderDevice;
- CFX_PtrArray m_infoStack;
+ CFX_ArrayTemplate<TInfo*> m_infoStack;
CAGG_Graphics* m_aggGraphics;
friend class CAGG_Graphics;
};