diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fgas/crt/fgas_utils.cpp | 36 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_utils.h | 3 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_checkboximp.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_formimp.cpp | 36 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetimp.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetmgrimp.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetmgrimp.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffpageview.cpp | 4 |
8 files changed, 46 insertions, 47 deletions
diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp index 01792b833a..4f15fc4845 100644 --- a/xfa/fgas/crt/fgas_utils.cpp +++ b/xfa/fgas/crt/fgas_utils.cpp @@ -141,9 +141,9 @@ CFX_BaseMassArrayImp::CFX_BaseMassArrayImp(int32_t iChunkSize, : m_iChunkSize(iChunkSize), m_iBlockSize(iBlockSize), m_iChunkCount(0), - m_iBlockCount(0) { + m_iBlockCount(0), + m_pData(new CFX_ArrayTemplate<void*>()) { ASSERT(m_iChunkSize > 0 && m_iBlockSize > 0); - m_pData = new CFX_PtrArray; m_pData->SetSize(16); } CFX_BaseMassArrayImp::~CFX_BaseMassArrayImp() { @@ -335,7 +335,7 @@ struct FX_BASEDISCRETEARRAYDATA { int32_t iBlockSize; int32_t iChunkSize; int32_t iChunkCount; - CFX_PtrArray ChunkBuffer; + CFX_ArrayTemplate<uint8_t*> ChunkBuffer; }; CFX_BaseDiscreteArray::CFX_BaseDiscreteArray(int32_t iChunkSize, @@ -360,7 +360,7 @@ uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) { uint8_t* pChunk = NULL; int32_t iChunk = index / iChunkSize; if (iChunk < iChunkCount) { - pChunk = (uint8_t*)pData->ChunkBuffer.GetAt(iChunk); + pChunk = pData->ChunkBuffer.GetAt(iChunk); } if (!pChunk) { pChunk = FX_Alloc2D(uint8_t, iChunkSize, pData->iBlockSize); @@ -373,30 +373,26 @@ uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) { return pChunk + (index % iChunkSize) * pData->iBlockSize; } uint8_t* CFX_BaseDiscreteArray::GetAt(int32_t index) const { - ASSERT(index > -1); + ASSERT(index >= 0); FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData; int32_t iChunkSize = pData->iChunkSize; int32_t iChunk = index / iChunkSize; - if (iChunk >= pData->iChunkCount) { - return NULL; - } - uint8_t* pChunk = (uint8_t*)pData->ChunkBuffer.GetAt(iChunk); - if (pChunk == NULL) { - return NULL; - } + if (iChunk >= pData->iChunkCount) + return nullptr; + + uint8_t* pChunk = pData->ChunkBuffer.GetAt(iChunk); + if (!pChunk) + return nullptr; + return pChunk + (index % iChunkSize) * pData->iBlockSize; } void CFX_BaseDiscreteArray::RemoveAll() { FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData; - CFX_PtrArray& ChunkBuffer = pData->ChunkBuffer; + CFX_ArrayTemplate<uint8_t*>& ChunkBuffer = pData->ChunkBuffer; int32_t& iChunkCount = pData->iChunkCount; - for (int32_t i = 0; i < iChunkCount; i++) { - void* p = ChunkBuffer.GetAt(i); - if (p == NULL) { - continue; - } - FX_Free(p); - } + for (int32_t i = 0; i < iChunkCount; i++) + FX_Free(ChunkBuffer.GetAt(i)); + ChunkBuffer.RemoveAll(); iChunkCount = 0; } diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h index ebbcf4bd97..ab94f6ed40 100644 --- a/xfa/fgas/crt/fgas_utils.h +++ b/xfa/fgas/crt/fgas_utils.h @@ -202,11 +202,12 @@ class CFX_BaseMassArrayImp : public CFX_Target { int32_t iCount = -1); int32_t RemoveLast(int32_t iCount = -1); void RemoveAll(FX_BOOL bLeaveMemory = FALSE); + int32_t m_iChunkSize; int32_t m_iBlockSize; int32_t m_iChunkCount; int32_t m_iBlockCount; - CFX_PtrArray* m_pData; + CFX_ArrayTemplate<void*>* m_pData; protected: void Append(int32_t iDstStart, diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp index 76d5b8f421..f11a917eb1 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.cpp +++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp @@ -361,7 +361,7 @@ void CFWL_CheckBoxImp::NextStates() { CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); if (!pWidgetMgr->IsFormDisabled()) { - CFX_PtrArray radioarr; + CFX_ArrayTemplate<IFWL_Widget*> radioarr; pWidgetMgr->GetSameGroupRadioButton(m_pInterface, radioarr); IFWL_CheckBox* pCheckBox = NULL; int32_t iCount = radioarr.GetSize(); diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 2fd85a8d0e..bbec673ed6 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -526,32 +526,32 @@ CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) { return NULL; } CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) { - if (nIndex < 0) { - return NULL; - } - CFX_PtrArray arrBtn; - if (m_pMinBox) { + if (nIndex < 0) + return nullptr; + + CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn; + if (m_pMinBox) arrBtn.Add(m_pMinBox); - } - if (m_pMaxBox) { + + if (m_pMaxBox) arrBtn.Add(m_pMaxBox); - } - if (m_pCloseBox) { + + if (m_pCloseBox) arrBtn.Add(m_pCloseBox); - } - return static_cast<CFWL_SysBtn*>(arrBtn[nIndex]); + + return arrBtn[nIndex]; } int32_t CFWL_FormImp::GetSysBtnIndex(CFWL_SysBtn* pBtn) { - CFX_PtrArray arrBtn; - if (m_pMinBox) { + CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn; + if (m_pMinBox) arrBtn.Add(m_pMinBox); - } - if (m_pMaxBox) { + + if (m_pMaxBox) arrBtn.Add(m_pMaxBox); - } - if (m_pCloseBox) { + + if (m_pCloseBox) arrBtn.Add(m_pCloseBox); - } + return arrBtn.Find(pBtn); } FX_FLOAT CFWL_FormImp::GetCaptionHeight() { diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index c9d91c41f2..38516c6557 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -473,7 +473,7 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { return FWL_ERR_Indefinite; if (bGlobal) { IFWL_Widget* parent = GetParent(); - CFX_PtrArray parents; + CFX_ArrayTemplate<IFWL_Widget*> parents; while (parent) { parents.Add(parent); parent = parent->GetParent(); @@ -483,7 +483,7 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { CFX_RectF rect; int32_t count = parents.GetSize(); for (int32_t i = count - 2; i >= 0; i--) { - parent = static_cast<IFWL_Widget*>(parents.GetAt(i)); + parent = parents.GetAt(i); parent->GetMatrix(ctmOnParent, FALSE); parent->GetWidgetRect(rect); matrix.Concat(ctmOnParent, TRUE); diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp index 0ce452edb0..02b63862e5 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.cpp +++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp @@ -564,8 +564,9 @@ IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( } return GetSiblingRadioButton(pNext, TRUE); } -void CFWL_WidgetMgr::GetSameGroupRadioButton(IFWL_Widget* pRadioButton, - CFX_PtrArray& group) { +void CFWL_WidgetMgr::GetSameGroupRadioButton( + IFWL_Widget* pRadioButton, + CFX_ArrayTemplate<IFWL_Widget*>& group) { IFWL_Widget* pFirst = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); if (!pFirst) { pFirst = pRadioButton; diff --git a/xfa/fwl/core/fwl_widgetmgrimp.h b/xfa/fwl/core/fwl_widgetmgrimp.h index 528ecdb792..0b4e2bf79d 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.h +++ b/xfa/fwl/core/fwl_widgetmgrimp.h @@ -112,7 +112,8 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr { int32_t CountRadioButtonGroup(IFWL_Widget* pFirst); IFWL_Widget* GetSiblingRadioButton(IFWL_Widget* pWidget, FX_BOOL bNext); IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton); - void GetSameGroupRadioButton(IFWL_Widget* pRadioButton, CFX_PtrArray& group); + void GetSameGroupRadioButton(IFWL_Widget* pRadioButton, + CFX_ArrayTemplate<IFWL_Widget*>& group); IFWL_Widget* GetDefaultButton(IFWL_Widget* pParent); void AddRedrawCounts(IFWL_Widget* pWidget); void ResetRedrawCounts(IFWL_Widget* pWidget); diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index 11628aa790..f1898c83f1 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -351,7 +351,7 @@ void CXFA_FFTabOrderPageWidgetIterator::OrderContainer( FX_BOOL& bCurrentItem, FX_BOOL& bContentArea, FX_BOOL bMarsterPage) { - CFX_PtrArray tabParams; + CFX_ArrayTemplate<CXFA_TabParam*> tabParams; CXFA_LayoutItem* pSearchItem = sIterator->MoveToNext(); while (pSearchItem) { if (!pSearchItem->IsContentLayoutItem()) { @@ -393,7 +393,7 @@ void CXFA_FFTabOrderPageWidgetIterator::OrderContainer( XFA_TabOrderWidgetComparator); } for (int32_t iStart = 0; iStart < iChildren; iStart++) { - CXFA_TabParam* pParam = (CXFA_TabParam*)tabParams[iStart]; + CXFA_TabParam* pParam = tabParams[iStart]; pContainer->m_Children.Add(pParam->m_pWidget); if (pParam->m_Children.GetSize() > 0) { pContainer->m_Children.Append(pParam->m_Children); |