diff options
29 files changed, 162 insertions, 217 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_checksum.cpp b/xfa/src/fxfa/src/app/xfa_checksum.cpp index 48ab1ca21c..9c1597811f 100644 --- a/xfa/src/fxfa/src/app/xfa_checksum.cpp +++ b/xfa/src/fxfa/src/app/xfa_checksum.cpp @@ -162,7 +162,7 @@ FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_FileRead* pSrcFile, return m_pSAXReader->ContinueParse(NULL) > 99; } void CXFA_ChecksumContext::FinishChecksum() { - if (m_pSAXReader != NULL) { + if (m_pSAXReader) { m_pSAXReader->Release(); m_pSAXReader = NULL; } @@ -182,7 +182,7 @@ void CXFA_ChecksumContext::GetChecksum(CFX_ByteString& bsChecksum) { bsChecksum = m_bsChecksum; } void CXFA_ChecksumContext::Update(const CFX_ByteStringC& bsText) { - if (m_pByteContext != NULL) { + if (m_pByteContext) { CRYPT_SHA1Update(m_pByteContext, bsText.GetPtr(), bsText.GetLength()); } } diff --git a/xfa/src/fxfa/src/app/xfa_ffapp.cpp b/xfa/src/fxfa/src/app/xfa_ffapp.cpp index cb8c0b9f1c..2e0ed7085b 100644 --- a/xfa/src/fxfa/src/app/xfa_ffapp.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffapp.cpp @@ -85,41 +85,25 @@ CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) IXFA_TimeZoneProvider::Create(); } CXFA_FFApp::~CXFA_FFApp() { - if (m_pDocHandler) { - delete m_pDocHandler; - } + delete m_pDocHandler; if (m_pFWLApp) { m_pFWLApp->Finalize(); m_pFWLApp->Release(); delete m_pFWLApp; } - if (m_pFWLTheme) { + if (m_pFWLTheme) m_pFWLTheme->Release(); - } - if (m_pAdapterWidgetMgr) { - delete m_pAdapterWidgetMgr; - } - if (m_pAdapterThreadMgr) { - delete m_pAdapterThreadMgr; - m_pAdapterThreadMgr = NULL; - } - if (m_pMenuHandler) { - delete m_pMenuHandler; - m_pMenuHandler = NULL; - } + delete m_pAdapterWidgetMgr; + delete m_pAdapterThreadMgr; + delete m_pMenuHandler; IXFA_TimeZoneProvider::Destroy(); - if (m_pFontMgr != NULL) { - delete m_pFontMgr; - m_pFontMgr = NULL; - } + delete m_pFontMgr; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - if (m_pFontSource != NULL) { + if (m_pFontSource) m_pFontSource->Release(); - } #endif - if (m_pFDEFontMgr) { + if (m_pFDEFontMgr) m_pFDEFontMgr->Release(); - } } IXFA_MenuHandler* CXFA_FFApp::GetMenuHandler() { if (!m_pMenuHandler) { diff --git a/xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp b/xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp index 79d30198bf..46907f4cdd 100644 --- a/xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp @@ -66,8 +66,7 @@ FX_BOOL CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) { return TRUE; } FX_BOOL CXFA_FFListBox::CommitData() { - FXSYS_assert(m_pNormalWidget != NULL); - CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; + CFWL_ListBox* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget); int32_t iSels = pListBox->CountSelItems(); CFX_Int32Array iSelArray; for (int32_t i = 0; i < iSels; i++) { diff --git a/xfa/src/fxfa/src/app/xfa_ffdoc.cpp b/xfa/src/fxfa/src/app/xfa_ffdoc.cpp index e8eb1482e1..5cbd3c1ec1 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdoc.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdoc.cpp @@ -233,10 +233,8 @@ FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA; FX_DWORD count = pXFAArray->GetCount() / 2; for (FX_DWORD i = 0; i < count; i++) { - CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1); - if (pStream != NULL) { + if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) xfaStreams.Add(pStream); - } } } else if (pElementXFA->IsStream()) { xfaStreams.Add((CPDF_Stream*)pElementXFA); diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp index 59d38007a9..218e9e3548 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp @@ -512,7 +512,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( return NULL; } CXFA_Node* refNode = NULL; - if (pRefWidgetAcc != NULL) { + if (pRefWidgetAcc) { refNode = pRefWidgetAcc->GetNode(); wsExpression = wsName; } else { @@ -812,9 +812,8 @@ void CXFA_FFDocView::RunBindItems() { wsLabel = refNode->GetContent(); } else { CXFA_Node* nodeLabel = refNode->GetFirstChildByName(wsLabelRef); - if (nodeLabel != NULL) { + if (nodeLabel) wsLabel = nodeLabel->GetContent(); - } } } else { wsLabel = wsValue; @@ -860,7 +859,7 @@ IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToNext() { : m_ContentIterator.GetCurrent(); while (pItem) { if (CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pItem->GetWidgetData()) { - while ((m_pCurWidget = pAcc->GetNextWidget(NULL)) != NULL) { + while ((m_pCurWidget = pAcc->GetNextWidget(NULL))) { if (!m_pCurWidget->IsLoaded() && (m_pCurWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { m_pCurWidget->LoadWidget(); @@ -911,7 +910,7 @@ CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() { CXFA_Node* pItem = m_pCurWidgetAcc ? m_ContentIterator.MoveToNext() : m_ContentIterator.GetCurrent(); while (pItem) { - if ((m_pCurWidgetAcc = (CXFA_WidgetAcc*)pItem->GetWidgetData()) != NULL) { + if ((m_pCurWidgetAcc = (CXFA_WidgetAcc*)pItem->GetWidgetData())) { return m_pCurWidgetAcc; } pItem = m_ContentIterator.MoveToNext(); diff --git a/xfa/src/fxfa/src/app/xfa_fffield.cpp b/xfa/src/fxfa/src/app/xfa_fffield.cpp index 83e99a08e3..25ad6599f2 100644 --- a/xfa/src/fxfa/src/app/xfa_fffield.cpp +++ b/xfa/src/fxfa/src/app/xfa_fffield.cpp @@ -118,7 +118,7 @@ void CXFA_FFField::SetFWLThemeProvider() { } } FX_BOOL CXFA_FFField::IsLoaded() { - return m_pNormalWidget != NULL && CXFA_FFWidget::IsLoaded(); + return m_pNormalWidget && CXFA_FFWidget::IsLoaded(); } FX_BOOL CXFA_FFField::LoadWidget() { SetFWLThemeProvider(); diff --git a/xfa/src/fxfa/src/app/xfa_ffimageedit.cpp b/xfa/src/fxfa/src/app/xfa_ffimageedit.cpp index 1b3967ace0..634175acd9 100644 --- a/xfa/src/fxfa/src/app/xfa_ffimageedit.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffimageedit.cpp @@ -30,7 +30,7 @@ FX_BOOL CXFA_FFImageEdit::LoadWidget() { pNoteDriver->RegisterEventTarget(pWidget, pWidget); m_pOldDelegate = pPictureBox->SetDelegate(this); CXFA_FFField::LoadWidget(); - if (m_pDataAcc->GetImageEditImage() != NULL) { + if (m_pDataAcc->GetImageEditImage()) { return TRUE; } UpdateFWLData(); @@ -127,7 +127,7 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(FX_DWORD dwFlags, } CFX_WideString wsImage; IFX_FileRead* pFileRead = FX_CreateFileRead(wsFilePath); - if (pFileRead != NULL) { + if (pFileRead) { int32_t nDataSize = pFileRead->GetSize(); if (nDataSize > 0) { CFX_ByteString bsBuf; @@ -137,9 +137,7 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(FX_DWORD dwFlags, if (!bsBuf.IsEmpty()) { FX_CHAR* pData = XFA_Base64Encode(bsBuf, nDataSize); wsImage = CFX_WideString::FromLocal(pData); - if (pData != NULL) { - FX_Free(pData); - } + FX_Free(pData); } } m_pDataAcc->SetImageEditImage(NULL); diff --git a/xfa/src/fxfa/src/app/xfa_ffnotify.cpp b/xfa/src/fxfa/src/app/xfa_ffnotify.cpp index 5a887095cb..b9078b309e 100644 --- a/xfa/src/fxfa/src/app/xfa_ffnotify.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffnotify.cpp @@ -443,7 +443,7 @@ void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender, return; } CXFA_FFWidget* pWidget = NULL; - while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != NULL) { + while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { if (pWidget->IsLoaded()) { pWidget->AddInvalidateRect(); } @@ -522,7 +522,7 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, } } CXFA_FFWidget* pWidget = NULL; - while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != NULL) { + while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { if (!pWidget->IsLoaded()) { continue; } diff --git a/xfa/src/fxfa/src/app/xfa_ffpageview.cpp b/xfa/src/fxfa/src/app/xfa_ffpageview.cpp index ee25b180dd..014743e108 100644 --- a/xfa/src/fxfa/src/app/xfa_ffpageview.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffpageview.cpp @@ -266,9 +266,9 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( CXFA_FFWidget* pWidget) { CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); CXFA_Node* pTraversal = pAcc->GetNode()->GetChild(0, XFA_ELEMENT_Traversal); - if (pTraversal != NULL) { + if (pTraversal) { CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_ELEMENT_Traverse); - if (pTraverse != NULL) { + if (pTraverse) { CFX_WideString wsTraverseWidgetName; if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) { return FindWidgetByName(wsTraverseWidgetName, pWidget); diff --git a/xfa/src/fxfa/src/app/xfa_fftext.cpp b/xfa/src/fxfa/src/app/xfa_fftext.cpp index 4b78cf9d37..313022acd9 100644 --- a/xfa/src/fxfa/src/app/xfa_fftext.cpp +++ b/xfa/src/fxfa/src/app/xfa_fftext.cpp @@ -62,7 +62,7 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS, } FX_BOOL CXFA_FFText::IsLoaded() { CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); - return pTextLayout != NULL && !pTextLayout->m_bHasBlock; + return pTextLayout && !pTextLayout->m_bHasBlock; } FX_BOOL CXFA_FFText::PerformLayout() { CXFA_FFDraw::PerformLayout(); diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp index f402c715ce..0f48d5d4a5 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp @@ -213,7 +213,7 @@ FX_BOOL CXFA_FFWidget::OnRButtonDblClk(FX_DWORD dwFlags, FX_BOOL CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { CXFA_FFWidget* pParent = GetParent(); - if (pParent != NULL && !pParent->IsAncestorOf(pOldWidget)) { + if (pParent && !pParent->IsAncestorOf(pOldWidget)) { pParent->OnSetFocus(pOldWidget); } m_dwStatus |= XFA_WIDGETSTATUS_Focused; @@ -226,9 +226,9 @@ FX_BOOL CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { FX_BOOL CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) { m_dwStatus &= ~XFA_WIDGETSTATUS_Focused; EventKillFocus(); - if (pNewWidget != NULL) { + if (pNewWidget) { CXFA_FFWidget* pParent = GetParent(); - if (pParent != NULL && !pParent->IsAncestorOf(pNewWidget)) { + if (pParent && !pParent->IsAncestorOf(pNewWidget)) { pParent->OnKillFocus(pNewWidget); } } @@ -331,10 +331,10 @@ FX_BOOL CXFA_FFWidget::IsLayoutRectEmpty() { CXFA_FFWidget* CXFA_FFWidget::GetParent() { CXFA_Node* pParentNode = m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent); - if (pParentNode != NULL) { + if (pParentNode) { CXFA_WidgetAcc* pParentWidgetAcc = (CXFA_WidgetAcc*)pParentNode->GetWidgetData(); - if (pParentWidgetAcc != NULL) { + if (pParentWidgetAcc) { return pParentWidgetAcc->GetNextWidget(NULL); } } @@ -551,7 +551,7 @@ FX_BOOL CXFA_ImageRenderer::StartDIBSource() { if (m_pDevice->StartDIBits(m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags, m_DeviceHandle, 0, NULL, m_BlendType)) { - if (m_DeviceHandle != NULL) { + if (m_DeviceHandle) { m_Status = 3; return TRUE; } @@ -996,7 +996,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, wsURL.Left(6) != FX_WSTRC(L"ftp://")) { CFX_DIBitmap* pBitmap = pDoc->GetPDFNamedImage(wsURL, iImageXDpi, iImageYDpi); - if (pBitmap != NULL) { + if (pBitmap) { bNameImage = TRUE; return pBitmap; } diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.h b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.h index 6768502a9e..4e6eb9009d 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.h +++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.h @@ -22,7 +22,7 @@ class CXFA_TextProvider : public IXFA_TextProvider { XFA_TEXTPROVIDERTYPE eType, CXFA_Node* pTextNode = NULL) : m_pWidgetAcc(pWidgetAcc), m_eType(eType), m_pTextNode(pTextNode) { - FXSYS_assert(m_pWidgetAcc != NULL); + FXSYS_assert(m_pWidgetAcc); } virtual ~CXFA_TextProvider() {} virtual CXFA_Node* GetTextNode(FX_BOOL& bRichText); diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp index 5593541bd0..bb8db6a9f4 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp @@ -498,26 +498,22 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateSubform(CXFA_Node* pParent, CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_ELEMENT eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pTemplateParent = - pParent != NULL ? pParent->GetTemplateNode() : NULL; + CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : NULL; CXFA_Node* pNewFormItem = pTemplateParent->CloneTemplateToForm(FALSE); - if (pParent != NULL) { + if (pParent) pParent->InsertChild(pNewFormItem, pBefore); - } return pNewFormItem; } CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_ELEMENT eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pTemplateParent = - pParent != NULL ? pParent->GetTemplateNode() : NULL; + CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : NULL; CXFA_Node* pNewNode = CreateTemplateNode(eElement, pTemplateParent, pBefore ? pBefore->GetTemplateNode() : NULL) ->Clone(FALSE); - if (pParent != NULL) { + if (pParent) pParent->InsertChild(pNewNode, pBefore); - } return pNewNode; } CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_ELEMENT eElement, @@ -526,9 +522,8 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_ELEMENT eElement, CXFA_Document* pXFADoc = GetXFADoc(); CXFA_Node* pNewTemplateNode = pXFADoc->GetParser()->GetFactory()->CreateNode( XFA_XDPPACKET_Template, eElement); - if (pParent != NULL) { + if (pParent) pParent->InsertChild(pNewTemplateNode, pBefore); - } return pNewTemplateNode; } CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const { diff --git a/xfa/src/fxfa/src/app/xfa_fontmgr.cpp b/xfa/src/fxfa/src/app/xfa_fontmgr.cpp index e4585ce67c..3474e0aa90 100644 --- a/xfa/src/fxfa/src/app/xfa_fontmgr.cpp +++ b/xfa/src/fxfa/src/app/xfa_fontmgr.cpp @@ -1773,7 +1773,7 @@ IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, if (bGetFontInfo) { pCurFont = XFA_GetFontINFOByFontName(wsFontName); } - if (pCurFont != NULL && pCurFont->pReplaceFont != NULL) { + if (pCurFont && pCurFont->pReplaceFont) { FX_DWORD dwStyle = 0; if (dwFontStyles & FX_FONTSTYLE_Bold) { dwStyle |= FX_FONTSTYLE_Bold; @@ -1792,7 +1792,7 @@ IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, CFX_WideString wsReplace = CFX_WideString(pReplace, pNameText - pReplace); pFont = pFDEFontMgr->LoadFont(wsReplace, dwStyle, wCodePage); - if (pFont != NULL) { + if (pFont) { break; } iLength--; @@ -1816,7 +1816,7 @@ IFX_Font* CXFA_DefFontMgr::GetDefaultFont(IXFA_Doc* hDoc, if (!pFont) pFont = pFDEFontMgr->LoadFont((const FX_WCHAR*)NULL, dwFontStyles, wCodePage); - FXSYS_assert(pFont != NULL); + FXSYS_assert(pFont); if (pFont) { m_CacheFonts.Add(pFont); } @@ -2069,9 +2069,7 @@ void CXFA_FontMgr::LoadDocFonts(IXFA_Doc* hDoc) { void CXFA_FontMgr::ReleaseDocFonts(IXFA_Doc* hDoc) { CXFA_PDFFontMgr* pMgr = NULL; if (m_PDFFontMgrArray.Lookup(hDoc, (void*&)pMgr)) { - if (pMgr != NULL) { - delete pMgr; - } + delete pMgr; m_PDFFontMgrArray.RemoveKey(hDoc); } } @@ -2081,9 +2079,7 @@ void CXFA_FontMgr::DelAllMgrMap() { IXFA_Doc* hDoc = NULL; CXFA_PDFFontMgr* pMgr = NULL; m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr); - if (pMgr != NULL) { - delete pMgr; - } + delete pMgr; } m_PDFFontMgrArray.RemoveAll(); m_FontMap.clear(); diff --git a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp index 29225c7800..b683d64a7e 100644 --- a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp +++ b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp @@ -216,7 +216,7 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, } } if (pItem->GetPrev() == NULL) { - if (pItem->GetNext() != NULL) { + if (pItem->GetNext()) { m_Rect.height = 0; } } else if (pItem->GetNext() == NULL) { diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.cpp b/xfa/src/fxfa/src/app/xfa_textlayout.cpp index 3c2e3ca492..d1495c4add 100644 --- a/xfa/src/fxfa/src/app/xfa_textlayout.cpp +++ b/xfa/src/fxfa/src/app/xfa_textlayout.cpp @@ -17,12 +17,8 @@ CXFA_CSSTagProvider::~CXFA_CSSTagProvider() { while (pos) { CFX_WideString *pName = NULL, *pValue = NULL; m_Attributes.GetNextAssoc(pos, (void*&)pName, (void*&)pValue); - if (pName != NULL) { - delete pName; - } - if (pValue != NULL) { - delete pValue; - } + delete pName; + delete pValue; } } void CXFA_CSSTagProvider::GetNextAttribute(FX_POSITION& pos, @@ -56,23 +52,19 @@ void CXFA_TextParseContext::SetDecls(const IFDE_CSSDeclaration** ppDeclArray, iDeclCount * sizeof(IFDE_CSSDeclaration*)); } CXFA_TextParser::~CXFA_TextParser() { - if (m_pUASheet != NULL) { + if (m_pUASheet) m_pUASheet->Release(); - } - if (m_pSelector != NULL) { + if (m_pSelector) m_pSelector->Release(); - } - if (m_pAllocator != NULL) { + if (m_pAllocator) m_pAllocator->Release(); - } FX_POSITION ps = m_mapXMLNodeToParseContext.GetStartPosition(); while (ps) { IFDE_XMLNode* pXMLNode; CXFA_TextParseContext* pParseContext; m_mapXMLNodeToParseContext.GetNextAssoc(ps, pXMLNode, pParseContext); - if (pParseContext != NULL) { + if (pParseContext) FDE_DeleteWith(CXFA_TextParseContext, m_pAllocator, pParseContext); - } } m_mapXMLNodeToParseContext.RemoveAll(); } @@ -82,12 +74,11 @@ void CXFA_TextParser::Reset() { IFDE_XMLNode* pXMLNode; CXFA_TextParseContext* pParseContext; m_mapXMLNodeToParseContext.GetNextAssoc(ps, pXMLNode, pParseContext); - if (pParseContext != NULL) { + if (pParseContext) FDE_DeleteWith(CXFA_TextParseContext, m_pAllocator, pParseContext); - } } m_mapXMLNodeToParseContext.RemoveAll(); - if (m_pAllocator != NULL) { + if (m_pAllocator) { m_pAllocator->Release(); m_pAllocator = NULL; } @@ -99,7 +90,7 @@ void CXFA_TextParser::InitCSSData(IXFA_TextProvider* pTextProvider) { if (m_pSelector == NULL) { CXFA_FFDoc* pDoc = pTextProvider->GetDocNode(); IFX_FontMgr* pFontMgr = pDoc->GetApp()->GetFDEFontMgr(); - FXSYS_assert(pFontMgr != NULL); + FXSYS_assert(pFontMgr); m_pSelector = IFDE_CSSStyleSelector::Create(); m_pSelector->SetFontMgr(pFontMgr); FX_FLOAT fFontSize = 10; @@ -194,7 +185,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateStyle( IFDE_CSSComputedStyle* pParentStyle) { IFDE_CSSComputedStyle* pNewStyle = m_pSelector->CreateComputedStyle(pParentStyle); - FXSYS_assert(pNewStyle != NULL); + FXSYS_assert(pNewStyle); if (pParentStyle) { IFDE_CSSParagraphStyle* pParaStyle = pParentStyle->GetParagraphStyles(); FX_DWORD dwDecoration = pParaStyle->GetTextDecoration(); @@ -207,7 +198,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateStyle( pParaStyle->SetNumberVerticalAlign(fBaseLine); IFDE_CSSBoundaryStyle* pBoundarytyle = pParentStyle->GetBoundaryStyles(); const FDE_CSSRECT* pRect = pBoundarytyle->GetMarginWidth(); - if (pRect != NULL) { + if (pRect) { pBoundarytyle = pNewStyle->GetBoundaryStyles(); pBoundarytyle->SetMarginWidth(*pRect); } @@ -237,7 +228,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle( } void CXFA_TextParser::DoParse(IFDE_XMLNode* pXMLContainer, IXFA_TextProvider* pTextProvider) { - if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator != NULL) { + if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator) { return; } m_pAllocator = @@ -289,9 +280,8 @@ void CXFA_TextParser::ParseRichText(IFDE_XMLNode* pXMLNode, pXMLChild = pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling)) { ParseRichText(pXMLChild, pNewStyle); } - if (pNewStyle != NULL) { + if (pNewStyle) pNewStyle->Release(); - } } void CXFA_TextParser::ParseTagInfo(IFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider) { @@ -381,15 +371,14 @@ IFX_Font* CXFA_TextParser::GetFont(IXFA_TextProvider* pTextProvider, } } CXFA_FFDoc* pDoc = pTextProvider->GetDocNode(); - FXSYS_assert(pDoc != NULL); CXFA_FontMgr* pFontMgr = pDoc->GetApp()->GetXFAFontMgr(); return pFontMgr->GetFont(pDoc, wsFamily, dwStyle); } FX_FLOAT CXFA_TextParser::GetFontSize(IXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { - if (pStyle != NULL) { + if (pStyle) return pStyle->GetFontStyles()->GetFontSize(); - } + CXFA_Font font = pTextProvider->GetFontNode(); if (font) { return font.GetFontSize(); @@ -423,7 +412,7 @@ int32_t CXFA_TextParser::GetHorScale(IXFA_TextProvider* pTextProvider, } int32_t CXFA_TextParser::GetVerScale(IXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { - if (pStyle != NULL) { + if (pStyle) { CFX_WideString wsValue; if (pStyle->GetCustomStyle(FX_WSTRC(L"xfa-font-vertical-scale"), wsValue)) { return wsValue.GetInteger(); @@ -478,17 +467,17 @@ void CXFA_TextParser::GetLinethrough(IXFA_TextProvider* pTextProvider, } FX_ARGB CXFA_TextParser::GetColor(IXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { - if (pStyle != NULL) { + if (pStyle) return pStyle->GetFontStyles()->GetColor(); - } - if (CXFA_Font font = pTextProvider->GetFontNode()) { + + if (CXFA_Font font = pTextProvider->GetFontNode()) return font.GetColor(); - } + return 0xFF000000; } FX_FLOAT CXFA_TextParser::GetBaseline(IXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { - if (pStyle != NULL) { + if (pStyle) { IFDE_CSSParagraphStyle* pParaStyle = pStyle->GetParagraphStyles(); if (pParaStyle->GetVerticalAlign() == FDE_CSSVERTICALALIGN_Number) { return pParaStyle->GetNumberVerticalAlign(); @@ -503,7 +492,7 @@ FX_FLOAT CXFA_TextParser::GetLineHeight(IXFA_TextProvider* pTextProvider, FX_BOOL bFirst, FX_FLOAT fVerScale) const { FX_FLOAT fLineHeight = 0; - if (pStyle != NULL) { + if (pStyle) { fLineHeight = pStyle->GetParagraphStyles()->GetLineHeight(); } else if (CXFA_Para para = pTextProvider->GetParaNode()) { fLineHeight = para.GetLineHeight(); @@ -697,11 +686,11 @@ void CXFA_TextLayout::Unload() { FDE_DeleteWith(CXFA_PieceLine, m_pAllocator, pLine); } m_pieceLines.RemoveAll(); - if (m_pBreak != NULL) { + if (m_pBreak) { m_pBreak->Release(); m_pBreak = NULL; } - if (m_pAllocator != NULL) { + if (m_pAllocator) { m_pAllocator->Release(); m_pAllocator = NULL; } @@ -840,10 +829,10 @@ void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle, const FDE_CSSRECT* pRect = pStyle->GetBoundaryStyles()->GetMarginWidth(); const FDE_CSSRECT* pPaddingRect = pStyle->GetBoundaryStyles()->GetPaddingWidth(); - if (pRect != NULL) { + if (pRect) { fStart = pRect->left.GetValue(); fLineWidth -= pRect->right.GetValue(); - if (pPaddingRect != NULL) { + if (pPaddingRect) { fStart += pPaddingRect->left.GetValue(); fLineWidth -= pPaddingRect->right.GetValue(); } @@ -852,10 +841,10 @@ void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle, pParentStyle->GetBoundaryStyles()->GetMarginWidth(); const FDE_CSSRECT* pParPaddingRect = pParentStyle->GetBoundaryStyles()->GetPaddingWidth(); - if (pParRect != NULL) { + if (pParRect) { fStart += pParRect->left.GetValue(); fLineWidth -= pParRect->right.GetValue(); - if (pParPaddingRect != NULL) { + if (pParPaddingRect) { fStart += pParPaddingRect->left.GetValue(); fLineWidth -= pParPaddingRect->right.GetValue(); } @@ -1041,9 +1030,9 @@ FX_BOOL CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, if (defaultSize.x < 1) { defaultSize.x = 0xFFFF; } - if (m_pBreak != NULL) { + if (m_pBreak) m_pBreak->Release(); - } + m_pBreak = CreateBreak(FALSE); FX_FLOAT fLinePos = 0; m_iLines = 0; @@ -1065,7 +1054,7 @@ FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { } Unload(); m_pBreak = CreateBreak(TRUE); - if (m_pLoader != NULL) { + if (m_pLoader) { m_pLoader->m_iTotalLines = -1; m_pLoader->m_iChar = 0; } @@ -1116,7 +1105,7 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f) { UpdateAlign(szText.y, fLinePos); } - } else if (m_pTextDataNode != NULL) { + } else if (m_pTextDataNode) { iBlock *= 2; if (iBlock < iCount - 2) { m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock + 1); @@ -1174,14 +1163,10 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { } } if (iBlock == iCount) { - if (m_pTabstopContext != NULL) { - delete m_pTabstopContext; - m_pTabstopContext = NULL; - } - if (m_pLoader != NULL) { - delete m_pLoader; - m_pLoader = NULL; - } + delete m_pTabstopContext; + m_pTabstopContext = nullptr; + delete m_pLoader; + m_pLoader = nullptr; } return TRUE; } @@ -1239,7 +1224,9 @@ FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, IFDE_SolidBrush* pSolidBrush = (IFDE_SolidBrush*)IFDE_Brush::Create(FDE_BRUSHTYPE_Solid); IFDE_Pen* pPen = IFDE_Pen::Create(); - FXSYS_assert(pDevice != NULL && pSolidBrush != NULL && pPen != NULL); + FXSYS_assert(pDevice); + FXSYS_assert(pSolidBrush); + FXSYS_assert(pPen); if (m_pieceLines.GetSize() == 0) { int32_t iBlockCount = CountBlocks(); for (int32_t i = 0; i < iBlockCount; i++) { @@ -1365,7 +1352,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, CFX_WideString wsText = pNode->GetContent(); wsText.TrimRight(L" "); FX_BOOL bRet = AppendChar(wsText, fLinePos, fSpaceAbove, bSavePieces); - if (bRet && m_pLoader != NULL) { + if (bRet && m_pLoader) { m_pLoader->m_pNode = pNode; } else { EndBreak(FX_RTFBREAK_ParagraphBreak, fLinePos, bSavePieces); @@ -1394,7 +1381,7 @@ FX_BOOL CXFA_TextLayout::LoadRichText(IFDE_XMLNode* pXMLNode, FX_BOOL bCurOl = FALSE; FX_BOOL bCurLi = FALSE; IFDE_XMLElement* pElement = NULL; - if (pContext != NULL) { + if (pContext) { if (m_bBlockContinue || (m_pLoader && pXMLNode == m_pLoader->m_pXMLNode)) { m_bBlockContinue = TRUE; @@ -1421,7 +1408,7 @@ FX_BOOL CXFA_TextLayout::LoadRichText(IFDE_XMLNode* pXMLNode, pXMLNode, pParentStyle); if ((eDisplay == FDE_CSSDISPLAY_Block || eDisplay == FDE_CSSDISPLAY_ListItem) && - (pStyle != NULL) && + pStyle && (wsName.IsEmpty() || (wsName != FX_WSTRC(L"body") && wsName != FX_WSTRC(L"html") && wsName != FX_WSTRC(L"ol") && wsName != FX_WSTRC(L"ul")))) { @@ -1508,9 +1495,8 @@ FX_BOOL CXFA_TextLayout::LoadRichText(IFDE_XMLNode* pXMLNode, m_pLoader->m_pXMLNode = pXMLNode; m_pLoader->m_pParentStyle = pParentStyle; } - if (pStyle != NULL) { + if (pStyle) pStyle->Release(); - } return FALSE; } return TRUE; @@ -1542,12 +1528,12 @@ FX_BOOL CXFA_TextLayout::LoadRichText(IFDE_XMLNode* pXMLNode, EndBreak(FX_RTFBREAK_LineBreak, fLinePos, bSavePieces); } } else { - if (pContext != NULL) { + if (pContext) { eDisplay = pContext->GetDisplay(); } } if (m_bBlockContinue) { - if (pContext != NULL && !bContentNode) { + if (pContext && !bContentNode) { FX_DWORD dwStatus = (eDisplay == FDE_CSSDISPLAY_Block) ? FX_RTFBREAK_ParagraphBreak : FX_RTFBREAK_PieceBreak; @@ -1577,9 +1563,8 @@ FX_BOOL CXFA_TextLayout::LoadRichText(IFDE_XMLNode* pXMLNode, } } } - if (pStyle != NULL) { + if (pStyle) pStyle->Release(); - } return TRUE; } FX_BOOL CXFA_TextLayout::AppendChar(const CFX_WideString& wsText, @@ -1600,9 +1585,8 @@ FX_BOOL CXFA_TextLayout::AppendChar(const CFX_WideString& wsText, if ((dwStatus = m_pBreak->AppendChar(wch)) > FX_RTFBREAK_PieceBreak) { AppendTextLine(dwStatus, fLinePos, bSavePieces); if (IsEnd(bSavePieces)) { - if (m_pLoader != NULL) { + if (m_pLoader) m_pLoader->m_iChar = i; - } return TRUE; } if (dwStatus == FX_RTFBREAK_ParagraphBreak && m_bRichText) { @@ -1730,9 +1714,8 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, for (i = 0; i < iPieces; i++) { const CFX_RTFPiece* pPiece = m_pBreak->GetBreakPiece(i); CXFA_TextUserData* pUserData = (CXFA_TextUserData*)pPiece->m_pUserData; - if (pUserData != NULL) { + if (pUserData) pStyle = pUserData->m_pStyle; - } FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f; XFA_TEXTPIECE* pTP = (XFA_TEXTPIECE*)m_pAllocator->Alloc(sizeof(XFA_TEXTPIECE)); @@ -1772,7 +1755,7 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, fBaseLine = -fBaseLineTemp; } fLineStep = std::max(fLineStep, fLineHeight); - if (pUserData != NULL && pUserData->m_pLinkData != NULL) { + if (pUserData && pUserData->m_pLinkData) { pUserData->m_pLinkData->AddRef(); pTP->pLinkData = pUserData->m_pLinkData; } else { @@ -1794,9 +1777,8 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, for (int32_t i = 0; i < iPieces; i++) { const CFX_RTFPiece* pPiece = m_pBreak->GetBreakPiece(i); CXFA_TextUserData* pUserData = (CXFA_TextUserData*)pPiece->m_pUserData; - if (pUserData != NULL) { + if (pUserData) pStyle = pUserData->m_pStyle; - } FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f; FX_FLOAT fBaseLine = m_textParser.GetBaseline(m_pTextProvider, pStyle); FX_FLOAT fLineHeight = m_textParser.GetLineHeight( diff --git a/xfa/src/fxfa/src/common/xfa_utils.h b/xfa/src/fxfa/src/common/xfa_utils.h index 14ea7e5e65..86d8ff652b 100644 --- a/xfa/src/fxfa/src/common/xfa_utils.h +++ b/xfa/src/fxfa/src/common/xfa_utils.h @@ -106,7 +106,7 @@ class CXFA_NodeIteratorTemplate { NodeType** ppNode = NULL; NodeType* pCurrent = GetCurrent(); while (m_NodeStack.GetSize() > 0) { - while ((ppNode = m_NodeStack.GetTopElement()) != NULL) { + while ((ppNode = m_NodeStack.GetTopElement())) { if (pCurrent != *ppNode) { return *ppNode; } @@ -116,7 +116,7 @@ class CXFA_NodeIteratorTemplate { } m_NodeStack.Push(pChild); } - while ((ppNode = m_NodeStack.GetTopElement()) != NULL) { + while ((ppNode = m_NodeStack.GetTopElement())) { NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode); m_NodeStack.Pop(); if (m_NodeStack.GetSize() == 0) { @@ -132,7 +132,7 @@ class CXFA_NodeIteratorTemplate { } NodeType* SkipChildrenAndMoveToNext() { NodeType** ppNode = NULL; - while ((ppNode = m_NodeStack.GetTopElement()) != NULL) { + while ((ppNode = m_NodeStack.GetTopElement())) { NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode); m_NodeStack.Pop(); if (m_NodeStack.GetSize() == 0) { diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp index 0ad73c1777..64ebfcae9a 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp @@ -1589,7 +1589,7 @@ void CXFA_FM2JSContext::Time2Num(FXJSE_HOBJECT hThis, int32_t milSecond = uniTime.GetMillisecond(); int32_t mins = hour * 60 + min; IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); - if (pProvider != NULL) { + if (pProvider) { FX_TIMEZONE tz; pProvider->GetTimeZone(tz); mins -= (tz.tzHour * 60); diff --git a/xfa/src/fxfa/src/parser/xfa_basic_imp.cpp b/xfa/src/fxfa/src/parser/xfa_basic_imp.cpp index 3349d78561..848ae44b8c 100644 --- a/xfa/src/fxfa/src/parser/xfa_basic_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_basic_imp.cpp @@ -239,10 +239,9 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeOfElement(XFA_ELEMENT eElement, return NULL; } const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); - ASSERT(pInfo != NULL); - if (dwPacket == XFA_XDPPACKET_UNKNOWN) { + ASSERT(pInfo); + if (dwPacket == XFA_XDPPACKET_UNKNOWN) return pInfo; - } return (dwPacket & pInfo->dwPackets) ? pInfo : NULL; } const XFA_ELEMENTINFO* XFA_GetChildOfElement(XFA_ELEMENT eElement, @@ -259,10 +258,9 @@ const XFA_ELEMENTINFO* XFA_GetChildOfElement(XFA_ELEMENT eElement, return NULL; } const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eChild); - ASSERT(pInfo != NULL); - if (dwPacket == XFA_XDPPACKET_UNKNOWN) { + ASSERT(pInfo); + if (dwPacket == XFA_XDPPACKET_UNKNOWN) return pInfo; - } return (dwPacket & pInfo->dwPackets) ? pInfo : NULL; } const XFA_PROPERTY* XFA_GetElementProperties(XFA_ELEMENT eElement, @@ -298,10 +296,9 @@ const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_ELEMENT eElement, return NULL; } const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eProperty); - ASSERT(pInfo != NULL); - if (dwPacket == XFA_XDPPACKET_UNKNOWN) { + ASSERT(pInfo); + if (dwPacket == XFA_XDPPACKET_UNKNOWN) return pProperty + iMid; - } return (dwPacket & pInfo->dwPackets) ? (pProperty + iMid) : NULL; } const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement, diff --git a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp index a9c12522a5..7e812860bf 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp @@ -704,7 +704,7 @@ static CXFA_Node* XFA_DataMerge_FindMatchingDataNode( default: break; } - if (pCurTemplateNode == pTemplateNode && pResult != NULL) { + if (pCurTemplateNode == pTemplateNode && pResult) { bSelfMatch = TRUE; } break; @@ -774,7 +774,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( : NULL; if (CXFA_Node* pOccurTemplateNode = pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Occur)) { - pOccurNode = pInstMgrNode != NULL + pOccurNode = pInstMgrNode ? XFA_NodeMerge_CloneOrMergeContainer( pDocument, pInstMgrNode, pOccurTemplateNode, FALSE) : pOccurTemplateNode; diff --git a/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp b/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp index bdfc90bd71..ab440c23ca 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp @@ -20,7 +20,7 @@ IXFA_PacketImport* IXFA_PacketImport::Create(CXFA_Document* pDocument) { } CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) : m_pDocument(pDocument) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); } FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument); @@ -431,7 +431,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, static const FX_WCHAR* s_pwsTagName = L"<form"; static const FX_WCHAR* s_pwsClose = L"</form\n>"; pStream->WriteString(s_pwsTagName, FXSYS_wcslen(s_pwsTagName)); - if (pChecksum != NULL) { + if (pChecksum) { static const FX_WCHAR* s_pwChecksum = L" checksum=\""; CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum, FXSYS_strlen(pChecksum)); @@ -468,7 +468,7 @@ IXFA_PacketExport* IXFA_PacketExport::Create(CXFA_Document* pDocument, } CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) : m_pDocument(pDocument) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); } FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite) { return Export(pWrite, m_pDocument->GetRoot()); @@ -477,8 +477,8 @@ FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite, CXFA_Node* pNode, FX_DWORD dwFlag, const FX_CHAR* pChecksum) { - ASSERT(pWrite != NULL); - if (pWrite == NULL) { + if (!pWrite) { + ASSERT(false); return FALSE; } IFX_Stream* pStream = IFX_Stream::CreateStream( @@ -517,7 +517,7 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, return FALSE; } CXFA_Node* pDataNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); - FXSYS_assert(pDataNode != NULL); + FXSYS_assert(pDataNode); XFA_DataExporter_DealWithDataGroupNode(pDataNode); pXMLDoc->SaveXMLNode(pStream, pElement); } break; diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp index 549b116ed8..be29f8322e 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp @@ -824,7 +824,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( m_bIsProcessKeep = TRUE; } } else { - if (m_bIsProcessKeep && m_pKeepHeadNode != NULL) { + if (m_bIsProcessKeep && m_pKeepHeadNode) { m_pKeepTailNode = pNextContainer; if (!m_bKeepBreakFinish && XFA_ItemLayoutProcessor_FindBreakNode( @@ -1091,9 +1091,9 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( } void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( CXFA_LayoutContext* pContext) { - if (m_pLayoutItem != NULL) { + if (m_pLayoutItem) return; - } + m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); FX_BOOL bIgnoreXY = (m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) != XFA_ATTRIBUTEENUM_Position); @@ -1367,9 +1367,9 @@ static inline void XFA_ItemLayoutProcessor_RelocateTableRowCells( pLayoutRow->m_sSize.Set(fContainerWidth, fContainerHeight); } void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { - if (m_pLayoutItem != NULL) { + if (m_pLayoutItem) return; - } + if (pLayoutNode == NULL) { pLayoutNode = m_pFormNode; } @@ -1481,9 +1481,9 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { bMoreColumns = FALSE; FX_BOOL bAutoCol = FALSE; for (int32_t i = 0; i < iRowCount; i++) { - while (rgRowItems[i] != NULL && (rgRowItemsSpan[i] <= 0 || - !XFA_ItemLayoutProcessor_IsTakingSpace( - rgRowItems[i]->m_pFormNode))) { + while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 || + !XFA_ItemLayoutProcessor_IsTakingSpace( + rgRowItems[i]->m_pFormNode))) { CXFA_ContentLayoutItem* pNewCell = (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace( @@ -2203,7 +2203,7 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(fChildHeight)) { CXFA_Node *pTempLeaderNode = NULL, *pTempTrailerNode = NULL; if (pThis->m_pPageMgr) { - if (pFormNode == NULL && pLayoutContext != NULL) { + if (pFormNode == NULL && pLayoutContext) { pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; } pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, @@ -2249,7 +2249,7 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( } } else { if (eRetValue == XFA_ItemLayoutProcessorResult_Done) { - if (pFormNode == NULL && pLayoutContext != NULL) { + if (pFormNode == NULL && pLayoutContext) { pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; } if (pThis->m_pPageMgr) { @@ -2340,7 +2340,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( fRealHeight = fRealHeight - fTopInset - fBottomInset; FX_FLOAT fContentCurRowY = 0; CXFA_ContentLayoutItem* pLayoutChild = NULL; - if (m_pLayoutItem != NULL) { + if (m_pLayoutItem) { if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done && eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) { pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; @@ -2907,9 +2907,9 @@ CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( return pSubformSet; } void CXFA_ItemLayoutProcessor::DoLayoutField() { - if (m_pLayoutItem != NULL) { + if (m_pLayoutItem) return; - } + ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); if (!m_pLayoutItem) { diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp index 2066a9fb8c..750bde0a87 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp @@ -175,7 +175,7 @@ FX_BOOL CXFA_LayoutPageMgr::AppendNewPage(FX_BOOL bFirstTemPage) { if (bFirstTemPage && m_pCurrentContainerRecord == NULL) { m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); } - return !bFirstTemPage || m_pCurrentContainerRecord != NULL; + return !bFirstTemPage || m_pCurrentContainerRecord; } static void XFA_LayoutItemMgr_ReorderLayoutItemToTail( CXFA_ContainerLayoutItem* pLayoutItem) { @@ -1711,7 +1711,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { } if (bIsExistForm) { CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; - if (pContainerItem->m_pOldSubform != NULL && + if (pContainerItem->m_pOldSubform && pContainerItem->m_pOldSubform != pNewSubform) { CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( pDocument, pContainerItem->m_pFormNode->GetClassID(), diff --git a/xfa/src/fxfa/src/parser/xfa_localemgr.cpp b/xfa/src/fxfa/src/parser/xfa_localemgr.cpp index a3567b802a..4db32db56f 100644 --- a/xfa/src/fxfa/src/parser/xfa_localemgr.cpp +++ b/xfa/src/fxfa/src/parser/xfa_localemgr.cpp @@ -1157,9 +1157,8 @@ IFX_Locale* CXFA_LocaleMgr::GetDefLocale() { return (IFX_Locale*)m_XMLLocaleArray[0]; } m_pDefLocale = GetLocale(m_dwDeflcid); - if (m_pDefLocale != NULL) { + if (m_pDefLocale) m_XMLLocaleArray.Add(m_pDefLocale); - } return m_pDefLocale; } IFX_Locale* CXFA_LocaleMgr::GetLocale(FX_WORD lcid) { @@ -1237,9 +1236,8 @@ IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( } FX_WORD dwLangueID = XFA_GetLanguage(wsLocaleName); IFX_Locale* pLocale = GetLocale(dwLangueID); - if (pLocale != NULL) { + if (pLocale) m_XMLLocaleArray.Add(pLocale); - } return pLocale; } void CXFA_LocaleMgr::SetDefLocale(IFX_Locale* pLocale) { diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index b09d44b157..cef42f8ba5 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -2518,8 +2518,8 @@ void CXFA_Node::Script_Som_InstanceIndex(FXJSE_HVALUE hValue, int32_t iTo = FXJSE_Value_ToInteger(hValue); int32_t iFrom = Subform_and_SubformSet_InstanceIndex(); CXFA_Node* pManagerNode = NULL; - for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); - pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { + for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; + pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { if (pNode->GetClassID() == XFA_ELEMENT_InstanceManager) { pManagerNode = pNode; break; @@ -2552,8 +2552,8 @@ void CXFA_Node::Script_Subform_InstanceManager(FXJSE_HVALUE hValue, if (!bSetting) { CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); CXFA_Node* pInstanceMgr = NULL; - for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); - pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { + for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; + pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { if (pNode->GetClassID() == XFA_ELEMENT_InstanceManager) { CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' && @@ -2653,7 +2653,7 @@ void CXFA_Node::Script_Subform_GetInvalidObjects(CFXJSE_Arguments* pArguments) { } int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() { int32_t index = 0; - for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode != NULL; + for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { if ((pNode->GetClassID() == XFA_ELEMENT_Subform) || (pNode->GetClassID() == XFA_ELEMENT_SubformSet)) { @@ -4635,7 +4635,8 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { if (pNode->m_pNext == NULL) { m_pLastChild = pNode; } - ASSERT(m_pLastChild != NULL && m_pLastChild->m_pNext == NULL); + ASSERT(m_pLastChild); + ASSERT(m_pLastChild->m_pNext == NULL); pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { @@ -4680,7 +4681,8 @@ FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { if (pNode->m_pNext == NULL) { m_pLastChild = pNode; } - ASSERT(m_pLastChild != NULL && m_pLastChild->m_pNext == NULL); + ASSERT(m_pLastChild); + ASSERT(m_pLastChild->m_pNext == NULL); pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { @@ -4832,8 +4834,8 @@ CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { if (!pParentNode || pParentNode->GetClassID() == XFA_ELEMENT_Area) { return pInstanceMgr; } - for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); - pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { + for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; + pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { XFA_ELEMENT eType = pNode->GetClassID(); if ((eType == XFA_ELEMENT_Subform || eType == XFA_ELEMENT_SubformSet) && pNode->m_dwNameHash != m_dwNameHash) { @@ -4892,7 +4894,7 @@ FX_BOOL CXFA_Node::IsAttributeInXML() { void CXFA_Node::OnRemoved(CXFA_Node* pParent, CXFA_Node* pRemoved, FX_BOOL bNotify) { - if (bNotify && (pParent != NULL)) { + if (bNotify && pParent) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(pParent, XFA_NODEEVENT_ChildRemoved, pRemoved); diff --git a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp index 033aea5eb9..36702a8c37 100644 --- a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp @@ -2112,7 +2112,7 @@ FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, } if (pItems) { CXFA_Node* pItem = pItems->GetChild(nIndex, XFA_ELEMENT_UNKNOWN); - if (pItem != NULL) { + if (pItem) { pItem->TryContent(wsText); return TRUE; } diff --git a/xfa/src/fxfa/src/parser/xfa_parser_imp.cpp b/xfa/src/fxfa/src/parser/xfa_parser_imp.cpp index 4bbfe4af9a..94f04e55f0 100644 --- a/xfa/src/fxfa/src/parser/xfa_parser_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_parser_imp.cpp @@ -1609,7 +1609,7 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { m_dwStatus == FDE_XMLSYNTAXSTATUS_EOS) { break; } - if (pPause != NULL && iCount > 500 && pPause->NeedToPauseNow()) { + if (pPause && iCount > 500 && pPause->NeedToPauseNow()) { break; } } diff --git a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp index 21309f6c8d..dc48c7e4b2 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp @@ -585,11 +585,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, int32_t nRet = -1; rndFind.m_pSC = this; CXFA_ObjArray findNodes; - if (refNode != NULL) { - findNodes.Add(refNode); - } else { - findNodes.Add(m_pDocument->GetRoot()); - } + findNodes.Add(refNode ? refNode : m_pDocument->GetRoot()); int32_t nNodes = 0; while (TRUE) { nNodes = findNodes.GetSize(); diff --git a/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp b/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp index 243dae8c2d..1759de01c0 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp @@ -265,7 +265,7 @@ void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode, CFX_WideString wsParent; CXFA_Node* parent = XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); - while (parent != NULL) { + while (parent) { XFA_GetNameExpression(parent, wsParent, FALSE, eLogicType); wsParent += L"."; wsParent += wsName; @@ -273,24 +273,25 @@ void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode, parent = XFA_ResolveNodes_GetParent(parent, XFA_LOGIC_NoTransparent); } return; - } else { - CFX_WideStringC wsTagName; - CFX_WideString ws; - FX_BOOL bIsProperty = XFA_NodeIsProperty(refNode); - if (refNode->IsUnnamed() || - (bIsProperty && refNode->GetClassID() != XFA_ELEMENT_PageSet)) { - refNode->GetClassName(wsTagName); - ws = wsTagName; - wsName.Format(L"#%s[%d]", (const FX_WCHAR*)ws, - XFA_GetIndex(refNode, eLogicType, bIsProperty, TRUE)); - return; - } - ws = refNode->GetCData(XFA_ATTRIBUTE_Name); - ws.Replace(L".", L"\\."); - wsName.Format(L"%s[%d]", (const FX_WCHAR*)ws, - XFA_GetIndex(refNode, eLogicType, bIsProperty, FALSE)); } + + CFX_WideStringC wsTagName; + CFX_WideString ws; + FX_BOOL bIsProperty = XFA_NodeIsProperty(refNode); + if (refNode->IsUnnamed() || + (bIsProperty && refNode->GetClassID() != XFA_ELEMENT_PageSet)) { + refNode->GetClassName(wsTagName); + ws = wsTagName; + wsName.Format(L"#%s[%d]", (const FX_WCHAR*)ws, + XFA_GetIndex(refNode, eLogicType, bIsProperty, TRUE)); + return; + } + ws = refNode->GetCData(XFA_ATTRIBUTE_Name); + ws.Replace(L".", L"\\."); + wsName.Format(L"%s[%d]", (const FX_WCHAR*)ws, + XFA_GetIndex(refNode, eLogicType, bIsProperty, FALSE)); } + FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { if (refNode == NULL) { return FALSE; |