From 375c2764b56b38cc9326a8f8ef668fbf78234e9a Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 10 Mar 2017 14:37:14 -0800 Subject: Make most PDFium code pass Clang plugin's auto raw check. Change-Id: I9dc32342e24361389841ecba83081a97fc043377 Reviewed-on: https://pdfium-review.googlesource.com/2959 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- xfa/fde/cfde_txtedttextset.cpp | 2 +- xfa/fde/css/cfde_cssstyleselector.cpp | 10 +++++----- xfa/fde/css/cfde_cssstylesheet.cpp | 2 +- xfa/fde/css/cfde_cssstylesheet_unittest.cpp | 2 +- xfa/fwl/cfwl_checkbox.cpp | 2 +- xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 4 ++-- xfa/fxfa/app/xfa_ffchoicelist.cpp | 2 +- xfa/fxfa/app/xfa_ffdocview.cpp | 6 +++--- xfa/fxfa/app/xfa_ffpageview.cpp | 4 ++-- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 2 +- xfa/fxfa/parser/cxfa_layoutitem.cpp | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 6 +++--- xfa/fxfa/parser/xfa_utils.cpp | 17 +++++++++-------- 13 files changed, 31 insertions(+), 30 deletions(-) (limited to 'xfa') diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp index 1f86dabcdd..a6503f4022 100644 --- a/xfa/fde/cfde_txtedttextset.cpp +++ b/xfa/fde/cfde_txtedttextset.cpp @@ -78,7 +78,7 @@ std::vector CFDE_TxtEdtTextSet::GetCharRects( if (!pPiece || pPiece->nCount < 1) return std::vector(); - auto pEngine = static_cast(m_pPage->GetEngine()); + auto* pEngine = static_cast(m_pPage->GetEngine()); const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles(); FX_TXTRUN tr; diff --git a/xfa/fde/css/cfde_cssstyleselector.cpp b/xfa/fde/css/cfde_cssstyleselector.cpp index 5a7aa1b7ff..08cd0e9251 100644 --- a/xfa/fde/css/cfde_cssstyleselector.cpp +++ b/xfa/fde/css/cfde_cssstyleselector.cpp @@ -56,7 +56,7 @@ CFDE_CSSStyleSelector::MatchDeclarations(const CFX_WideString& tagname) { if (m_UARules.CountSelectors() == 0 || tagname.IsEmpty()) return matchedDecls; - auto rules = m_UARules.GetTagRuleData(tagname); + auto* rules = m_UARules.GetTagRuleData(tagname); if (!rules) return matchedDecls; @@ -106,19 +106,19 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( std::vector normals; std::vector customs; - for (auto& decl : declArray) + for (auto* decl : declArray) ExtractValues(decl, &importants, &normals, &customs); if (extraDecl) ExtractValues(extraDecl, &importants, &normals, &customs); - for (auto& prop : normals) + for (auto* prop : normals) ApplyProperty(prop->eProperty, prop->pValue, pComputedStyle); - for (auto& prop : customs) + for (auto* prop : customs) pComputedStyle->AddCustomStyle(*prop); - for (auto& prop : importants) + for (auto* prop : importants) ApplyProperty(prop->eProperty, prop->pValue, pComputedStyle); } diff --git a/xfa/fde/css/cfde_cssstylesheet.cpp b/xfa/fde/css/cfde_cssstylesheet.cpp index c8bf70ec23..e259e2f332 100644 --- a/xfa/fde/css/cfde_cssstylesheet.cpp +++ b/xfa/fde/css/cfde_cssstylesheet.cpp @@ -85,7 +85,7 @@ FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadStyleRule( case FDE_CSSSyntaxStatus::PropertyValue: { if (propertyTable || iValueLen > 0) { CFX_WideStringC strValue = pSyntax->GetCurrentString(); - auto decl = pStyleRule->GetDeclaration(); + auto* decl = pStyleRule->GetDeclaration(); if (!strValue.IsEmpty()) { if (propertyTable) { decl->AddProperty(propertyTable, strValue); diff --git a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp index fa73a7a9ba..9d8ecb9347 100644 --- a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp +++ b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp @@ -143,7 +143,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) { CFDE_CSSStyleRule* style = sheet_->GetRule(0); EXPECT_EQ(1UL, style->CountSelectorLists()); - auto sel = style->GetSelectorList(0); + auto* sel = style->GetSelectorList(0); EXPECT_TRUE(sel != nullptr); EXPECT_EQ(FX_HashCode_GetW(L"c", true), sel->GetNameHash()); diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp index 0102bc7cc4..ca31094fe6 100644 --- a/xfa/fwl/cfwl_checkbox.cpp +++ b/xfa/fwl/cfwl_checkbox.cpp @@ -184,7 +184,7 @@ void CFWL_CheckBox::NextStates() { if (!pWidgetMgr->IsFormDisabled()) { std::vector radioarr = pWidgetMgr->GetSameGroupRadioButton(this); - for (const auto& pWidget : radioarr) { + for (auto* pWidget : radioarr) { CFWL_CheckBox* pCheckBox = static_cast(pWidget); if (pCheckBox != this && pCheckBox->GetStates() & FWL_STATE_CKB_Checked) { diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index 2c262f006b..3a442bedbb 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -259,8 +259,8 @@ void CBC_QRCoderEncoder::MergeString( int32_t& e) { size_t mergeNum = 0; for (size_t i = 0; i + 1 < result->size(); i++) { - auto element1 = &(*result)[i]; - auto element2 = &(*result)[i + 1]; + auto* element1 = &(*result)[i]; + auto* element2 = &(*result)[i + 1]; if (element1->first == CBC_QRCoderMode::sALPHANUMERIC) { int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sALPHANUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e); diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index 3aabde870a..66b52fec40 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -227,7 +227,7 @@ CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, bool bDrawFocus) { } bool CXFA_FFComboBox::PtInActiveRect(const CFX_PointF& point) { - auto pComboBox = static_cast(m_pNormalWidget); + auto* pComboBox = static_cast(m_pNormalWidget); return pComboBox && pComboBox->GetBBox().Contains(point); } diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 87441814e5..545afcad00 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -633,12 +633,12 @@ void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { } void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) { - auto pGlobalData = + auto* pGlobalData = static_cast(pNodeChange->GetUserData(XFA_CalcData)); if (!pGlobalData) return; - for (const auto& pResultAcc : pGlobalData->m_Globals) { + for (auto* pResultAcc : pGlobalData->m_Globals) { if (!pResultAcc->GetNode()->HasRemovedChildren()) AddCalculateWidgetAcc(pResultAcc); } @@ -723,7 +723,7 @@ bool CXFA_FFDocView::RunEventLayoutReady() { return true; } void CXFA_FFDocView::RunBindItems() { - for (const auto& item : m_BindItems) { + for (auto* item : m_BindItems) { if (item->HasRemovedChildren()) continue; diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index caff52c6c0..181f0f19a5 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -363,8 +363,8 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() { static int32_t XFA_TabOrderWidgetComparator(const void* phWidget1, const void* phWidget2) { - auto param1 = *static_cast(const_cast(phWidget1)); - auto param2 = *static_cast(const_cast(phWidget2)); + auto* param1 = *static_cast(const_cast(phWidget1)); + auto* param2 = *static_cast(const_cast(phWidget2)); CFX_RectF rt1 = param1->m_pWidget->GetWidgetRect(); CFX_RectF rt2 = param2->m_pWidget->GetWidgetRect(); FX_FLOAT x1 = rt1.left, y1 = rt1.top, x2 = rt2.left, y2 = rt2.top; diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index adc5c31cc6..960771f9f8 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -1505,7 +1505,7 @@ CFX_RetainPtr CXFA_WidgetAcc::GetFDEFont() { font.GetTypeface(wsFontName); } - auto pDoc = GetDoc(); + auto* pDoc = GetDoc(); return pDoc->GetApp()->GetXFAFontMgr()->GetFont(pDoc, wsFontName, dwFontStyle); } diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp index 476d6118ac..5409c4e0c1 100644 --- a/xfa/fxfa/parser/cxfa_layoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp @@ -64,7 +64,7 @@ CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { CFX_RectF CXFA_LayoutItem::GetRect(bool bRelative) const { ASSERT(m_bIsContentLayoutItem); - auto pThis = static_cast(this); + auto* pThis = static_cast(this); CFX_PointF sPos = pThis->m_sPos; CFX_SizeF sSize = pThis->m_sSize; if (bRelative) diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index dd38c963d6..dd04668a33 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -182,7 +182,7 @@ void RelocateTableRowCells( int32_t nCurrentColIdx = 0; bool bMetWholeRowCell = false; - for (auto pLayoutChild = + for (auto* pLayoutChild = static_cast(pLayoutRow->m_pFirstChild); pLayoutChild; pLayoutChild = static_cast( pLayoutChild->m_pNextSibling)) { @@ -1995,7 +1995,7 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( childSize.height, &keepLayoutItems)) { m_arrayKeepItems.clear(); - for (auto item : keepLayoutItems) { + for (auto* item : keepLayoutItems) { pParentProcessor->m_pLayoutItem->RemoveChild(item); *fContentCurRowY -= item->m_sSize.height; m_arrayKeepItems.push_back(item); @@ -2271,7 +2271,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( case XFA_ItemLayoutProcessorStages::None: break; case XFA_ItemLayoutProcessorStages::BreakBefore: { - for (auto item : m_arrayKeepItems) { + for (auto* item : m_arrayKeepItems) { m_pLayoutItem->RemoveChild(item); fContentCalculatedHeight -= item->m_sSize.height; } diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 6f54c0e5fe..216c5a56c4 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -328,10 +328,10 @@ const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, if (!pProperties || iCount < 1) return nullptr; - auto it = std::find_if(pProperties, pProperties + iCount, - [eProperty](const XFA_PROPERTY& prop) { - return prop.eName == eProperty; - }); + auto* it = std::find_if(pProperties, pProperties + iCount, + [eProperty](const XFA_PROPERTY& prop) { + return prop.eName == eProperty; + }); if (it == pProperties + iCount) return nullptr; @@ -375,10 +375,11 @@ XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName) { uint32_t uHash = FX_HashCode_GetW(wsName, false); const XFA_ELEMENTINFO* pEnd = g_XFAElementData + g_iXFAElementCount; - auto pInfo = std::lower_bound(g_XFAElementData, pEnd, uHash, - [](const XFA_ELEMENTINFO& info, uint32_t hash) { - return info.uHash < hash; - }); + auto* pInfo = + std::lower_bound(g_XFAElementData, pEnd, uHash, + [](const XFA_ELEMENTINFO& info, uint32_t hash) { + return info.uHash < hash; + }); if (pInfo < pEnd && pInfo->uHash == uHash) return pInfo->eName; return XFA_Element::Unknown; -- cgit v1.2.3