From 9f7f7f8773410020fbea2be87917591cddd86aab Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 26 Oct 2016 18:58:39 -0700 Subject: Fix some FX_BOOL / int noise in xfa Review-Url: https://codereview.chromium.org/2453983002 --- xfa/fgas/localization/fgas_locale.cpp | 6 ++++-- xfa/fwl/core/cfwl_widgetmgr.cpp | 2 +- xfa/fwl/core/fwl_noteimp.cpp | 3 ++- xfa/fwl/core/ifwl_checkbox.cpp | 2 +- xfa/fwl/core/ifwl_edit.cpp | 18 +++++++++--------- xfa/fwl/core/ifwl_listbox.cpp | 20 +++++++++----------- xfa/fwl/core/ifwl_picturebox.cpp | 25 +++++++++++-------------- xfa/fwl/core/ifwl_picturebox.h | 2 +- xfa/fwl/core/ifwl_scrollbar.cpp | 2 +- xfa/fwl/theme/cfwl_scrollbartp.cpp | 2 +- 10 files changed, 40 insertions(+), 42 deletions(-) diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index 7393d58096..f8715fdf1c 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -2232,8 +2232,9 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, CFX_Unitime ut; ut.Set(year, month, day); datetime = datetime + ut; - return cc; + return !!cc; } + static void FX_ResolveZone(uint8_t& wHour, uint8_t& wMinute, FX_TIMEZONE tzDiff, @@ -2448,8 +2449,9 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, CFX_Unitime ut; ut.Set(0, 0, 0, hour, minute, second, millisecond); datetime = datetime + ut; - return cc; + return !!cc; } + FX_BOOL CFX_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, const CFX_WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp index e7f8b3819c..79d03b701b 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.cpp +++ b/xfa/fwl/core/cfwl_widgetmgr.cpp @@ -30,7 +30,7 @@ FX_BOOL FWL_UseOffscreen(IFWL_Widget* pWidget) { #if (_FX_OS_ == _FX_MACOSX_) return FALSE; #else - return pWidget->GetStyles() & FWL_WGTSTYLE_Offscreen; + return !!(pWidget->GetStyles() & FWL_WGTSTYLE_Offscreen); #endif } diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index f0474bda04..b6e02843e2 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -377,8 +377,9 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, IFWL_Widget* pMessageForm) { pMsg->m_pDstTarget = pMessageForm; - return (pMsg->m_pDstTarget)->GetStates() & FWL_WGTSTATE_Deactivated; + return !!(pMsg->m_pDstTarget->GetStates() & FWL_WGTSTATE_Deactivated); } + FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, IFWL_Widget* pMessageForm) { int32_t iTrackLoop = m_noteLoopQueue.GetSize(); diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp index cc06f9cea8..2dd8c2d5db 100644 --- a/xfa/fwl/core/ifwl_checkbox.cpp +++ b/xfa/fwl/core/ifwl_checkbox.cpp @@ -68,7 +68,7 @@ FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (wsCaption.GetLength() > 0) { CFX_SizeF sz = CalcTextSize( wsCaption, m_pProperties->m_pThemeProvider, - m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_MultiLine); + !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_MultiLine)); rect.Set(0, 0, sz.x, sz.y); } rect.Inflate(kCaptionMargin, kCaptionMargin); diff --git a/xfa/fwl/core/ifwl_edit.cpp b/xfa/fwl/core/ifwl_edit.cpp index 1d769af6cb..e911aa0c8b 100644 --- a/xfa/fwl/core/ifwl_edit.cpp +++ b/xfa/fwl/core/ifwl_edit.cpp @@ -119,7 +119,7 @@ FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { m_pEdtEngine->GetText(wsText, 0); CFX_SizeF sz = CalcTextSize( wsText, m_pProperties->m_pThemeProvider, - m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine); + !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine)); rect.Set(0, 0, sz.x, sz.y); } } @@ -690,11 +690,11 @@ void IFWL_Edit::On_TextChanged(CFDE_TxtEdtEngine* pEdit, FX_FLOAT fContentHeight = page->GetContentsBox().height; CFX_RectF rtTemp; GetClientRect(rtTemp); - FX_BOOL bHSelfAdaption = - m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_HSelfAdaption; - FX_BOOL bVSelfAdaption = - m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VSelfAdaption; - FX_BOOL bNeedUpdate = FALSE; + bool bHSelfAdaption = + !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_HSelfAdaption); + bool bVSelfAdaption = + !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VSelfAdaption); + bool bNeedUpdate = false; if (bHSelfAdaption || bVSelfAdaption) { CFWL_EvtEdtPreSelfAdaption evt; evt.m_pSrcTarget = this; @@ -1761,7 +1761,7 @@ void CFWL_EditImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->m_pEdtEngine->ClearSelection(); bRepaint = TRUE; } - FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift; + bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift); if (bShift && m_pOwner->m_nSelStart != nIndex) { int32_t iStart = std::min(m_pOwner->m_nSelStart, nIndex); int32_t iEnd = std::max(m_pOwner->m_nSelStart, nIndex); @@ -1828,8 +1828,8 @@ void CFWL_EditImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { if (!m_pOwner->m_pEdtEngine) return; FDE_TXTEDTMOVECARET MoveCaret = MC_MoveNone; - FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift; - FX_BOOL bCtrl = pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl; + bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift); + bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl); uint32_t dwKeyCode = pMsg->m_dwKeyCode; switch (dwKeyCode) { case FWL_VKEY_Left: { diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp index 4e94d955d1..bb6d86d384 100644 --- a/xfa/fwl/core/ifwl_listbox.cpp +++ b/xfa/fwl/core/ifwl_listbox.cpp @@ -456,7 +456,7 @@ FX_BOOL IFWL_ListBox::GetItemChecked(IFWL_ListItem* pItem) { } IFWL_ListBoxDP* pData = static_cast(m_pProperties->m_pDataProvider); - return (pData->GetItemCheckState(this, pItem) & FWL_ITEMSTATE_LTB_Checked); + return !!(pData->GetItemCheckState(this, pItem) & FWL_ITEMSTATE_LTB_Checked); } FX_BOOL IFWL_ListBox::SetItemChecked(IFWL_ListItem* pItem, FX_BOOL bChecked) { @@ -539,8 +539,8 @@ void IFWL_ListBox::DrawItems(CFX_Graphics* pGraphics, if (m_pVertScrollBar) { rtView.width -= m_fScorllBarWidth; } - FX_BOOL bMultiCol = - m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn; + bool bMultiCol = + !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn); IFWL_ListBoxDP* pData = static_cast(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); @@ -614,7 +614,7 @@ void IFWL_ListBox::DrawItem(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); } { - FX_BOOL bHasIcon = GetStylesEx() & FWL_STYLEEXT_LTB_Icon; + bool bHasIcon = !!(GetStylesEx() & FWL_STYLEEXT_LTB_Icon); if (bHasIcon) { CFX_RectF rtDIB; CFX_DIBitmap* pDib = pData->GetItemIcon(this, pItem); @@ -631,7 +631,7 @@ void IFWL_ListBox::DrawItem(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); } } - FX_BOOL bHasCheck = GetStylesEx() & FWL_STYLEEXT_LTB_Check; + bool bHasCheck = !!(GetStylesEx() & FWL_STYLEEXT_LTB_Check); if (bHasCheck) { CFX_RectF rtCheck; rtCheck.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height); @@ -725,11 +725,9 @@ CFX_SizeF IFWL_ListBox::CalcSize(FX_BOOL bAutoSize) { IFWL_ListBoxDP* pData = static_cast(m_pProperties->m_pDataProvider); m_fItemHeight = GetItemHeigt(); - FX_BOOL bHasIcon; - bHasIcon = GetStylesEx() & FWL_STYLEEXT_LTB_Icon; - if (bHasIcon) { + if ((GetStylesEx() & FWL_STYLEEXT_LTB_Icon)) fWidth += m_fItemHeight; - } + int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { IFWL_ListItem* htem = pData->GetItem(this, i); @@ -1097,8 +1095,8 @@ void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { case FWL_VKEY_End: { IFWL_ListItem* pItem = m_pOwner->GetFocusedItem(); pItem = m_pOwner->GetItem(pItem, dwKeyCode); - FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift; - FX_BOOL bCtrl = pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl; + bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift); + bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl); OnVK(pItem, bShift, bCtrl); DispatchSelChangedEv(); m_pOwner->ProcessSelChanged(); diff --git a/xfa/fwl/core/ifwl_picturebox.cpp b/xfa/fwl/core/ifwl_picturebox.cpp index 3539e08b0b..9e0e0b8623 100644 --- a/xfa/fwl/core/ifwl_picturebox.cpp +++ b/xfa/fwl/core/ifwl_picturebox.cpp @@ -114,22 +114,19 @@ void IFWL_PictureBox::DrawBkground(CFX_Graphics* pGraphics, &matrix); } -FX_BOOL IFWL_PictureBox::VStyle(FX_BOOL dwStyle) { +bool IFWL_PictureBox::VStyle(uint32_t dwStyle) { switch (dwStyle & FWL_STYLEEXT_PTB_VAlignMask) { - case FWL_STYLEEXT_PTB_Top: { - return m_bTop = TRUE; - break; - } - case FWL_STYLEEXT_PTB_Vcenter: { - return m_bVCenter = TRUE; - break; - } - case FWL_STYLEEXT_PTB_Bottom: { - return m_bButton = TRUE; - break; - } + case FWL_STYLEEXT_PTB_Top: + m_bTop = TRUE; + return true; + case FWL_STYLEEXT_PTB_Vcenter: + m_bVCenter = TRUE; + return true; + case FWL_STYLEEXT_PTB_Bottom: + m_bButton = TRUE; + return true; } - return FALSE; + return false; } CFWL_PictureBoxImpDelegate::CFWL_PictureBoxImpDelegate(IFWL_PictureBox* pOwner) diff --git a/xfa/fwl/core/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h index cfc32c0ba5..434b3cff29 100644 --- a/xfa/fwl/core/ifwl_picturebox.h +++ b/xfa/fwl/core/ifwl_picturebox.h @@ -62,8 +62,8 @@ class IFWL_PictureBox : public IFWL_Widget { void DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix = nullptr); + bool VStyle(uint32_t dwStyle); - FX_BOOL VStyle(FX_BOOL dwStyle); CFX_RectF m_rtClient; CFX_RectF m_rtImage; CFX_Matrix m_matrix; diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index e3b9ca64d9..a8e277324f 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -513,7 +513,7 @@ FX_FLOAT IFWL_ScrollBar::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) { } void IFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, FX_BOOL bLower) { - FX_BOOL bDisabled = m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled; + bool bDisabled = !!(m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled); if (bDisabled || m_bCustomLayout) { rect = bLower ? m_rtMinTrack : m_rtMaxTrack; } else { diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 4d23d3e193..faad11f2c3 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -60,7 +60,7 @@ void CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { CFX_Graphics* pGraphics = pParams->m_pGraphics; CFX_RectF* pRect = &pParams->m_rtPart; - FX_BOOL bVert = pWidget->GetStylesEx(); + bool bVert = !!pWidget->GetStylesEx(); switch (pParams->m_iPart) { case CFWL_Part::ForeArrow: { DrawMaxMinBtn(pGraphics, pRect, -- cgit v1.2.3