diff options
-rw-r--r-- | core/fpdfapi/parser/cpdf_crypto_handler.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_combobox.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_listbox.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/fpdf_save.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/fpdf_sysfontinfo.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/fpdf_text.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/fpdf_transformpage.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_combo_box.cpp | 3 | ||||
-rw-r--r-- | fxjs/cjs_eventhandler.cpp | 4 | ||||
-rw-r--r-- | fxjs/xfa/cjx_object.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_listboxtp.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp | 115 |
15 files changed, 82 insertions, 92 deletions
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp index 76be23e9d6..fa784668fa 100644 --- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp +++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp @@ -238,7 +238,7 @@ bool CPDF_CryptoHandler::CryptFinish(void* context, FX_Free(context); return true; } - AESCryptContext* pContext = (AESCryptContext*)context; + auto* pContext = static_cast<AESCryptContext*>(context); if (bEncrypt) { uint8_t block_buf[16]; if (pContext->m_BlockOffset == 16) { 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<CPWL_ComboBox*>(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<CPWL_ComboBox*>(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<CPDFSDK_Widget*>(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<CPWL_ListBox*>(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<CPWL_ListBox*>(GetPDFWindow(pPageView, false)); + if (pListBox) { int32_t nCurSel = pListBox->GetCurSel(); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); diff --git a/fpdfsdk/fpdf_save.cpp b/fpdfsdk/fpdf_save.cpp index cd1889e005..7da48f375d 100644 --- a/fpdfsdk/fpdf_save.cpp +++ b/fpdfsdk/fpdf_save.cpp @@ -97,10 +97,10 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, if (pFormPDFObj->IsReference()) { CPDF_Object* pFormDirectObj = pFormPDFObj->GetDirect(); if (pFormDirectObj && pFormDirectObj->IsStream()) { - pFormStream = (CPDF_Stream*)pFormDirectObj; + pFormStream = pFormDirectObj->AsStream(); } } else if (pFormPDFObj->IsStream()) { - pFormStream = (CPDF_Stream*)pFormPDFObj; + pFormStream = pFormPDFObj->AsStream(); } } @@ -108,13 +108,13 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, // Get datasets CPDF_Stream CPDF_Object* pDataSetsPDFObj = pArray->GetObjectAt(iDataSetsIndex); if (pDataSetsPDFObj->IsReference()) { - CPDF_Reference* pDataSetsRefObj = (CPDF_Reference*)pDataSetsPDFObj; + CPDF_Reference* pDataSetsRefObj = pDataSetsPDFObj->AsReference(); CPDF_Object* pDataSetsDirectObj = pDataSetsRefObj->GetDirect(); if (pDataSetsDirectObj && pDataSetsDirectObj->IsStream()) { - pDataSetsStream = (CPDF_Stream*)pDataSetsDirectObj; + pDataSetsStream = pDataSetsDirectObj->AsStream(); } } else if (pDataSetsPDFObj->IsStream()) { - pDataSetsStream = (CPDF_Stream*)pDataSetsPDFObj; + pDataSetsStream = pDataSetsPDFObj->AsStream(); } } // L"datasets" diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp index e310e4d6f7..3a3f9e1257 100644 --- a/fpdfsdk/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/fpdf_sysfontinfo.cpp @@ -136,7 +136,7 @@ static void DefaultRelease(struct _FPDF_SYSFONTINFO* pThis) { static void DefaultEnumFonts(struct _FPDF_SYSFONTINFO* pThis, void* pMapper) { auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis); - pDefault->m_pFontInfo->EnumFontList((CFX_FontMapper*)pMapper); + pDefault->m_pFontInfo->EnumFontList(static_cast<CFX_FontMapper*>(pMapper)); } static void* DefaultMapFont(struct _FPDF_SYSFONTINFO* pThis, diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp index c5906acef0..dade84a005 100644 --- a/fpdfsdk/fpdf_text.cpp +++ b/fpdfsdk/fpdf_text.cpp @@ -51,7 +51,7 @@ FPDF_EXPORT FPDF_TEXTPAGE FPDF_CALLCONV FPDFText_LoadPage(FPDF_PAGE page) { return nullptr; #ifdef PDF_ENABLE_XFA - CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; + CPDFXFA_Page* pPage = UnderlyingFromFPDFPage(page); CPDFXFA_Context* pContext = pPage->GetContext(); CPDF_ViewerPreferences viewRef(pContext->GetPDFDoc()); #else // PDF_ENABLE_XFA diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index 860ba42c96..d2d9f8dbc4 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -189,9 +189,10 @@ FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, double d, double e, double f) { - CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object; + CPDF_PageObject* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object); if (!pPageObj) return; + CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e, (float)f); // Special treatment to shading object, because the ClipPath for shading @@ -267,7 +268,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page, return; std::ostringstream strClip; - CPDF_ClipPath* pClipPath = (CPDF_ClipPath*)clipPath; + auto* pClipPath = static_cast<CPDF_ClipPath*>(clipPath); for (size_t i = 0; i < pClipPath->GetPathCount(); ++i) { CPDF_Path path = pClipPath->GetPath(i); if (path.GetPoints().empty()) { diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp index 2e6e56c52b..a69dd7418f 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box.cpp @@ -88,7 +88,7 @@ bool CPWL_CBListBox::IsChar(uint16_t nChar, uint32_t nFlag) const { } bool CPWL_CBListBox::OnCharNotify(uint16_t nChar, uint32_t nFlag) { - if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) + if (auto* pComboBox = static_cast<CPWL_ComboBox*>(GetParentWindow())) pComboBox->SetSelectText(); return OnNotifySelectionChanged(true, nFlag); @@ -99,7 +99,6 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Wnd::DrawThisAppearance(pDevice, mtUser2Device); CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect(); - if (!IsVisible() || rectWnd.IsEmpty()) return; diff --git a/fxjs/cjs_eventhandler.cpp b/fxjs/cjs_eventhandler.cpp index b09ca7e733..933970954a 100644 --- a/fxjs/cjs_eventhandler.cpp +++ b/fxjs/cjs_eventhandler.cpp @@ -152,7 +152,7 @@ void CJS_EventHandler::OnField_Focus(bool bModifier, m_bModifier = bModifier; m_bShift = bShift; m_strTargetName = pTarget->GetFullName(); - m_pValue = (WideString*)&Value; + m_pValue = const_cast<WideString*>(&Value); } void CJS_EventHandler::OnField_Blur(bool bModifier, @@ -164,7 +164,7 @@ void CJS_EventHandler::OnField_Blur(bool bModifier, m_bModifier = bModifier; m_bShift = bShift; m_strTargetName = pTarget->GetFullName(); - m_pValue = (WideString*)&Value; + m_pValue = const_cast<WideString*>(&Value); } void CJS_EventHandler::OnField_Keystroke(WideString& strChange, diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index 0ac2f44123..cda4c6a45a 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -246,7 +246,7 @@ bool CJX_Object::SetAttribute(XFA_Attribute eAttr, } void CJX_Object::SetMapModuleString(void* pKey, const WideStringView& wsValue) { - SetMapModuleBuffer(pKey, (void*)wsValue.unterminated_c_str(), + SetMapModuleBuffer(pKey, const_cast<wchar_t*>(wsValue.unterminated_c_str()), wsValue.GetLength() * sizeof(wchar_t), nullptr); } diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index e535112233..6c495b4c81 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp @@ -30,7 +30,8 @@ void CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { &pParams->m_rtPart, &pParams->m_matrix); if (pParams->m_pData) { FillSolidRect(pParams->m_pGraphics, FWLTHEME_COLOR_Background, - (CFX_RectF*)pParams->m_pData, &pParams->m_matrix); + static_cast<CFX_RectF*>(pParams->m_pData), + &pParams->m_matrix); } break; } @@ -74,5 +75,5 @@ void CFWL_ListBoxTP::DrawListBoxItem(CXFA_Graphics* pGraphics, pGraphics->RestoreGraphState(); } if (dwStates & CFWL_PartState_Focused && pData) - DrawFocus(pGraphics, (CFX_RectF*)pData, pMatrix); + DrawFocus(pGraphics, static_cast<CFX_RectF*>(pData), pMatrix); } diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index 31e9e3df76..3d06c7df27 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -46,7 +46,7 @@ CXFA_FFDoc::~CXFA_FFDoc() { bool CXFA_FFDoc::ParseDoc(CPDF_Object* pElementXFA) { std::vector<CPDF_Stream*> xfaStreams; if (pElementXFA->IsArray()) { - CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA; + CPDF_Array* pXFAArray = pElementXFA->AsArray(); for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) { if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) xfaStreams.push_back(pStream); diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index d8de8a028f..520ed31ec5 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -305,9 +305,8 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, eParam.m_wsChange = wsChanged; eParam.m_pTarget = m_pNode.Get(); eParam.m_wsPrevText = wsPrevText; - CFWL_Edit* pEdit = ToEdit(m_pNormalWidget.get()); if (m_pNode->GetFFWidgetType() == XFA_FFWidgetType::kDateTimeEdit) { - CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit; + auto* pDateTime = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get()); eParam.m_wsNewText = pDateTime->GetEditText(); if (pDateTime->HasSelection()) { size_t count; @@ -315,6 +314,7 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, eParam.m_iSelEnd = eParam.m_iSelStart + count; } } else { + CFWL_Edit* pEdit = ToEdit(m_pNormalWidget.get()); eParam.m_wsNewText = pEdit->GetText(); if (pEdit->HasSelection()) std::tie(eParam.m_iSelStart, eParam.m_iSelEnd) = pEdit->GetSelection(); diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index 45866642c5..e9843fbf99 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -255,10 +255,9 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, } if (bContainerHeightAutoSize) { - for (CXFA_ContentLayoutItem* pLayoutChild = - (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; - pLayoutChild; - pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { + for (CXFA_LayoutItem* pIter = pLayoutRow->m_pFirstChild; pIter; + pIter = pIter->m_pNextSibling) { + auto* pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(pIter); UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width, &fContentCalculatedHeight); float fOldChildHeight = pLayoutChild->m_sSize.height; @@ -282,12 +281,10 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, break; } if (fOffHeight > 0) { - for (CXFA_ContentLayoutItem* pInnerLayoutChild = - (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild; - pInnerLayoutChild; - pInnerLayoutChild = - (CXFA_ContentLayoutItem*)pInnerLayoutChild->m_pNextSibling) { - pInnerLayoutChild->m_sPos.y += fOffHeight; + for (CXFA_LayoutItem* pInnerIter = pLayoutChild->m_pFirstChild; + pInnerIter; pInnerIter = pInnerIter->m_pNextSibling) { + static_cast<CXFA_ContentLayoutItem*>(pInnerIter)->m_sPos.y += + fOffHeight; } } } @@ -308,10 +305,9 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, if (pLayoutRow->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout) == XFA_AttributeEnum::Rl_row) { - for (CXFA_ContentLayoutItem* pLayoutChild = - (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; - pLayoutChild; - pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { + for (CXFA_LayoutItem* pIter = pLayoutRow->m_pFirstChild; pIter; + pIter = pIter->m_pNextSibling) { + auto* pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(pIter); pLayoutChild->m_sPos.x = fContentCalculatedWidth - pLayoutChild->m_sPos.x - pLayoutChild->m_sSize.width; @@ -510,10 +506,9 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, } } float fRelSplitPos = *fProposedSplitPos - fCurBottomMargin; - for (CXFA_ContentLayoutItem* pChildItem = - (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; - pChildItem; - pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { + for (CXFA_LayoutItem* pIter = pLayoutItem->m_pFirstChild; pIter; + pIter = pIter->m_pNextSibling) { + auto* pChildItem = static_cast<CXFA_ContentLayoutItem*>(pIter); float fChildOffset = fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; bool bChange = false; @@ -721,11 +716,10 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( pSecondParent->AddChild(pSecondLayoutItem); if (fCurTopMargin > 0 && pLayoutItem->m_pFirstChild) { pSecondParent->m_sSize.height += fCurTopMargin; - CXFA_ContentLayoutItem* pParentItem = - (CXFA_ContentLayoutItem*)pSecondParent->m_pParent; - while (pParentItem) { - pParentItem->m_sSize.height += fCurTopMargin; - pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent; + for (CXFA_LayoutItem* pParentIter = pSecondParent->m_pParent; pParentIter; + pParentIter = pParentIter->m_pParent) { + static_cast<CXFA_ContentLayoutItem*>(pParentIter)->m_sSize.height += + fCurTopMargin; } } } else { @@ -735,7 +729,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( } CXFA_ContentLayoutItem* pChildren = - (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; + static_cast<CXFA_ContentLayoutItem*>(pLayoutItem->m_pFirstChild); pLayoutItem->m_pFirstChild = nullptr; float lHeightForKeep = 0; @@ -743,7 +737,8 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( std::vector<CXFA_ContentLayoutItem*> keepLayoutItems; for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr; pChildItem; pChildItem = pChildNext) { - pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; + pChildNext = + static_cast<CXFA_ContentLayoutItem*>(pChildItem->m_pNextSibling); pChildItem->m_pNextSibling = nullptr; if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin + XFA_LAYOUT_FLOAT_PERCISION) { @@ -1308,8 +1303,9 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { eLayout != XFA_AttributeEnum::Rl_row) { continue; } - if (CXFA_ContentLayoutItem* pRowLayoutCell = - (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild) { + auto* pRowLayoutCell = + static_cast<CXFA_ContentLayoutItem*>(pLayoutChild->m_pFirstChild); + if (pRowLayoutCell) { rgRowItems.push_back(pRowLayoutCell); int32_t iColSpan = pRowLayoutCell->m_pFormNode->JSObject()->GetInteger( XFA_Attribute::ColSpan); @@ -1328,8 +1324,8 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 || !rgRowItems[i]->m_pFormNode->PresenceRequiresSpace())) { - CXFA_ContentLayoutItem* pNewCell = - (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; + auto* pNewCell = static_cast<CXFA_ContentLayoutItem*>( + rgRowItems[i]->m_pNextSibling); if (rgRowItemsSpan[i] < 0 && rgRowItems[i]->m_pFormNode->PresenceRequiresSpace()) { pNewCell = nullptr; @@ -1382,10 +1378,9 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { } float fCurrentRowY = 0; - for (CXFA_ContentLayoutItem* pLayoutChild = - (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; - pLayoutChild; - pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { + for (CXFA_LayoutItem* pIter = m_pLayoutItem->m_pFirstChild; pIter; + pIter = pIter->m_pNextSibling) { + auto* pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(pIter); if (!pLayoutChild->m_pFormNode->PresenceRequiresSpace()) continue; @@ -1526,11 +1521,9 @@ bool CXFA_ItemLayoutProcessor::JudgePutNextPage( return false; float fItemsHeight = 0; - for (CXFA_ContentLayoutItem* pChildLayoutItem = - (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild; - pChildLayoutItem; - pChildLayoutItem = - (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { + for (CXFA_LayoutItem* pIter = pParentLayoutItem->m_pFirstChild; pIter; + pIter = pIter->m_pNextSibling) { + auto* pChildLayoutItem = static_cast<CXFA_ContentLayoutItem*>(pIter); if (ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) { pKeepItems->push_back(pChildLayoutItem); fItemsHeight += pChildLayoutItem->m_sSize.height; @@ -1659,19 +1652,21 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (m_pLayoutItem) { if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done && eFlowStrategy != XFA_AttributeEnum::Tb) { - pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; + pLayoutChild = + static_cast<CXFA_ContentLayoutItem*>(m_pLayoutItem->m_pFirstChild); for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; - pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { + pLayoutNext = static_cast<CXFA_ContentLayoutItem*>( + pLayoutNext->m_pNextSibling)) { if (pLayoutNext->m_sPos.y != pLayoutChild->m_sPos.y) pLayoutChild = pLayoutNext; } } - for (CXFA_ContentLayoutItem* pLayoutTempChild = - (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; + for (auto* pLayoutTempChild = + static_cast<CXFA_ContentLayoutItem*>(m_pLayoutItem->m_pFirstChild); pLayoutTempChild != pLayoutChild; - pLayoutTempChild = - (CXFA_ContentLayoutItem*)pLayoutTempChild->m_pNextSibling) { + pLayoutTempChild = static_cast<CXFA_ContentLayoutItem*>( + pLayoutTempChild->m_pNextSibling)) { if (!pLayoutTempChild->m_pFormNode->PresenceRequiresSpace()) continue; @@ -1714,7 +1709,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( (eFlowStrategy != XFA_AttributeEnum::Rl_tb ? 0 : 2); if (pLayoutChild) { for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; - pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { + pLayoutNext = static_cast<CXFA_ContentLayoutItem*>( + pLayoutNext->m_pNextSibling)) { if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor && m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) { pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem; @@ -1738,29 +1734,26 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } } - if ((CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild == + if (static_cast<CXFA_ContentLayoutItem*>(m_pLayoutItem->m_pFirstChild) == pLayoutChild) { m_pLayoutItem->m_pFirstChild = nullptr; } else { - CXFA_ContentLayoutItem* pLayoutNext = - (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; - for (; pLayoutNext; - pLayoutNext = - (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { - if ((CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling == - pLayoutChild) { + for (CXFA_LayoutItem* pLayoutNext = m_pLayoutItem->m_pFirstChild; + pLayoutNext; pLayoutNext = pLayoutNext->m_pNextSibling) { + if (static_cast<CXFA_ContentLayoutItem*>( + pLayoutNext->m_pNextSibling) == pLayoutChild) { pLayoutNext->m_pNextSibling = nullptr; break; } } } - CXFA_ContentLayoutItem* pLayoutNextTemp = - (CXFA_ContentLayoutItem*)pLayoutChild; + auto* pLayoutNextTemp = + static_cast<CXFA_ContentLayoutItem*>(pLayoutChild); while (pLayoutNextTemp) { pLayoutNextTemp->m_pParent = nullptr; - CXFA_ContentLayoutItem* pSaveLayoutNext = - (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling; + auto* pSaveLayoutNext = static_cast<CXFA_ContentLayoutItem*>( + pLayoutNextTemp->m_pNextSibling); pLayoutNextTemp->m_pNextSibling = nullptr; pLayoutNextTemp = pSaveLayoutNext; } @@ -2395,11 +2388,9 @@ void CXFA_ItemLayoutProcessor::AddLeaderAfterSplit( } float fHeight = pLeaderLayoutItem->m_sSize.height; - for (CXFA_ContentLayoutItem* pChildItem = - (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; - pChildItem; - pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { - pChildItem->m_sPos.y += fHeight; + for (CXFA_LayoutItem* pIter = m_pLayoutItem->m_pFirstChild; pIter; + pIter = pIter->m_pNextSibling) { + static_cast<CXFA_ContentLayoutItem*>(pIter)->m_sPos.y += fHeight; } pLeaderLayoutItem->m_sPos.y = 0; |