summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-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
4 files changed, 23 insertions, 23 deletions
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;