From ea3a2529a7aa0199b385b7caa2e465c124eac8aa Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 26 Apr 2018 18:33:58 +0000 Subject: Replace some c-style cast with static_cast<> Change-Id: I9dd6a36770f77f3df6c4395572785d37402eadc2 Reviewed-on: https://pdfium-review.googlesource.com/31350 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fpdfsdk/formfiller/cffl_combobox.cpp | 9 +++------ fpdfsdk/formfiller/cffl_formfiller.cpp | 2 +- fpdfsdk/formfiller/cffl_listbox.cpp | 7 ++++--- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'fpdfsdk/formfiller') diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index 055b697669..8aa656b856 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -74,7 +74,7 @@ bool CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot, } bool CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) { - CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, false); + auto* pWnd = static_cast(GetPDFWindow(pPageView, false)); if (!pWnd) return false; @@ -250,12 +250,9 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Edit* pEdit) { WideString CFFL_ComboBox::GetSelectExportText() { WideString swRet; - int nExport = -1; CPDFSDK_PageView* pPageView = GetCurPageView(true); - if (CPWL_ComboBox* pComboBox = - (CPWL_ComboBox*)GetPDFWindow(pPageView, false)) { - nExport = pComboBox->GetSelect(); - } + auto* pComboBox = static_cast(GetPDFWindow(pPageView, false)); + int nExport = pComboBox ? pComboBox->GetSelect() : -1; if (nExport >= 0) { if (CPDF_FormField* pFormField = m_pWidget->GetFormField()) { diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index ac82e3ed47..261cb653e5 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -301,7 +301,7 @@ bool CFFL_FormFiller::Redo(CPDFSDK_Annot* pAnnot) { } void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag) { - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; + auto* pWidget = static_cast(pAnnot); UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(pPage, true); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true)) diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index 943412d509..bf24e116e5 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -81,7 +81,7 @@ bool CFFL_ListBox::OnChar(CPDFSDK_Annot* pAnnot, } bool CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) { - CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, false); + auto* pListBox = static_cast(GetPDFWindow(pPageView, false)); if (!pListBox) return false; @@ -140,8 +140,9 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { fa.sValue = L""; } else { - if (CPWL_ListBox* pListBox = - (CPWL_ListBox*)GetPDFWindow(pPageView, false)) { + auto* pListBox = + static_cast(GetPDFWindow(pPageView, false)); + if (pListBox) { int32_t nCurSel = pListBox->GetCurSel(); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); -- cgit v1.2.3