From 7d89e728a450c681c53d40d7f67ee2eef0400705 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 4 May 2016 13:38:11 -0700 Subject: Return bool rather than bitwise-and for FX_BOOL Investigate results of: git grep -ni 'return [(]*[a-z0-9_]* &[^&]' git grep -ni 'BOOL.*= [(]*[a-z0-9_]* &[^&]' Review-Url: https://codereview.chromium.org/1951653002 --- xfa/fwl/basewidget/fwl_comboboximp.cpp | 8 ++++---- xfa/fwl/basewidget/fwl_editimp.cpp | 2 +- xfa/fwl/basewidget/fwl_listboximp.cpp | 7 ++----- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'xfa/fwl/basewidget') diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index fd7c6d6266..35ac5fa240 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -557,8 +557,8 @@ FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } - FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; - FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; + bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown); + bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); if (bAddDropDown && !m_pEdit) { CFWL_WidgetImpProperties prop; m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); @@ -1232,8 +1232,8 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, if (!m_pEdit) { DisForm_InitComboEdit(); } - FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; - FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; + bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown); + bool bDelDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; if (bAddDropDown) { diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 8b4dd39321..a80b89f9a7 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -1831,7 +1831,7 @@ void CFWL_EditImpDelegate::DoButtonDown(CFWL_MsgMouse* pMsg) { } void CFWL_EditImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { uint32_t dwStyleEx = m_pOwner->GetStylesEx(); - FX_BOOL bRepaint = dwStyleEx & FWL_STYLEEXT_EDT_InnerCaret; + bool bRepaint = !!(dwStyleEx & FWL_STYLEEXT_EDT_InnerCaret); if (bSet) { m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; if (!m_pOwner->m_pEdtEngine) { diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index dd017e215f..d514f7e1e3 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -399,14 +399,11 @@ void CFWL_ListBoxImp::ClearSelection() { for (int32_t i = 0; i < iCount; i++) { FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); uint32_t dwState = pData->GetItemStyles(m_pInterface, hItem); - FX_BOOL bFindSel = dwState & FWL_ITEMSTATE_LTB_Selected; - if (!bFindSel) { + if (!(dwState & FWL_ITEMSTATE_LTB_Selected)) continue; - } SetSelectionDirect(hItem, FALSE); - if (!bMulti) { + if (!bMulti) return; - } } } void CFWL_ListBoxImp::SelectAll() { -- cgit v1.2.3