From 9263e71cb259ab372d32722ee64e1a183b4b6088 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 2 Dec 2015 12:51:14 -0800 Subject: Remove _FWL_RETURN_IF_ macros These hide early returns from the casual reader, hide the inversion of the condition under test from the reader, prevent the folding of conditions into a single statement, and take up more characters than the if() itself. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1494683002 . --- xfa/src/fxfa/src/app/xfa_fwladapter.cpp | 6 ++++-- xfa/src/fxfa/src/app/xfa_fwltheme.cpp | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'xfa/src/fxfa') diff --git a/xfa/src/fxfa/src/app/xfa_fwladapter.cpp b/xfa/src/fxfa/src/app/xfa_fwladapter.cpp index 94e10ab01d..3c9f1a1556 100644 --- a/xfa/src/fxfa/src/app/xfa_fwladapter.cpp +++ b/xfa/src/fxfa/src/app/xfa_fwladapter.cpp @@ -42,9 +42,11 @@ FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, } FWL_ERR CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect) { - _FWL_RETURN_VALUE_IF_FAIL(pWidget, FWL_ERR_Indefinite); + if (!pWidget) + return FWL_ERR_Indefinite; CXFA_FFField* pField = (CXFA_FFField*)pWidget->GetPrivateData(pWidget); - _FWL_RETURN_VALUE_IF_FAIL(pField, FWL_ERR_Indefinite); + if (!pField) + return FWL_ERR_Indefinite; #ifdef _XFA_EMB CFX_RectF rtInvalidate; pWidget->GetWidgetRect(rtInvalidate); diff --git a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp index 3b12058f88..0d2412858f 100644 --- a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp +++ b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp @@ -131,7 +131,8 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { } CFX_Graphics* pGraphics = pParams->m_pGraphics; CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); - _FWL_RETURN_VALUE_IF_FAIL(pRenderDevice, FALSE); + if (!pRenderDevice) + return FALSE; m_pTextOut->SetRenderDevice(pRenderDevice); CFX_Matrix mtPart = pParams->m_matrix; CFX_Matrix* pMatrix = pGraphics->GetMatrix(); @@ -150,7 +151,8 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); CFX_Graphics* pGraphics = pParams->m_pGraphics; CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); - _FWL_RETURN_VALUE_IF_FAIL(pRenderDevice, FALSE); + if (!pRenderDevice) + return FALSE; m_pTextOut->SetRenderDevice(pRenderDevice); m_pTextOut->SetStyles(pParams->m_dwTTOStyles); m_pTextOut->SetAlignment(pParams->m_iTTOAlign); @@ -274,8 +276,10 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { if (!pWidget) { return FWL_ERR_Indefinite; } - _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE); - _FWL_RETURN_VALUE_IF_FAIL(m_pTextOut, FALSE); + if (!pParams) + return FALSE; + if (!m_pTextOut) + return FALSE; m_pTextOut->SetFont(m_pCalendarFont); m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); @@ -293,8 +297,10 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { m_pTextOut->SetFont(pAcc->GetFDEFont()); m_pTextOut->SetFontSize(pAcc->GetFontSize()); m_pTextOut->SetTextColor(pAcc->GetTextColor()); - _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE); - _FWL_RETURN_VALUE_IF_FAIL(m_pTextOut, FALSE); + if (!pParams) + return FALSE; + if (!m_pTextOut) + return FALSE; m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetStyles(pParams->m_dwTTOStyles); m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), -- cgit v1.2.3