diff options
author | dsinclair <dsinclair@chromium.org> | 2016-06-23 12:40:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-23 12:40:16 -0700 |
commit | 85d1f2c2f9f1e746bedb1b6f03576613f54fbc27 (patch) | |
tree | ff5b393fb9b89f006327bee7bc8c955522defb67 /xfa/fxfa/app | |
parent | 6e12478cb298c3a8277493ee79ae0b73d6df8554 (diff) | |
download | pdfium-85d1f2c2f9f1e746bedb1b6f03576613f54fbc27.tar.xz |
Remove NULL in xfa/
This CL converts all NULL's to nullptr. All instances of comparison to nullptr
have been removed.
Review-Url: https://codereview.chromium.org/2095653002
Diffstat (limited to 'xfa/fxfa/app')
29 files changed, 218 insertions, 231 deletions
diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index 9313ad7ea2..419f15bc34 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -54,11 +54,11 @@ void Base64EncodePiece(const FX_BASE64DATA& src, } int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) { - ASSERT(pSrc != NULL); + ASSERT(pSrc); if (iSrcLen < 1) { return 0; } - if (pDst == NULL) { + if (!pDst) { int32_t iDstLen = iSrcLen / 3 * 4; if ((iSrcLen % 3) != 0) { iDstLen += 4; @@ -103,7 +103,7 @@ CXFA_SAXContext* CXFA_SAXReaderHandler::OnTagEnter( UpdateChecksum(TRUE); if (eType != CFX_SAXItem::Type::Tag && eType != CFX_SAXItem::Type::Instruction) { - return NULL; + return nullptr; } m_SAXContext.m_eNode = eType; CFX_ByteTextBuf& textBuf = m_SAXContext.m_TextBuf; @@ -242,7 +242,7 @@ FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_FileRead* pSrcFile, CFX_SaxParseMode_NotConvert_sharp) < 0) { return FALSE; } - return m_pSAXReader->ContinueParse(NULL) > 99; + return m_pSAXReader->ContinueParse(nullptr) > 99; } void CXFA_ChecksumContext::FinishChecksum() { @@ -252,12 +252,12 @@ void CXFA_ChecksumContext::FinishChecksum() { uint8_t digest[20]; FXSYS_memset(digest, 0, 20); CRYPT_SHA1Finish(m_pByteContext, digest); - int32_t nLen = Base64EncodeA(digest, 20, NULL); + int32_t nLen = Base64EncodeA(digest, 20, nullptr); FX_CHAR* pBuffer = m_bsChecksum.GetBuffer(nLen); Base64EncodeA(digest, 20, pBuffer); m_bsChecksum.ReleaseBuffer(nLen); FX_Free(m_pByteContext); - m_pByteContext = NULL; + m_pByteContext = nullptr; } } diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index 5f2f1b9828..22989b8b3e 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -109,34 +109,26 @@ CXFA_FFApp::~CXFA_FFApp() { } CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { - if (!m_pDocHandler) { + if (!m_pDocHandler) m_pDocHandler = new CXFA_FFDocHandler; - } return m_pDocHandler; } CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, IFX_FileRead* pStream, FX_BOOL bTakeOverFile) { - CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); + std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pProvider)); FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile); - if (!bSuccess) { - delete pDoc; - pDoc = NULL; - } - return pDoc; + return bSuccess ? pDoc.release() : nullptr; } + CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, CPDF_Document* pPDFDoc) { - if (pPDFDoc == NULL) { - return NULL; - } - CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); + if (!pPDFDoc) + return nullptr; + + std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pProvider)); FX_BOOL bSuccess = pDoc->OpenDoc(pPDFDoc); - if (!bSuccess) { - delete pDoc; - pDoc = NULL; - } - return pDoc; + return bSuccess ? pDoc.release() : nullptr; } void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 5b1fe35c90..ffbd7ce505 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -111,7 +111,7 @@ XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName( iStart = iMid + 1; } } while (iStart <= iEnd); - return NULL; + return nullptr; } } // namespace. diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index a24971c9d4..253cbd0025 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -20,7 +20,7 @@ CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) { + : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) { m_rtCheckBox.Set(0, 0, 0, 0); } CXFA_FFCheckButton::~CXFA_FFCheckButton() {} diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.h b/xfa/fxfa/app/xfa_ffcheckbutton.h index ff99aef001..b8158acc7e 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.h +++ b/xfa/fxfa/app/xfa_ffcheckbutton.h @@ -28,7 +28,7 @@ class CXFA_FFCheckButton : public CXFA_FFField { void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; void SetFWLCheckState(XFA_CHECKSTATE eCheckState); diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index 4987b5ba23..da778ff0ad 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -21,7 +21,7 @@ CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) {} + : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {} CXFA_FFListBox::~CXFA_FFListBox() { if (m_pNormalWidget) { IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); @@ -203,7 +203,7 @@ void CXFA_FFListBox::OnDrawWidget(CFX_Graphics* pGraphics, CXFA_FFComboBox::CXFA_FFComboBox(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) {} + : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {} CXFA_FFComboBox::~CXFA_FFComboBox() {} @@ -479,7 +479,7 @@ void CXFA_FFComboBox::OnSelectChanged(IFWL_Widget* pWidget, FWLEventSelChange(&eParam); if (m_pDataAcc->GetChoiceListCommitOn() == XFA_ATTRIBUTEENUM_Select && bLButtonUp) { - m_pDocView->SetFocusWidgetAcc(NULL); + m_pDocView->SetFocusWidgetAcc(nullptr); } } void CXFA_FFComboBox::OnPreOpen(IFWL_Widget* pWidget) { diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h index 8f87190b77..c9ea0fa248 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.h +++ b/xfa/fxfa/app/xfa_ffchoicelist.h @@ -21,7 +21,7 @@ class CXFA_FFListBox : public CXFA_FFField { void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; void OnSelectChanged(IFWL_Widget* pWidget, const CFX_Int32Array& arrSels); void SetItemState(int32_t nIndex, FX_BOOL bSelected); @@ -71,7 +71,7 @@ class CXFA_FFComboBox : public CXFA_FFField { void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; virtual void OpenDropDownList(); diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 6d38cf589c..7c7136b1ca 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -199,7 +199,7 @@ int32_t CXFA_FFDocView::CountPageViews() { } CXFA_FFPageView* CXFA_FFDocView::GetPageView(int32_t nIndex) { if (!m_pXFADocLayout) { - return NULL; + return nullptr; } return static_cast<CXFA_FFPageView*>(m_pXFADocLayout->GetPage(nIndex)); } @@ -224,7 +224,7 @@ FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) { m_bLayoutEvent = TRUE; FX_BOOL bChanged = FALSE; - CXFA_Node* pFormNode = NULL; + CXFA_Node* pFormNode = nullptr; if (pWidgetAcc) { bChanged = ResetSingleWidgetAccData(pWidgetAcc); pFormNode = pWidgetAcc->GetNode(); @@ -315,10 +315,7 @@ CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() { CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( XFA_WIDGETORDER eOrder) { CXFA_Node* pFormRoot = GetRootSubform(); - if (!pFormRoot) { - return NULL; - } - return new CXFA_WidgetAccIterator(this, pFormRoot); + return pFormRoot ? new CXFA_WidgetAccIterator(this, pFormRoot) : nullptr; } CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() { return m_pFocusWidget; @@ -326,11 +323,11 @@ CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() { void CXFA_FFDocView::KillFocus() { if (m_pFocusWidget && (m_pFocusWidget->GetStatus() & XFA_WidgetStatus_Focused)) { - (m_pFocusWidget)->OnKillFocus(NULL); + (m_pFocusWidget)->OnKillFocus(nullptr); } - m_pFocusAcc = NULL; - m_pFocusWidget = NULL; - m_pOldFocusWidget = NULL; + m_pFocusAcc = nullptr; + m_pFocusWidget = nullptr; + m_pOldFocusWidget = nullptr; } FX_BOOL CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) { CXFA_FFWidget* pNewFocus = hWidget; @@ -358,10 +355,10 @@ FX_BOOL CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) { } pNewFocus = m_pOldFocusWidget; if (m_pListFocusWidget && pNewFocus == m_pListFocusWidget) { - m_pFocusAcc = NULL; - m_pFocusWidget = NULL; - m_pListFocusWidget = NULL; - m_pOldFocusWidget = NULL; + m_pFocusAcc = nullptr; + m_pFocusWidget = nullptr; + m_pListFocusWidget = nullptr; + m_pOldFocusWidget = nullptr; return FALSE; } if (pNewFocus && (pNewFocus->GetStatus() & XFA_WidgetStatus_Visible)) { @@ -370,7 +367,7 @@ FX_BOOL CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) { } pNewFocus->OnSetFocus(m_pFocusWidget); } - m_pFocusAcc = pNewFocus ? pNewFocus->GetDataAcc() : NULL; + m_pFocusAcc = pNewFocus ? pNewFocus->GetDataAcc() : nullptr; m_pFocusWidget = pNewFocus; m_pOldFocusWidget = m_pFocusWidget; return TRUE; @@ -380,7 +377,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetFocusWidgetAcc() { } void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { CXFA_FFWidget* pNewFocus = - pWidgetAcc ? pWidgetAcc->GetNextWidget(NULL) : NULL; + pWidgetAcc ? pWidgetAcc->GetNextWidget(nullptr) : nullptr; if (SetFocus(pNewFocus)) { m_pFocusAcc = pWidgetAcc; if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End) { @@ -390,9 +387,9 @@ void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { } void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) { if (m_pFocusAcc == pWidget->GetDataAcc()) { - m_pFocusAcc = NULL; - m_pFocusWidget = NULL; - m_pOldFocusWidget = NULL; + m_pFocusAcc = nullptr; + m_pFocusWidget = nullptr; + m_pOldFocusWidget = nullptr; } } static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView, @@ -447,7 +444,7 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, return iRet; } CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData(); - if (pWidgetAcc == NULL) { + if (!pWidgetAcc) { return iRet; } CXFA_EventParam eParam; @@ -470,7 +467,7 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, } } CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData(); - if (pWidgetAcc == NULL) { + if (!pWidgetAcc) { return iRet; } CXFA_EventParam eParam; @@ -770,11 +767,7 @@ void CXFA_FFDocView::RunBindItems() { wsValue = refNode->GetContent(); } else { CXFA_Node* nodeValue = refNode->GetFirstChildByName(uValueHash); - if (nodeValue == NULL) { - wsValue = refNode->GetContent(); - } else { - wsValue = nodeValue->GetContent(); - } + wsValue = nodeValue ? nodeValue->GetContent() : refNode->GetContent(); } if (!bUseValue) { if (bLabelUseContent) { @@ -802,7 +795,7 @@ CXFA_Node* CXFA_FFDocView::GetRootSubform() { CXFA_Node* pFormPacketNode = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); if (!pFormPacketNode) { - return NULL; + return nullptr; } return pFormPacketNode->GetFirstChildByClass(XFA_Element::Subform); } @@ -811,18 +804,18 @@ CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot) : m_ContentIterator(pTravelRoot) { m_pDocView = pDocView; - m_pCurWidgetAcc = NULL; + m_pCurWidgetAcc = nullptr; } CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {} void CXFA_WidgetAccIterator::Reset() { - m_pCurWidgetAcc = NULL; + m_pCurWidgetAcc = nullptr; m_ContentIterator.Reset(); } CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToFirst() { - return NULL; + return nullptr; } CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToLast() { - return NULL; + return nullptr; } CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() { CXFA_Node* pItem = m_pCurWidgetAcc ? m_ContentIterator.MoveToNext() @@ -833,18 +826,18 @@ CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() { return m_pCurWidgetAcc; pItem = m_ContentIterator.MoveToNext(); } - return NULL; + return nullptr; } CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToPrevious() { - return NULL; + return nullptr; } CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { - return NULL; + return nullptr; } FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { return FALSE; } void CXFA_WidgetAccIterator::SkipTree() { m_ContentIterator.SkipChildrenAndMoveToNext(); - m_pCurWidgetAcc = NULL; + m_pCurWidgetAcc = nullptr; } diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index d3e645d56b..66520b2738 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -22,7 +22,7 @@ #include "xfa/fxgraphics/cfx_path.h" CXFA_FFField::CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) - : CXFA_FFWidget(pPageView, pDataAcc), m_pNormalWidget(NULL) { + : CXFA_FFWidget(pPageView, pDataAcc), m_pNormalWidget(nullptr) { m_rtUI.Set(0, 0, 0, 0); m_rtCaption.Set(0, 0, 0, 0); } @@ -166,12 +166,12 @@ void CXFA_FFField::CapPlacement() { mgWidget.GetRightInset(fRightInset); mgWidget.GetTopInset(fTopInset); mgWidget.GetBottomInset(fBottomInset); - if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) { + if (!pItem->GetPrev() && !pItem->GetNext()) { rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset); } else { - if (pItem->GetPrev() == NULL) { + if (!pItem->GetPrev()) { rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, 0); - } else if (pItem->GetNext() == NULL) { + } else if (!pItem->GetNext()) { rtWidget.Deflate(fLeftInset, 0, fRightInset, fBottomInset); } else { rtWidget.Deflate(fLeftInset, 0, fRightInset, 0); @@ -190,7 +190,7 @@ void CXFA_FFField::CapPlacement() { } else { fCapReserve = caption.GetReserve(); CXFA_LayoutItem* pItem = this; - if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) { + if (!pItem->GetPrev() && !pItem->GetNext()) { m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width, rtWidget.height); } else { @@ -350,7 +350,7 @@ FX_BOOL CXFA_FFField::OnMouseEnter() { CFWL_MsgMouse ms; ms.m_dwCmd = FWL_MouseCommand::Enter; ms.m_pDstTarget = m_pNormalWidget->m_pIface; - ms.m_pSrcTarget = NULL; + ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return TRUE; } @@ -529,7 +529,7 @@ FX_BOOL CXFA_FFField::OnSetFocus(CXFA_FFWidget* pOldWidget) { } CFWL_MsgSetFocus ms; ms.m_pDstTarget = m_pNormalWidget->m_pIface; - ms.m_pSrcTarget = NULL; + ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); m_dwStatus |= XFA_WidgetStatus_Focused; AddInvalidateRect(); @@ -541,7 +541,7 @@ FX_BOOL CXFA_FFField::OnKillFocus(CXFA_FFWidget* pNewWidget) { } CFWL_MsgKillFocus ms; ms.m_pDstTarget = m_pNormalWidget->m_pIface; - ms.m_pSrcTarget = NULL; + ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); m_dwStatus &= ~XFA_WidgetStatus_Focused; AddInvalidateRect(); @@ -557,7 +557,7 @@ FX_BOOL CXFA_FFField::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwKeyCode; ms.m_pDstTarget = m_pNormalWidget->m_pIface; - ms.m_pSrcTarget = NULL; + ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return TRUE; } @@ -570,7 +570,7 @@ FX_BOOL CXFA_FFField::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwKeyCode; ms.m_pDstTarget = m_pNormalWidget->m_pIface; - ms.m_pSrcTarget = NULL; + ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return TRUE; } @@ -592,7 +592,7 @@ FX_BOOL CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwChar; ms.m_pDstTarget = m_pNormalWidget->m_pIface; - ms.m_pSrcTarget = NULL; + ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return TRUE; } @@ -689,7 +689,7 @@ int32_t CXFA_FFField::CalculateOverride() { if (!pNode) { return 1; } - CXFA_WidgetAcc* pWidgetAcc = NULL; + CXFA_WidgetAcc* pWidgetAcc = nullptr; while (pNode) { pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); if (!pWidgetAcc) { diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index a2c310fa89..ffe5b6563a 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -57,7 +57,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; void UpdateFWL(); uint32_t UpdateUIProperty(); @@ -70,7 +70,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { CFWL_Widget* GetNormalWidget() { return m_pNormalWidget; } void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy); void LayoutCaption(); - void RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = NULL); + void RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr); int32_t CalculateOverride(); int32_t CalculateWidgetAcc(CXFA_WidgetAcc* pAcc); diff --git a/xfa/fxfa/app/xfa_ffimage.cpp b/xfa/fxfa/app/xfa_ffimage.cpp index 5f62f78317..7c152a196e 100644 --- a/xfa/fxfa/app/xfa_ffimage.cpp +++ b/xfa/fxfa/app/xfa_ffimage.cpp @@ -18,7 +18,7 @@ CXFA_FFImage::~CXFA_FFImage() { CXFA_FFImage::UnloadWidget(); } FX_BOOL CXFA_FFImage::IsLoaded() { - return GetDataAcc()->GetImageImage() != NULL; + return !!GetDataAcc()->GetImageImage(); } FX_BOOL CXFA_FFImage::LoadWidget() { if (GetDataAcc()->GetImageImage()) { @@ -28,7 +28,7 @@ FX_BOOL CXFA_FFImage::LoadWidget() { return CXFA_FFDraw::LoadWidget(); } void CXFA_FFImage::UnloadWidget() { - GetDataAcc()->SetImageImage(NULL); + GetDataAcc()->SetImageImage(nullptr); } void CXFA_FFImage::RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix, diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index fafa24d5c7..85e464d40a 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -18,7 +18,7 @@ CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) {} + : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {} CXFA_FFImageEdit::~CXFA_FFImageEdit() { CXFA_FFImageEdit::UnloadWidget(); } @@ -41,7 +41,7 @@ FX_BOOL CXFA_FFImageEdit::LoadWidget() { return TRUE; } void CXFA_FFImageEdit::UnloadWidget() { - m_pDataAcc->SetImageEditImage(NULL); + m_pDataAcc->SetImageEditImage(nullptr); CXFA_FFField::UnloadWidget(); } void CXFA_FFImageEdit::RenderWidget(CFX_Graphics* pGS, @@ -118,7 +118,7 @@ FX_BOOL CXFA_FFImageEdit::CommitData() { return TRUE; } FX_BOOL CXFA_FFImageEdit::UpdateFWLData() { - m_pDataAcc->SetImageEditImage(NULL); + m_pDataAcc->SetImageEditImage(nullptr); m_pDataAcc->LoadImageEditImage(); return TRUE; } diff --git a/xfa/fxfa/app/xfa_ffimageedit.h b/xfa/fxfa/app/xfa_ffimageedit.h index 88a28f431c..c8f31e2fc4 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.h +++ b/xfa/fxfa/app/xfa_ffimageedit.h @@ -24,7 +24,7 @@ class CXFA_FFImageEdit : public CXFA_FFField { void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; protected: void SetFWLRect() override; diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 12792bc996..d8c32f9ed9 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -221,7 +221,7 @@ int32_t CXFA_FFNotify::ExecEventByDeepFirst(CXFA_Node* pFormNode, } return pDocView->ExecEventActivityByDeepFirst( pFormNode, eEventType, bIsFormReady, bRecursive, - pExclude ? pExclude->GetNode() : NULL); + pExclude ? pExclude->GetNode() : nullptr); } void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); @@ -247,7 +247,7 @@ IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { } CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); - return pDocView ? pDocView->GetWidgetHandler() : NULL; + return pDocView ? pDocView->GetWidgetHandler() : nullptr; } CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { return XFA_GetWidgetFromLayoutItem(pLayoutItem); @@ -299,10 +299,10 @@ void CXFA_FFNotify::RunSubformIndexChange(CXFA_Node* pSubformNode) { CXFA_Node* CXFA_FFNotify::GetFocusWidgetNode() { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); if (!pDocView) { - return NULL; + return nullptr; } CXFA_WidgetAcc* pAcc = pDocView->GetFocusWidgetAcc(); - return pAcc ? pAcc->GetNode() : NULL; + return pAcc ? pAcc->GetNode() : nullptr; } void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index e9e8721df3..322caa3652 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -54,7 +54,7 @@ class CXFA_FFNotify { XFA_EVENTTYPE eEventType, FX_BOOL bIsFormReady = FALSE, FX_BOOL bRecursive = TRUE, - CXFA_WidgetAcc* pExclude = NULL); + CXFA_WidgetAcc* pExclude = nullptr); void AddCalcValidate(CXFA_Node* pNode); CXFA_FFDoc* GetHDOC(); IXFA_DocProvider* GetDocProvider(); @@ -63,7 +63,7 @@ class CXFA_FFNotify { CXFA_FFWidget* GetHWidget(CXFA_LayoutItem* pLayoutItem); void OpenDropDownList(CXFA_FFWidget* hWidget); CFX_WideString GetCurrentDateTime(); - void ResetData(CXFA_WidgetData* pWidgetData = NULL); + void ResetData(CXFA_WidgetData* pWidgetData = nullptr); int32_t GetLayoutStatus(); void RunNodeInitialize(CXFA_Node* pNode); void RunSubformIndexChange(CXFA_Node* pSubformNode); diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index dd40ecf946..54c262faac 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -150,10 +150,10 @@ CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToFirst() { return hWidget; } } - return NULL; + return nullptr; } CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToLast() { - m_sIterator.SetCurrent(NULL); + m_sIterator.SetCurrent(nullptr); return MoveToPrevious(); } CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() { @@ -163,7 +163,7 @@ CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() { return hWidget; } } - return NULL; + return nullptr; } CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() { for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem; @@ -172,11 +172,11 @@ CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() { return hWidget; } } - return NULL; + return nullptr; } CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetCurrentWidget() { CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); - return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : NULL; + return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : nullptr; } FX_BOOL CXFA_FFPageWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) { return hWidget && m_sIterator.SetCurrent(hWidget); @@ -185,7 +185,7 @@ CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetWidget( CXFA_LayoutItem* pLayoutItem) { if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) { if (!PageWidgetFilter(pWidget, m_dwFilter, FALSE, m_bIgnorerelevant)) { - return NULL; + return nullptr; } if (!pWidget->IsLoaded() && (pWidget->GetStatus() & XFA_WidgetStatus_Visible) != 0) { @@ -193,7 +193,7 @@ CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetWidget( } return pWidget; } - return NULL; + return nullptr; } CXFA_FFTabOrderPageWidgetIterator::CXFA_FFTabOrderPageWidgetIterator( @@ -222,7 +222,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { } } } - return NULL; + return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { if (m_TabOrderWidgetArray.GetSize() > 0) { @@ -234,7 +234,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { } } } - return NULL; + return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { for (int32_t i = m_iCurWidget + 1; i < m_TabOrderWidgetArray.GetSize(); i++) { @@ -245,7 +245,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { } } m_iCurWidget = -1; - return NULL; + return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { for (int32_t i = m_iCurWidget - 1; i >= 0; i--) { @@ -256,13 +256,13 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { } } m_iCurWidget = -1; - return NULL; + return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() { if (m_iCurWidget >= 0) { return m_TabOrderWidgetArray[m_iCurWidget]; } - return NULL; + return nullptr; } FX_BOOL CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget( CXFA_FFWidget* hWidget) { @@ -286,7 +286,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( } } } - return NULL; + return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::FindWidgetByName( const CFX_WideString& wsWidgetName, @@ -408,7 +408,7 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray( CXFA_TabParam* pParam = new CXFA_TabParam; FX_BOOL bCurrentItem = FALSE; FX_BOOL bContentArea = FALSE; - OrderContainer(&sIterator, NULL, pParam, bCurrentItem, bContentArea); + OrderContainer(&sIterator, nullptr, pParam, bCurrentItem, bContentArea); if (pParam->m_Children.GetSize() > 0) { WidgetArray.Append(pParam->m_Children); } @@ -416,7 +416,7 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray( bCurrentItem = FALSE; bContentArea = FALSE; pParam->m_Children.RemoveAll(); - OrderContainer(&sIterator, NULL, pParam, bCurrentItem, bContentArea, TRUE); + OrderContainer(&sIterator, nullptr, pParam, bCurrentItem, bContentArea, TRUE); if (pParam->m_Children.GetSize() > 0) { WidgetArray.Append(pParam->m_Children); } @@ -431,9 +431,9 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetWidget( } return pWidget; } - return NULL; + return nullptr; } -CXFA_TabParam::CXFA_TabParam() : m_pWidget(NULL) {} +CXFA_TabParam::CXFA_TabParam() : m_pWidget(nullptr) {} CXFA_TabParam::~CXFA_TabParam() {} diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index bb25f1bcc1..3af1e34db9 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -21,11 +21,11 @@ CXFA_FFPushButton::CXFA_FFPushButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFField(pPageView, pDataAcc), - m_pRolloverTextLayout(NULL), - m_pDownTextLayout(NULL), - m_pDownProvider(NULL), - m_pRollProvider(NULL), - m_pOldDelegate(NULL) {} + m_pRolloverTextLayout(nullptr), + m_pDownTextLayout(nullptr), + m_pDownProvider(nullptr), + m_pRollProvider(nullptr), + m_pOldDelegate(nullptr) {} CXFA_FFPushButton::~CXFA_FFPushButton() { CXFA_FFPushButton::UnloadWidget(); } @@ -139,7 +139,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() { CFX_WideString wsRollover; FX_BOOL bRichText; if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) { - if (m_pRollProvider == NULL) { + if (!m_pRollProvider) { m_pRollProvider = new CXFA_TextProvider(m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover); } @@ -147,7 +147,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() { } CFX_WideString wsDown; if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) { - if (m_pDownProvider == NULL) { + if (!m_pDownProvider) { m_pDownProvider = new CXFA_TextProvider(m_pDataAcc, XFA_TEXTPROVIDERTYPE_Down); } diff --git a/xfa/fxfa/app/xfa_ffpushbutton.h b/xfa/fxfa/app/xfa_ffpushbutton.h index dae232e173..e7c9bd7746 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.h +++ b/xfa/fxfa/app/xfa_ffpushbutton.h @@ -32,12 +32,12 @@ class CXFA_FFPushButton : public CXFA_FFField { void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; protected: void LoadHighlightCaption(); void LayoutHighlightCaption(); - void RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = NULL); + void RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr); FX_FLOAT GetLineWidth(); FX_ARGB GetLineColor(); FX_ARGB GetFillColor(); diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index 88cc6590e6..3e5b3df8e9 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -38,15 +38,15 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS, GetRectWithoutRotate(rtText); if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) { CXFA_LayoutItem* pItem = this; - if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) { + if (!pItem->GetPrev() && !pItem->GetNext()) { XFA_RectWidthoutMargin(rtText, mgWidget); } else { FX_FLOAT fLeftInset, fRightInset, fTopInset = 0, fBottomInset = 0; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); - if (pItem->GetPrev() == NULL) { + if (!pItem->GetPrev()) { mgWidget.GetTopInset(fTopInset); - } else if (pItem->GetNext() == NULL) { + } else if (!pItem->GetNext()) { mgWidget.GetBottomInset(fBottomInset); } rtText.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset); @@ -76,7 +76,7 @@ FX_BOOL CXFA_FFText::PerformLayout() { } pTextLayout->m_Blocks.RemoveAll(); CXFA_LayoutItem* pItem = this; - if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) { + if (!pItem->GetPrev() && !pItem->GetNext()) { return TRUE; } pItem = pItem->GetFirst(); @@ -84,11 +84,11 @@ FX_BOOL CXFA_FFText::PerformLayout() { CFX_RectF rtText; pItem->GetRect(rtText); if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) { - if (pItem->GetPrev() == NULL) { + if (!pItem->GetPrev()) { FX_FLOAT fTopInset; mgWidget.GetTopInset(fTopInset); rtText.height -= fTopInset; - } else if (pItem->GetNext() == NULL) { + } else if (!pItem->GetNext()) { FX_FLOAT fBottomInset; mgWidget.GetBottomInset(fBottomInset); rtText.height -= fBottomInset; @@ -107,7 +107,7 @@ FX_BOOL CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return FALSE; } const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); - if (NULL == wsURLContent) { + if (!wsURLContent) { return FALSE; } SetButtonDown(TRUE); @@ -120,7 +120,7 @@ FX_BOOL CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return FALSE; } const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); - if (NULL == wsURLContent) { + if (!wsURLContent) { return FALSE; } return TRUE; @@ -131,7 +131,7 @@ FX_BOOL CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { } SetButtonDown(FALSE); const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); - if (NULL == wsURLContent) { + if (!wsURLContent) { return FALSE; } CXFA_FFDoc* pDoc = GetDoc(); @@ -149,8 +149,8 @@ FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { } const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) { CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); - if (NULL == pTextLayout) { - return NULL; + if (!pTextLayout) { + return nullptr; } FX_FLOAT x(fx), y(fy); FWLToClient(x, y); @@ -166,7 +166,7 @@ const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) { } } } - return NULL; + return nullptr; } void CXFA_FFText::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { CFX_RectF rtWidget; diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index d29446a086..398cf87cd8 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -26,7 +26,7 @@ CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) - : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) {} + : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {} CXFA_FFTextEdit::~CXFA_FFTextEdit() { if (m_pNormalWidget) { IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); @@ -159,14 +159,14 @@ FX_BOOL CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { CXFA_FFWidget::OnSetFocus(pOldWidget); CFWL_MsgSetFocus ms; ms.m_pDstTarget = m_pNormalWidget->m_pIface; - ms.m_pSrcTarget = NULL; + ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return TRUE; } FX_BOOL CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { CFWL_MsgKillFocus ms; ms.m_pDstTarget = m_pNormalWidget->m_pIface; - ms.m_pSrcTarget = NULL; + ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); m_dwStatus &= ~XFA_WidgetStatus_Focused; SetEditScrollOffset(); @@ -782,7 +782,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget; pDateTime->SetEditText(wsDate); pDateTime->Update(); - GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL); + GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), nullptr); CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; eParam.m_pTarget = m_pDataAcc; diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h index d7c6667435..c6d9c9c862 100644 --- a/xfa/fxfa/app/xfa_fftextedit.h +++ b/xfa/fxfa/app/xfa_fftextedit.h @@ -45,7 +45,7 @@ class CXFA_FFTextEdit : public CXFA_FFField { void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; void OnTextChanged(IFWL_Widget* pWidget, const CFX_WideString& wsChanged, diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 09f6da0b9f..e4b25dec85 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -123,7 +123,7 @@ void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS, } } FX_BOOL CXFA_FFWidget::IsLoaded() { - return m_pPageView != NULL; + return !!m_pPageView; } FX_BOOL CXFA_FFWidget::LoadWidget() { PerformLayout(); @@ -405,10 +405,10 @@ CXFA_FFWidget* CXFA_FFWidget::GetParent() { CXFA_WidgetAcc* pParentWidgetAcc = static_cast<CXFA_WidgetAcc*>(pParentNode->GetWidgetData()); if (pParentWidgetAcc) { - return pParentWidgetAcc->GetNextWidget(NULL); + return pParentWidgetAcc->GetNextWidget(nullptr); } } - return NULL; + return nullptr; } FX_BOOL CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) { if (!pWidget) { @@ -584,14 +584,14 @@ class CXFA_ImageRenderer { int Transparency); }; CXFA_ImageRenderer::CXFA_ImageRenderer() { - m_pDevice = NULL; + m_pDevice = nullptr; m_Status = 0; - m_pDIBSource = NULL; - m_pCloneConvert = NULL; + m_pDIBSource = nullptr; + m_pCloneConvert = nullptr; m_BitmapAlpha = 255; m_FillArgb = 0; m_Flags = 0; - m_DeviceHandle = NULL; + m_DeviceHandle = nullptr; m_BlendType = FXDIB_BLEND_NORMAL; m_Result = TRUE; m_bPrint = FALSE; @@ -741,7 +741,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int bitmap_alpha, int blend_mode, int Transparency) { - if (pDIBitmap == NULL) { + if (!pDIBitmap) { return; } bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED); @@ -780,7 +780,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); rect.Intersect(m_pDevice->GetClipBox()); - CFX_DIBitmap* pClone = NULL; + CFX_DIBitmap* pClone = nullptr; FX_BOOL bClone = FALSE; if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { bClone = TRUE; @@ -823,7 +823,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, FX_BOOL bRet = imageRender.Start(m_pDevice, pCloneConvert, m_FillArgb, m_BitmapAlpha, &m_ImageMatrix, m_Flags); while (bRet) { - bRet = imageRender.Continue(NULL); + bRet = imageRender.Continue(nullptr); } delete pCloneConvert; return; @@ -897,7 +897,7 @@ void XFA_DrawImage(CFX_Graphics* pGS, FX_BOOL bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage, FXDIB_INTERPOL); while (bRet) { - bRet = imageRender.Continue(NULL); + bRet = imageRender.Continue(nullptr); } pRenderDevice->RestoreState(false); } @@ -932,12 +932,12 @@ static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) { return pCP; } static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) { - if (pStr == NULL) { + if (!pStr) { return 0; } uint8_t* pBuffer = XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr)); - if (pBuffer == NULL) { + if (!pBuffer) { return 0; } int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer); @@ -981,7 +981,7 @@ static const FX_CHAR g_base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { - FX_CHAR* out = NULL; + FX_CHAR* out = nullptr; int i, j; uint32_t limb; out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5); @@ -1046,14 +1046,14 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, CFX_WideString wsImage; pImage->GetContent(wsImage); if (wsHref.IsEmpty() && wsImage.IsEmpty()) { - return NULL; + return nullptr; } CFX_WideString wsContentType; pImage->GetContentType(wsContentType); FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); CFX_ByteString bsContent; - uint8_t* pImageBuffer = NULL; - IFX_FileRead* pImageFileRead = NULL; + uint8_t* pImageBuffer = nullptr; + IFX_FileRead* pImageFileRead = nullptr; if (wsImage.GetLength() > 0) { XFA_ATTRIBUTEENUM iEncoding = (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); @@ -1085,7 +1085,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, } if (!pImageFileRead) { FX_Free(pImageBuffer); - return NULL; + return nullptr; } bNameImage = FALSE; CFX_DIBitmap* pBitmap = @@ -1120,14 +1120,14 @@ CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead, int32_t& iImageYDpi) { CFX_GEModule* pGeModule = CFX_GEModule::Get(); if (!pGeModule) { - return NULL; + return nullptr; } CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); if (!pCodecMgr) { - return NULL; + return nullptr; } CFX_DIBAttribute dibAttr; - CFX_DIBitmap* pBitmap = NULL; + CFX_DIBitmap* pBitmap = nullptr; CCodec_ProgressiveDecoder* pProgressiveDecoder = pCodecMgr->CreateProgressiveDecoder(); pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr, false); diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 1e5bd0ac34..dabb31610a 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -36,7 +36,7 @@ static void XFA_FFDeleteCalcData(void* pData) { } static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteCalcData = { - XFA_FFDeleteCalcData, NULL}; + XFA_FFDeleteCalcData, nullptr}; class CXFA_WidgetLayoutData { public: @@ -135,7 +135,7 @@ class CXFA_TextEditData : public CXFA_FieldLayoutData { class CXFA_ImageEditData : public CXFA_FieldLayoutData { public: CXFA_ImageEditData() - : m_pDIBitmap(NULL), + : m_pDIBitmap(nullptr), m_bNamedImage(FALSE), m_iImageXDpi(0), m_iImageYDpi(0) {} @@ -222,7 +222,7 @@ void CXFA_WidgetAcc::ResetData() { if (!pAcc) { continue; } - CXFA_Value defValue(NULL); + CXFA_Value defValue(nullptr); if (wsValue.IsEmpty() && (defValue = pAcc->GetDefaultValue())) { defValue.GetChildValueContent(wsValue); SetValue(wsValue, XFA_VALUEPICTURE_Raw); @@ -282,7 +282,7 @@ void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType, CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() { CXFA_Node* pExcl = m_pNode->GetNodeItem(XFA_NODEITEM_Parent); if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup) { - return NULL; + return nullptr; } return static_cast<CXFA_WidgetAcc*>(pExcl->GetWidgetData()); } @@ -695,7 +695,7 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, if (pRetValue) *pRetValue = pTmpRetValue.release(); - pContext->SetNodesOfRunScript(NULL); + pContext->SetNodesOfRunScript(nullptr); return iRet; } CXFA_FFWidget* CXFA_WidgetAcc::GetNextWidget(CXFA_FFWidget* pWidget) { @@ -708,7 +708,7 @@ CXFA_FFWidget* CXFA_WidgetAcc::GetNextWidget(CXFA_FFWidget* pWidget) { return static_cast<CXFA_FFWidget*>(pLayout); } void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFWidget* pExcept) { - CXFA_FFWidget* pWidget = NULL; + CXFA_FFWidget* pWidget = nullptr; while ((pWidget = GetNextWidget(pWidget)) != nullptr) { if (pWidget == pExcept || !pWidget->IsLoaded() || (GetUIType() != XFA_Element::CheckButton && pWidget->IsFocused())) { @@ -1471,19 +1471,19 @@ CXFA_TextLayout* CXFA_WidgetAcc::GetTextLayout() { return m_pLayoutData ? static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get()) ->GetTextLayout() - : NULL; + : nullptr; } CFX_DIBitmap* CXFA_WidgetAcc::GetImageImage() { return m_pLayoutData ? static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get()) ->m_pDIBitmap - : NULL; + : nullptr; } CFX_DIBitmap* CXFA_WidgetAcc::GetImageEditImage() { return m_pLayoutData ? static_cast<CXFA_ImageEditData*>(m_pLayoutData.get()) ->m_pDIBitmap - : NULL; + : nullptr; } void CXFA_WidgetAcc::SetImageImage(CFX_DIBitmap* newImage) { @@ -1570,7 +1570,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { CXFA_Node* pElementNode = m_pWidgetAcc->GetNode(); CXFA_Node* pValueNode = pElementNode->GetChild(0, XFA_Element::Value); if (!pValueNode) { - return NULL; + return nullptr; } CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { @@ -1600,12 +1600,12 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { } else if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) { CXFA_Node* pCaptionNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption); - if (pCaptionNode == NULL) { - return NULL; + if (!pCaptionNode) { + return nullptr; } CXFA_Node* pValueNode = pCaptionNode->GetChild(0, XFA_Element::Value); - if (pValueNode == NULL) { - return NULL; + if (!pValueNode) { + return nullptr; } CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { @@ -1619,8 +1619,8 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { } CXFA_Node* pItemNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Items); - if (pItemNode == NULL) { - return NULL; + if (!pItemNode) { + return nullptr; } CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pNode) { @@ -1635,7 +1635,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { } pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); } - return NULL; + return nullptr; } CXFA_Para CXFA_TextProvider::GetParaNode() { if (m_eType == XFA_TEXTPROVIDERTYPE_Text) { @@ -1674,8 +1674,8 @@ FX_BOOL CXFA_TextProvider::GetEmbbedObj(FX_BOOL bURI, CXFA_Node* pWidgetNode = m_pWidgetAcc->GetNode(); CXFA_Node* pParent = pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent); CXFA_Document* pDocument = pWidgetNode->GetDocument(); - CXFA_Node* pIDNode = NULL; - CXFA_WidgetAcc* pEmbAcc = NULL; + CXFA_Node* pIDNode = nullptr; + CXFA_WidgetAcc* pEmbAcc = nullptr; if (pParent) { pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC()); } diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.h b/xfa/fxfa/app/xfa_ffwidgetacc.h index 5f7aec72d9..9261d41ee7 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.h +++ b/xfa/fxfa/app/xfa_ffwidgetacc.h @@ -21,7 +21,7 @@ class CXFA_TextProvider { public: CXFA_TextProvider(CXFA_WidgetAcc* pWidgetAcc, XFA_TEXTPROVIDERTYPE eType, - CXFA_Node* pTextNode = NULL) + CXFA_Node* pTextNode = nullptr) : m_pWidgetAcc(pWidgetAcc), m_eType(eType), m_pTextNode(pTextNode) { ASSERT(m_pWidgetAcc); } diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index 5221c7cd6d..aaaf07ad66 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -481,7 +481,7 @@ 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 ? pParent->GetTemplateNode() : NULL; + CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr; CXFA_Node* pNewFormItem = pTemplateParent->CloneTemplateToForm(FALSE); if (pParent) pParent->InsertChild(pNewFormItem, pBefore); @@ -491,10 +491,10 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_Element eElement, CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_Element eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : NULL; + CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr; CXFA_Node* pNewNode = CreateTemplateNode(eElement, pTemplateParent, - pBefore ? pBefore->GetTemplateNode() : NULL) + pBefore ? pBefore->GetTemplateNode() : nullptr) ->Clone(FALSE); if (pParent) pParent->InsertChild(pNewNode, pBefore); diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 67f96c4e18..5bb4ccb816 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1722,7 +1722,7 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName( int32_t iStart = 0; int32_t iEnd = sizeof(g_XFAFontsMap) / sizeof(XFA_FONTINFO) - 1; int32_t iMid = 0; - const XFA_FONTINFO* pFontInfo = NULL; + const XFA_FONTINFO* pFontInfo = nullptr; do { iMid = (iStart + iEnd) / 2; uint32_t dwFontNameHash = g_XFAFontsMap[iMid].dwFontNameHash; @@ -1798,9 +1798,11 @@ CFGAS_GEFont* CXFA_DefFontMgr::GetDefaultFont( IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); CFGAS_GEFont* pFont = pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); - if (!pFont) - pFont = - pFDEFontMgr->LoadFont((const FX_WCHAR*)NULL, dwFontStyles, wCodePage); + if (!pFont) { + pFont = pFDEFontMgr->LoadFont((const FX_WCHAR*)nullptr, dwFontStyles, + wCodePage); + } + ASSERT(pFont); if (pFont) { m_CacheFonts.Add(pFont); @@ -1834,17 +1836,17 @@ CFGAS_GEFont* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, CPDF_Font** pDstPDFFont, FX_BOOL bStrictMatch) { CPDF_Document* pDoc = m_pDoc->GetPDFDoc(); - if (pDoc == NULL) { - return NULL; + if (!pDoc) { + return nullptr; } CPDF_Dictionary* pFontSetDict = pDoc->GetRoot()->GetDictBy("AcroForm")->GetDictBy("DR"); if (!pFontSetDict) { - return NULL; + return nullptr; } pFontSetDict = pFontSetDict->GetDictBy("Font"); if (!pFontSetDict) { - return NULL; + return nullptr; } strPsName.Remove(' '); IFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr(); @@ -1857,19 +1859,19 @@ CFGAS_GEFont* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, } CPDF_Dictionary* pFontDict = ToDictionary(pObj->GetDirect()); if (!pFontDict || pFontDict->GetStringBy("Type") != "Font") { - return NULL; + return nullptr; } CPDF_Font* pPDFFont = pDoc->LoadFont(pFontDict); if (!pPDFFont) { - return NULL; + return nullptr; } if (!pPDFFont->IsEmbedded()) { *pDstPDFFont = pPDFFont; - return NULL; + return nullptr; } return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr); } - return NULL; + return nullptr; } CFGAS_GEFont* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 0706988de8..41d8fecb36 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -46,7 +46,7 @@ CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget) { CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) : m_pApp(pApp) { m_dwCapacity = 0; m_fCapacity = 0; - m_pCalendarFont = NULL; + m_pCalendarFont = nullptr; m_Rect.Set(0, 0, 0, 0); m_pCheckBoxTP = new CXFA_FWLCheckBoxTP; m_pListBoxTP = new CFWL_ListBoxTP; @@ -85,14 +85,14 @@ FWL_Error CXFA_FWLTheme::Initialize() { if (!m_pCalendarFont) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetDefFontByCodePage( - FX_CODEPAGE_MSWin_WesternEuropean, 0, NULL); + FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr); #else m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage( - FX_CODEPAGE_MSWin_WesternEuropean, 0, NULL); + FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr); #endif } - ASSERT(NULL != m_pCalendarFont); + ASSERT(m_pCalendarFont); FWLTHEME_Init(); return FWL_Error::Succeeded; } @@ -246,11 +246,11 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, m_Rect.width += para.GetMarginRight(); } } - if (pItem->GetPrev() == NULL) { + if (!pItem->GetPrev()) { if (pItem->GetNext()) { m_Rect.height = 0; } - } else if (pItem->GetNext() == NULL) { + } else if (!pItem->GetNext()) { m_Rect.top = 0; } else { m_Rect.top = 0; diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 8b2871e03c..6643d92856 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -119,9 +119,9 @@ CXFA_LoaderContext::CXFA_LoaderContext() m_fStartLineOffset(0), m_iChar(0), m_iTotalLines(-1), - m_pXMLNode(NULL), - m_pNode(NULL), - m_pParentStyle(NULL), + m_pXMLNode(nullptr), + m_pNode(nullptr), + m_pParentStyle(nullptr), m_dwFlags(0) {} CXFA_LoaderContext::~CXFA_LoaderContext() {} @@ -143,7 +143,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( CXFA_TextProvider* pTextProvider) { CXFA_Font font = pTextProvider->GetFontNode(); CXFA_Para para = pTextProvider->GetParaNode(); - IFDE_CSSComputedStyle* pStyle = m_pSelector->CreateComputedStyle(NULL); + IFDE_CSSComputedStyle* pStyle = m_pSelector->CreateComputedStyle(nullptr); IFDE_CSSFontStyle* pFontStyle = pStyle->GetFontStyles(); IFDE_CSSParagraphStyle* pParaStyle = pStyle->GetParagraphStyles(); FX_FLOAT fLineHeight = 0, fFontSize = 10; @@ -248,7 +248,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle( } void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider) { - if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator) { + if (!pXMLContainer || !pTextProvider || m_pAllocator) { return; } m_pAllocator.reset(IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, 32, @@ -268,7 +268,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode, if (!tagProvider.m_bTagAvailable) return; - IFDE_CSSComputedStyle* pNewStyle = NULL; + IFDE_CSSComputedStyle* pNewStyle = nullptr; if ((tagProvider.GetTagName() != FX_WSTRC(L"body")) || (tagProvider.GetTagName() != FX_WSTRC(L"html"))) { CXFA_TextParseContext* pTextContext = @@ -545,7 +545,7 @@ FX_BOOL CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFDE_XMLNode* pXMLNode, CFX_WideString& wsValue) { wsValue.clear(); - if (pXMLNode == NULL) { + if (!pXMLNode) { return FALSE; } FX_BOOL bRet = FALSE; @@ -602,7 +602,7 @@ enum XFA_TABSTOPSSTATUS { FX_BOOL CXFA_TextParser::GetTabstops( IFDE_CSSComputedStyle* pStyle, CXFA_TextTabstopsContext* pTabstopContext) { - if (pStyle == NULL || pTabstopContext == NULL) { + if (!pStyle || !pTabstopContext) { return FALSE; } CFX_WideString wsValue; @@ -716,7 +716,7 @@ const CXFA_PieceLineArray* CXFA_TextLayout::GetPieceLines() { return &m_pieceLines; } void CXFA_TextLayout::GetTextDataNode() { - if (m_pTextProvider == NULL) { + if (!m_pTextProvider) { return; } CXFA_Node* pNode = m_pTextProvider->GetTextNode(m_bRichText); @@ -726,7 +726,7 @@ void CXFA_TextLayout::GetTextDataNode() { m_pTextDataNode = pNode; } CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() { - CFDE_XMLNode* pXMLContainer = NULL; + CFDE_XMLNode* pXMLContainer = nullptr; if (m_bRichText) { CFDE_XMLNode* pXMLRoot = m_pTextDataNode->GetXMLMappingNode(); if (!pXMLRoot) { @@ -758,8 +758,8 @@ CFX_RTFBreak* CXFA_TextLayout::CreateBreak(FX_BOOL bDefault) { pBreak->SetLayoutStyles(dwStyle); pBreak->SetLineBreakChar(L'\n'); pBreak->SetLineBreakTolerance(1); - pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, NULL)); - pBreak->SetFontSize(m_textParser.GetFontSize(m_pTextProvider, NULL)); + pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, nullptr)); + pBreak->SetFontSize(m_textParser.GetFontSize(m_pTextProvider, nullptr)); return pBreak; } void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) { @@ -808,9 +808,9 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) { m_pBreak->SetVerticalScale((int32_t)font.GetVerticalScale()); m_pBreak->SetCharSpace(font.GetLetterSpacing()); } - FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, NULL); + FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, nullptr); m_pBreak->SetFontSize(fFontSize); - m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, NULL)); + m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, nullptr)); m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f); } void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle, @@ -818,7 +818,7 @@ void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle, FX_FLOAT fLineWidth, CFDE_XMLNode* pXMLNode, IFDE_CSSComputedStyle* pParentStyle) { - if (pStyle == NULL) { + if (!pStyle) { InitBreak(fLineWidth); return; } @@ -908,7 +908,7 @@ int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) { return wsText.GetLength(); } FX_FLOAT CXFA_TextLayout::GetLayoutHeight() { - if (m_pLoader == NULL) { + if (!m_pLoader) { return 0; } int32_t iCount = m_pLoader->m_lineHeights.GetSize(); @@ -957,7 +957,7 @@ FX_BOOL CXFA_TextLayout::DoLayout(int32_t iBlockIndex, FX_FLOAT& fCalcHeight, FX_FLOAT fContentAreaHeight, FX_FLOAT fTextHeight) { - if (m_pLoader == NULL) { + if (!m_pLoader) { return FALSE; } int32_t iBlockCount = m_Blocks.GetSize(); @@ -1051,7 +1051,7 @@ FX_BOOL CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, m_fMaxWidth = 0; Loader(defaultSize, fLinePos, FALSE); if (fLinePos < 0.1f) - fLinePos = m_textParser.GetFontSize(m_pTextProvider, NULL); + fLinePos = m_textParser.GetFontSize(m_pTextProvider, nullptr); m_pTabstopContext.reset(); defaultSize = CFX_SizeF(m_fMaxWidth, fLinePos); @@ -1079,7 +1079,7 @@ FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { } FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { - if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks()) + if (!m_pLoader || iBlock < 0 || iBlock >= CountBlocks()) return FALSE; if (m_pLoader->m_fWidth < 1) return FALSE; @@ -1087,7 +1087,7 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { m_pLoader->m_iTotalLines = -1; m_iLines = 0; FX_FLOAT fLinePos = 0; - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; CFX_SizeF szText(m_pLoader->m_fWidth, m_pLoader->m_fHeight); int32_t iCount = m_Blocks.GetSize(); int32_t iBlocksHeightCount = m_pLoader->m_BlocksHeight.GetSize(); @@ -1133,7 +1133,7 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { if (pXMLNode == pContainerNode) break; if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, - TRUE, NULL, FALSE)) { + TRUE, nullptr, FALSE)) { break; } pSaveXMLNode = pXMLNode; @@ -1222,7 +1222,7 @@ FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, Layout(i); } } - FXTEXT_CHARPOS* pCharPos = NULL; + FXTEXT_CHARPOS* pCharPos = nullptr; int32_t iCharCount = 0; int32_t iLineStart = 0; int32_t iPieceLines = m_pieceLines.GetSize(); @@ -1356,7 +1356,7 @@ FX_BOOL CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode, FX_BOOL bEndBreak, FX_BOOL bIsOl, int32_t iLiCount) { - if (pXMLNode == NULL) { + if (!pXMLNode) { return FALSE; } CXFA_TextParseContext* pContext = @@ -1364,12 +1364,12 @@ FX_BOOL CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode, FDE_CSSDISPLAY eDisplay = FDE_CSSDISPLAY_None; FX_BOOL bContentNode = FALSE; FX_FLOAT fSpaceBelow = 0; - IFDE_CSSComputedStyle* pStyle = NULL; + IFDE_CSSComputedStyle* pStyle = nullptr; CFX_WideString wsName; if (bEndBreak) { FX_BOOL bCurOl = FALSE; FX_BOOL bCurLi = FALSE; - CFDE_XMLElement* pElement = NULL; + CFDE_XMLElement* pElement = nullptr; if (pContext) { if (m_bBlockContinue || (m_pLoader && pXMLNode == m_pLoader->m_pXMLNode)) { @@ -1465,7 +1465,7 @@ FX_BOOL CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode, } } if (wsText.GetLength() > 0) { - if (m_pLoader == NULL || m_pLoader->m_iChar == 0) { + if (!m_pLoader || m_pLoader->m_iChar == 0) { if (pLinkData) { pLinkData->Retain(); } @@ -1629,10 +1629,10 @@ void CXFA_TextLayout::EndBreak(uint32_t dwStatus, } void CXFA_TextLayout::DoTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine) { - if (m_pTabstopContext == NULL || m_pTabstopContext->m_iTabCount == 0) { + if (!m_pTabstopContext || m_pTabstopContext->m_iTabCount == 0) { return; } - if (pStyle == NULL || pPieceLine == NULL) { + if (!pStyle || !pPieceLine) { return; } int32_t iPieces = pPieceLine->m_textPieces.GetSize(); @@ -1691,7 +1691,7 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus, if (iPieces < 1) { return; } - IFDE_CSSComputedStyle* pStyle = NULL; + IFDE_CSSComputedStyle* pStyle = nullptr; if (bSavePieces) { CXFA_PieceLine* pPieceLine = FXTARGET_NewWith(m_pAllocator.get()) CXFA_PieceLine; @@ -1748,7 +1748,7 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus, pUserData->m_pLinkData->Retain(); pTP->pLinkData = pUserData->m_pLinkData; } else { - pTP->pLinkData = NULL; + pTP->pLinkData = nullptr; } DoTabstops(pStyle, pPieceLine); } @@ -1958,7 +1958,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, int32_t CXFA_TextLayout::GetDisplayPos(const XFA_TextPiece* pPiece, FXTEXT_CHARPOS* pCharPos, FX_BOOL bCharCode) { - if (pPiece == NULL) { + if (!pPiece) { return 0; } FX_RTFTEXTOBJ tr; diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index 00e7209e97..33dc345e30 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -266,7 +266,7 @@ class CXFA_TextLayout { FX_BOOL CalcSize(const CFX_SizeF& minSize, const CFX_SizeF& maxSize, CFX_SizeF& defaultSize); - FX_BOOL Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = NULL); + FX_BOOL Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = nullptr); void ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex); FX_BOOL DrawString(CFX_RenderDevice* pFxDevice, const CFX_Matrix& tmDoc2Device, @@ -288,7 +288,7 @@ class CXFA_TextLayout { FDE_CSSDISPLAY eDisplay, FX_FLOAT fLineWidth, CFDE_XMLNode* pXMLNode, - IFDE_CSSComputedStyle* pParentStyle = NULL); + IFDE_CSSComputedStyle* pParentStyle = nullptr); FX_BOOL Loader(const CFX_SizeF& szText, FX_FLOAT& fLinePos, FX_BOOL bSavePieces = TRUE); @@ -301,7 +301,7 @@ class CXFA_TextLayout { FX_FLOAT& fLinePos, IFDE_CSSComputedStyle* pParentStyle, FX_BOOL bSavePieces, - CXFA_LinkUserData* pLinkData = NULL, + CXFA_LinkUserData* pLinkData = nullptr, FX_BOOL bEndBreak = TRUE, FX_BOOL bIsOl = FALSE, int32_t iLiCount = 0); |