From 3fea70cb133ca71c800482853473797a352ece16 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 21 Apr 2016 13:47:58 -0700 Subject: Remove unused CFX_IntArray. The only place its used, elements are added to it but the array is not used otherwise. Review URL: https://codereview.chromium.org/1906133002 --- fpdfsdk/formfiller/cffl_listbox.cpp | 47 +++++++++++++------------------------ fpdfsdk/fsdk_baseannot.cpp | 33 -------------------------- fpdfsdk/include/fsdk_baseannot.h | 5 ---- 3 files changed, 16 insertions(+), 69 deletions(-) diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index b668b67edb..dc4f07d0d2 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -111,40 +111,25 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget); - - if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { - CFX_IntArray aOldSelect, aNewSelect; - - { - for (int i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { - if (m_pWidget->IsOptionSelected(i)) { - aOldSelect.Add(i); - } - } - } - - int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); - - m_pWidget->ClearSelection(FALSE); + CPWL_ListBox* pListBox = + static_cast(GetPDFWindow(pPageView, FALSE)); + if (!pListBox) + return; - if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { - for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { - if (pListBox->IsItemSelected(i)) { - m_pWidget->SetOptionSelection(i, TRUE, FALSE); - aNewSelect.Add(i); - } - } - } else { - m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE); - aNewSelect.Add(pListBox->GetCurSel()); + int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); + m_pWidget->ClearSelection(FALSE); + if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { + for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { + if (pListBox->IsItemSelected(i)) + m_pWidget->SetOptionSelection(i, TRUE, FALSE); } - - m_pWidget->SetTopVisibleIndex(nNewTopIndex); - m_pWidget->ResetFieldAppearance(TRUE); - m_pWidget->UpdateField(); - SetChangeMark(); + } else { + m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE); } + m_pWidget->SetTopVisibleIndex(nNewTopIndex); + m_pWidget->ResetFieldAppearance(TRUE); + m_pWidget->UpdateField(); + SetChangeMark(); } void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp index e8014a3f56..24aa846142 100644 --- a/fpdfsdk/fsdk_baseannot.cpp +++ b/fpdfsdk/fsdk_baseannot.cpp @@ -731,39 +731,6 @@ int CPDFSDK_BAAnnot::GetBorderStyle() const { return BBS_SOLID; } -void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array) { - CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); - if (!pBSDict) { - pBSDict = new CPDF_Dictionary; - m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); - } - - CPDF_Array* pArray = new CPDF_Array; - for (size_t i = 0, sz = array.GetSize(); i < sz; i++) - pArray->AddInteger(array[i]); - - pBSDict->SetAt("D", pArray); -} - -void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const { - CPDF_Array* pDash = NULL; - - CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border"); - if (pBorder) { - pDash = pBorder->GetArrayAt(3); - } else { - CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); - if (pBSDict) { - pDash = pBSDict->GetArrayBy("D"); - } - } - - if (pDash) { - for (size_t i = 0, sz = pDash->GetCount(); i < sz; i++) - array.Add(pDash->GetIntegerAt(i)); - } -} - void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { CPDF_Array* pArray = new CPDF_Array; pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index 4756bdbdba..7a1d3e3c20 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -25,8 +25,6 @@ class CFX_Matrix; class CPDF_RenderOptions; class CFX_RenderDevice; -#define CFX_IntArray CFX_ArrayTemplate - class CPDFSDK_DateTime { public: CPDFSDK_DateTime(); @@ -170,9 +168,6 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot { void SetBorderStyle(int nStyle); int GetBorderStyle() const; - void SetBorderDash(const CFX_IntArray& array); - void GetBorderDash(CFX_IntArray& array) const; - // The background of the annotation's icon when closed // The title bar of the annotation's pop-up window // The border of a link annotation -- cgit v1.2.3