From 85d1f2c2f9f1e746bedb1b6f03576613f54fbc27 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 23 Jun 2016 12:40:16 -0700 Subject: 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 --- xfa/fde/css/fde_cssdatatable.cpp | 2 +- xfa/fde/css/fde_cssstylesheet.cpp | 3 +- xfa/fde/fde_gedevice.cpp | 6 +- xfa/fgas/crt/fgas_codepage.cpp | 12 +- xfa/fgas/crt/fgas_stream.cpp | 164 ++++++------- xfa/fgas/crt/fgas_stream.h | 2 +- xfa/fgas/crt/fgas_system.cpp | 4 +- xfa/fgas/crt/fgas_system.h | 2 +- xfa/fgas/crt/fgas_utils.cpp | 24 +- xfa/fgas/crt/fgas_utils.h | 4 +- xfa/fgas/font/fgas_font.h | 26 +-- xfa/fgas/font/fgas_fontutils.cpp | 2 +- xfa/fgas/font/fgas_gefont.cpp | 82 +++---- xfa/fgas/font/fgas_stdfontmgr.cpp | 104 ++++----- xfa/fgas/font/fgas_stdfontmgr.h | 38 ++-- xfa/fgas/layout/fgas_rtfbreak.cpp | 82 +++---- xfa/fgas/layout/fgas_rtfbreak.h | 20 +- xfa/fgas/layout/fgas_textbreak.cpp | 87 ++++--- xfa/fgas/layout/fgas_textbreak.h | 10 +- xfa/fgas/localization/fgas_datetime.cpp | 4 +- xfa/fgas/localization/fgas_locale.cpp | 20 +- xfa/fwl/basewidget/cfx_barcode.cpp | 18 +- xfa/fwl/basewidget/fwl_caretimp.h | 2 +- xfa/fwl/basewidget/fwl_checkboximp.cpp | 2 +- xfa/fwl/basewidget/fwl_checkboximp.h | 2 +- xfa/fwl/basewidget/fwl_comboboximp.cpp | 36 +-- xfa/fwl/basewidget/fwl_comboboximp.h | 6 +- xfa/fwl/basewidget/fwl_datetimepickerimp.cpp | 13 +- xfa/fwl/basewidget/fwl_datetimepickerimp.h | 4 +- xfa/fwl/basewidget/fwl_editimp.cpp | 12 +- xfa/fwl/basewidget/fwl_editimp.h | 12 +- xfa/fwl/basewidget/fwl_formproxyimp.cpp | 2 +- xfa/fwl/basewidget/fwl_listboximp.cpp | 24 +- xfa/fwl/basewidget/fwl_listboximp.h | 8 +- xfa/fwl/basewidget/fwl_monthcalendarimp.cpp | 2 +- xfa/fwl/basewidget/fwl_monthcalendarimp.h | 2 +- xfa/fwl/basewidget/fwl_pictureboximp.h | 4 +- xfa/fwl/basewidget/fwl_pushbuttonimp.cpp | 4 +- xfa/fwl/basewidget/fwl_pushbuttonimp.h | 2 +- xfa/fwl/basewidget/fwl_scrollbarimp.h | 8 +- xfa/fwl/basewidget/fwl_spinbuttonimp.h | 2 +- xfa/fwl/basewidget/fwl_tooltipctrlimp.h | 2 +- xfa/fwl/core/cfwl_themetext.h | 2 +- xfa/fwl/core/cfwl_widgetmgr.cpp | 32 +-- xfa/fwl/core/cfwl_widgetmgr.h | 5 +- xfa/fwl/core/fwl_appimp.cpp | 2 +- xfa/fwl/core/fwl_formimp.cpp | 12 +- xfa/fwl/core/fwl_formimp.h | 6 +- xfa/fwl/core/fwl_noteimp.cpp | 54 ++--- xfa/fwl/core/fwl_widgetimp.cpp | 16 +- xfa/fwl/core/fwl_widgetimp.h | 14 +- xfa/fwl/core/ifwl_widget.h | 2 +- xfa/fwl/lightwidget/cfwl_barcode.h | 2 +- xfa/fwl/lightwidget/cfwl_checkbox.h | 2 +- xfa/fwl/lightwidget/cfwl_combobox.cpp | 12 +- xfa/fwl/lightwidget/cfwl_combobox.h | 2 +- xfa/fwl/lightwidget/cfwl_datetimepicker.h | 2 +- xfa/fwl/lightwidget/cfwl_edit.h | 2 +- xfa/fwl/lightwidget/cfwl_listbox.cpp | 22 +- xfa/fwl/lightwidget/cfwl_listbox.h | 2 +- xfa/fwl/lightwidget/cfwl_picturebox.h | 2 +- xfa/fwl/lightwidget/cfwl_pushbutton.h | 4 +- xfa/fwl/lightwidget/cfwl_widget.h | 8 +- xfa/fwl/theme/cfwl_carettp.h | 2 +- xfa/fwl/theme/cfwl_checkboxtp.h | 20 +- xfa/fwl/theme/cfwl_listboxtp.h | 4 +- xfa/fwl/theme/cfwl_scrollbartp.h | 8 +- xfa/fwl/theme/cfwl_widgettp.cpp | 14 +- xfa/fwl/theme/cfwl_widgettp.h | 28 +-- xfa/fxfa/app/xfa_checksum.cpp | 12 +- xfa/fxfa/app/xfa_ffapp.cpp | 26 +-- xfa/fxfa/app/xfa_ffbarcode.cpp | 2 +- xfa/fxfa/app/xfa_ffcheckbutton.cpp | 2 +- xfa/fxfa/app/xfa_ffcheckbutton.h | 2 +- xfa/fxfa/app/xfa_ffchoicelist.cpp | 6 +- xfa/fxfa/app/xfa_ffchoicelist.h | 4 +- xfa/fxfa/app/xfa_ffdocview.cpp | 63 +++-- xfa/fxfa/app/xfa_fffield.cpp | 24 +- xfa/fxfa/app/xfa_fffield.h | 4 +- xfa/fxfa/app/xfa_ffimage.cpp | 4 +- xfa/fxfa/app/xfa_ffimageedit.cpp | 6 +- xfa/fxfa/app/xfa_ffimageedit.h | 2 +- xfa/fxfa/app/xfa_ffnotify.cpp | 8 +- xfa/fxfa/app/xfa_ffnotify.h | 4 +- xfa/fxfa/app/xfa_ffpageview.cpp | 34 +-- xfa/fxfa/app/xfa_ffpushbutton.cpp | 14 +- xfa/fxfa/app/xfa_ffpushbutton.h | 4 +- xfa/fxfa/app/xfa_fftext.cpp | 24 +- xfa/fxfa/app/xfa_fftextedit.cpp | 8 +- xfa/fxfa/app/xfa_fftextedit.h | 2 +- xfa/fxfa/app/xfa_ffwidget.cpp | 42 ++-- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 38 ++-- xfa/fxfa/app/xfa_ffwidgetacc.h | 2 +- xfa/fxfa/app/xfa_ffwidgethandler.cpp | 6 +- xfa/fxfa/app/xfa_fontmgr.cpp | 26 ++- xfa/fxfa/app/xfa_fwltheme.cpp | 12 +- xfa/fxfa/app/xfa_textlayout.cpp | 62 ++--- xfa/fxfa/app/xfa_textlayout.h | 6 +- xfa/fxfa/fm2js/xfa_fmparse.cpp | 10 +- xfa/fxfa/include/fxfa.h | 2 +- xfa/fxfa/include/fxfa_widget.h | 2 +- xfa/fxfa/include/xfa_ffdoc.h | 2 +- xfa/fxfa/include/xfa_ffwidget.h | 4 +- xfa/fxfa/include/xfa_ffwidgethandler.h | 4 +- xfa/fxfa/include/xfa_rendercontext.h | 2 +- xfa/fxfa/parser/cxfa_box.cpp | 8 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 41 ++-- xfa/fxfa/parser/xfa_basic_data.cpp | 191 ++++++++-------- xfa/fxfa/parser/xfa_basic_imp.cpp | 39 ++-- xfa/fxfa/parser/xfa_basic_imp.h | 2 +- .../parser/xfa_document_datadescription_imp.cpp | 4 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 70 +++--- xfa/fxfa/parser/xfa_document_datamerger_imp.h | 2 +- xfa/fxfa/parser/xfa_document_imp.cpp | 35 ++- xfa/fxfa/parser/xfa_document_layout_imp.cpp | 24 +- xfa/fxfa/parser/xfa_document_layout_imp.h | 2 +- xfa/fxfa/parser/xfa_document_serialize.cpp | 4 +- xfa/fxfa/parser/xfa_document_serialize.h | 2 +- xfa/fxfa/parser/xfa_layout_appadapter.h | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 131 ++++++----- xfa/fxfa/parser/xfa_layout_itemlayout.h | 18 +- xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 253 +++++++++++---------- xfa/fxfa/parser/xfa_layout_pagemgr_new.h | 33 +-- xfa/fxfa/parser/xfa_locale.cpp | 10 +- xfa/fxfa/parser/xfa_localemgr.cpp | 27 +-- xfa/fxfa/parser/xfa_localevalue.cpp | 4 +- xfa/fxfa/parser/xfa_localevalue.h | 6 +- xfa/fxfa/parser/xfa_object.h | 29 +-- xfa/fxfa/parser/xfa_object_imp.cpp | 6 +- xfa/fxfa/parser/xfa_parser.h | 4 +- xfa/fxfa/parser/xfa_parser_imp.cpp | 101 ++++---- xfa/fxfa/parser/xfa_parser_imp.h | 8 +- xfa/fxfa/parser/xfa_script.h | 2 +- xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 8 +- xfa/fxfa/parser/xfa_script_imp.cpp | 2 +- xfa/fxfa/parser/xfa_script_imp.h | 4 +- xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 12 +- xfa/fxfa/parser/xfa_script_nodehelper.cpp | 32 +-- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 18 +- xfa/fxfa/parser/xfa_script_resolveprocessor.h | 2 +- .../parser/xfa_script_signaturepseudomodel.cpp | 6 +- xfa/fxfa/parser/xfa_utils.h | 21 +- xfa/fxfa/parser/xfa_utils_imp.cpp | 6 +- xfa/fxgraphics/include/cfx_graphics.h | 14 +- 144 files changed, 1384 insertions(+), 1420 deletions(-) diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index c2767e7eb2..9bccd32602 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -921,7 +921,7 @@ CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue) : m_eType(eType), m_pString(pValue) { - ASSERT(m_pString != nullptr); + ASSERT(m_pString); } CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction) diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index f0b071223f..87137c4259 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -377,7 +377,8 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::SkipRuleSet( } } -CFDE_CSSStyleRule::CFDE_CSSStyleRule() : m_ppSelector(NULL), m_iSelectors(0) {} +CFDE_CSSStyleRule::CFDE_CSSStyleRule() + : m_ppSelector(nullptr), m_iSelectors(0) {} int32_t CFDE_CSSStyleRule::CountSelectorLists() const { return m_iSelectors; diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp index ba72e7d014..e78ab8da4c 100644 --- a/xfa/fde/fde_gedevice.cpp +++ b/xfa/fde/fde_gedevice.cpp @@ -126,9 +126,9 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, } } FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; - CFGAS_GEFont* pCurFont = NULL; - CFGAS_GEFont* pSTFont = NULL; - FXTEXT_CHARPOS* pCurCP = NULL; + CFGAS_GEFont* pCurFont = nullptr; + CFGAS_GEFont* pSTFont = nullptr; + FXTEXT_CHARPOS* pCurCP = nullptr; int32_t iCurCount = 0; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fgas/crt/fgas_codepage.cpp b/xfa/fgas/crt/fgas_codepage.cpp index 2087cac138..834056eddd 100644 --- a/xfa/fgas/crt/fgas_codepage.cpp +++ b/xfa/fgas/crt/fgas_codepage.cpp @@ -272,7 +272,7 @@ const FX_STR2CPHASH g_FXCPHashTable[] = { }; uint16_t GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) { - ASSERT(pStr != NULL); + ASSERT(pStr); if (iLength < 0) { iLength = FXSYS_strlen(pStr); } @@ -370,7 +370,7 @@ uint16_t FX_GetCodePageFromStringW(const FX_WCHAR* pStr, int32_t iLength) { } void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength) { - ASSERT(pStr != NULL); + ASSERT(pStr); if (iLength < 0) { iLength = FXSYS_wcslen(pStr); } @@ -392,7 +392,7 @@ void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength) { } void FX_UTF16ToWChar(void* pBuffer, int32_t iLength) { - ASSERT(pBuffer != NULL && iLength > 0); + ASSERT(pBuffer && iLength > 0); if (sizeof(FX_WCHAR) == 2) { return; } @@ -404,7 +404,7 @@ void FX_UTF16ToWChar(void* pBuffer, int32_t iLength) { } void FX_WCharToUTF16(void* pBuffer, int32_t iLength) { - ASSERT(pBuffer != NULL && iLength > 0); + ASSERT(pBuffer && iLength > 0); if (sizeof(FX_WCHAR) == 2) { return; } @@ -430,7 +430,7 @@ int32_t FX_UTF8Decode(const FX_CHAR* pSrc, int32_t* pSrcLen, FX_WCHAR* pDst, int32_t* pDstLen) { - if (pSrcLen == NULL || pDstLen == NULL) { + if (!pSrcLen || !pDstLen) { return -1; } int32_t iSrcLen = *pSrcLen; @@ -439,7 +439,7 @@ int32_t FX_UTF8Decode(const FX_CHAR* pSrc, return 1; } int32_t iDstLen = *pDstLen; - FX_BOOL bValidDst = (pDst != NULL && iDstLen > 0); + FX_BOOL bValidDst = (pDst && iDstLen > 0); uint32_t dwCode = 0; int32_t iPending = 0; int32_t iSrcNum = 0, iDstNum = 0; diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index 458cf5edad..dd54fbed28 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -228,7 +228,7 @@ class CFX_Stream : public IFX_Stream { int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS, - int32_t const* pByteSize = NULL) override; + int32_t const* pByteSize = nullptr) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; void Flush() override; @@ -268,7 +268,7 @@ class CFX_TextStream : public IFX_Stream { int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS, - int32_t const* pByteSize = NULL) override; + int32_t const* pByteSize = nullptr) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; void Flush() override; @@ -308,7 +308,7 @@ class CFGAS_FileRead : public IFX_FileRead { }; int32_t FileLength(FXSYS_FILE* file) { - ASSERT(file != NULL); + ASSERT(file); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ return _filelength(_fileno(file)); #else @@ -321,7 +321,7 @@ int32_t FileLength(FXSYS_FILE* file) { } FX_BOOL FileSetSize(FXSYS_FILE* file, int32_t size) { - ASSERT(file != NULL); + ASSERT(file); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ return _chsize(_fileno(file), size) == 0; #elif _FX_OS_ == _FX_WIN32_MOBILE_ @@ -346,7 +346,7 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_BufferRead* pBufferRead, if (!pSR->LoadBufferRead(pBufferRead, iFileSize, dwAccess, bReleaseBufferRead)) { pSR->Release(); - return NULL; + return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { return new CFX_TextStream(pSR, TRUE); @@ -358,7 +358,7 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_FileRead* pFileRead, CFX_Stream* pSR = new CFX_Stream; if (!pSR->LoadFileRead(pFileRead, dwAccess)) { pSR->Release(); - return NULL; + return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { return new CFX_TextStream(pSR, TRUE); @@ -370,7 +370,7 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_FileWrite* pFileWrite, CFX_Stream* pSR = new CFX_Stream; if (!pSR->LoadFileWrite(pFileWrite, dwAccess)) { pSR->Release(); - return NULL; + return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { return new CFX_TextStream(pSR, TRUE); @@ -382,7 +382,7 @@ IFX_Stream* IFX_Stream::CreateStream(const FX_WCHAR* pszFileName, CFX_Stream* pSR = new CFX_Stream; if (!pSR->LoadFile(pszFileName, dwAccess)) { pSR->Release(); - return NULL; + return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { return new CFX_TextStream(pSR, TRUE); @@ -395,7 +395,7 @@ IFX_Stream* IFX_Stream::CreateStream(uint8_t* pData, CFX_Stream* pSR = new CFX_Stream; if (!pSR->LoadBuffer(pData, length, dwAccess)) { pSR->Release(); - return NULL; + return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { return new CFX_TextStream(pSR, TRUE); @@ -414,8 +414,8 @@ CFX_FileStreamImp::~CFX_FileStreamImp() { FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess) { - ASSERT(m_hFile == NULL); - ASSERT(pszSrcFileName != NULL && FXSYS_wcslen(pszSrcFileName) > 0); + ASSERT(!m_hFile); + ASSERT(pszSrcFileName && FXSYS_wcslen(pszSrcFileName) > 0); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ _FX_OS_ == _FX_WIN64_ const FX_WCHAR* wsMode; @@ -462,14 +462,14 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, } CFX_ByteString szFileName = CFX_ByteString::FromUnicode(pszSrcFileName); m_hFile = FXSYS_fopen(szFileName.c_str(), wsMode); - if (m_hFile == NULL) { + if (!m_hFile) { if (dwAccess & FX_STREAMACCESS_Write) { if (dwAccess & FX_STREAMACCESS_Create) { m_hFile = FXSYS_fopen(szFileName.c_str(), "w+b"); } - if (m_hFile == NULL) { + if (!m_hFile) { m_hFile = FXSYS_fopen(szFileName.c_str(), "r+b"); - if (m_hFile == NULL) { + if (!m_hFile) { return FALSE; } if (dwAccess & FX_STREAMACCESS_Truncate) { @@ -491,32 +491,32 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, return TRUE; } int32_t CFX_FileStreamImp::GetLength() const { - ASSERT(m_hFile != NULL); + ASSERT(m_hFile); return m_iLength; } int32_t CFX_FileStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { - ASSERT(m_hFile != NULL); + ASSERT(m_hFile); FXSYS_fseek(m_hFile, iOffset, eSeek); return FXSYS_ftell(m_hFile); } int32_t CFX_FileStreamImp::GetPosition() { - ASSERT(m_hFile != NULL); + ASSERT(m_hFile); return FXSYS_ftell(m_hFile); } FX_BOOL CFX_FileStreamImp::IsEOF() const { - ASSERT(m_hFile != NULL); + ASSERT(m_hFile); return FXSYS_ftell(m_hFile) >= m_iLength; } int32_t CFX_FileStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { - ASSERT(m_hFile != NULL); - ASSERT(pBuffer != NULL && iBufferSize > 0); + ASSERT(m_hFile); + ASSERT(pBuffer && iBufferSize > 0); return FXSYS_fread(pBuffer, 1, iBufferSize, m_hFile); } int32_t CFX_FileStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS) { - ASSERT(m_hFile != NULL); - ASSERT(pStr != NULL && iMaxLength > 0); + ASSERT(m_hFile); + ASSERT(pStr && iMaxLength > 0); if (m_iLength <= 0) { return 0; } @@ -573,10 +573,10 @@ FX_BOOL CFX_FileStreamImp::SetLength(int32_t iLength) { return bRet; } CFX_FileReadStreamImp::CFX_FileReadStreamImp() - : m_pFileRead(NULL), m_iPosition(0), m_iLength(0) {} + : m_pFileRead(nullptr), m_iPosition(0), m_iLength(0) {} FX_BOOL CFX_FileReadStreamImp::LoadFileRead(IFX_FileRead* pFileRead, uint32_t dwAccess) { - ASSERT(m_pFileRead == NULL && pFileRead != NULL); + ASSERT(!m_pFileRead && pFileRead); if (dwAccess & FX_STREAMACCESS_Write) { return FALSE; } @@ -610,8 +610,8 @@ FX_BOOL CFX_FileReadStreamImp::IsEOF() const { return m_iPosition >= m_iLength; } int32_t CFX_FileReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { - ASSERT(m_pFileRead != NULL); - ASSERT(pBuffer != NULL && iBufferSize > 0); + ASSERT(m_pFileRead); + ASSERT(pBuffer && iBufferSize > 0); if (iBufferSize > m_iLength - m_iPosition) { iBufferSize = m_iLength - m_iPosition; } @@ -624,8 +624,8 @@ int32_t CFX_FileReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { int32_t CFX_FileReadStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS) { - ASSERT(m_pFileRead != NULL); - ASSERT(pStr != NULL && iMaxLength > 0); + ASSERT(m_pFileRead); + ASSERT(pStr && iMaxLength > 0); iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2; if (iMaxLength <= 0) { return 0; @@ -638,12 +638,12 @@ int32_t CFX_FileReadStreamImp::ReadString(FX_WCHAR* pStr, return i; } CFX_BufferReadStreamImp::CFX_BufferReadStreamImp() - : m_pBufferRead(NULL), + : m_pBufferRead(nullptr), m_bReleaseBufferRead(FALSE), m_iPosition(0), m_iBufferSize(0) {} CFX_BufferReadStreamImp::~CFX_BufferReadStreamImp() { - if (m_bReleaseBufferRead && m_pBufferRead != NULL) { + if (m_bReleaseBufferRead && m_pBufferRead) { m_pBufferRead->Release(); } } @@ -651,7 +651,7 @@ FX_BOOL CFX_BufferReadStreamImp::LoadBufferRead(IFX_BufferRead* pBufferRead, int32_t iFileSize, uint32_t dwAccess, FX_BOOL bReleaseBufferRead) { - ASSERT(m_pBufferRead == NULL && pBufferRead != NULL); + ASSERT(!m_pBufferRead && pBufferRead); if (dwAccess & FX_STREAMACCESS_Write) { return FALSE; } @@ -699,8 +699,8 @@ FX_BOOL CFX_BufferReadStreamImp::IsEOF() const { } int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { - ASSERT(m_pBufferRead != NULL); - ASSERT(pBuffer != NULL && iBufferSize > 0); + ASSERT(m_pBufferRead); + ASSERT(pBuffer && iBufferSize > 0); int32_t iLength = GetLength(); if (m_iPosition >= iLength) { return 0; @@ -754,8 +754,8 @@ int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer, int32_t CFX_BufferReadStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS) { - ASSERT(m_pBufferRead != NULL); - ASSERT(pStr != NULL && iMaxLength > 0); + ASSERT(m_pBufferRead); + ASSERT(pStr && iMaxLength > 0); iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2; if (iMaxLength <= 0) { return 0; @@ -768,10 +768,10 @@ int32_t CFX_BufferReadStreamImp::ReadString(FX_WCHAR* pStr, return i; } CFX_FileWriteStreamImp::CFX_FileWriteStreamImp() - : m_pFileWrite(NULL), m_iPosition(0) {} + : m_pFileWrite(nullptr), m_iPosition(0) {} FX_BOOL CFX_FileWriteStreamImp::LoadFileWrite(IFX_FileWrite* pFileWrite, uint32_t dwAccess) { - ASSERT(m_pFileWrite == NULL && pFileWrite != NULL); + ASSERT(!m_pFileWrite && pFileWrite); if (dwAccess & FX_STREAMACCESS_Read) { return FALSE; } @@ -844,11 +844,11 @@ FX_BOOL CFX_BufferStreamImp::LoadBuffer(uint8_t* pData, return TRUE; } int32_t CFX_BufferStreamImp::GetLength() const { - ASSERT(m_pData != NULL); + ASSERT(m_pData); return m_iLength; } int32_t CFX_BufferStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { - ASSERT(m_pData != NULL); + ASSERT(m_pData); if (eSeek == FX_STREAMSEEK_Begin) { m_iPosition = iOffset; } else if (eSeek == FX_STREAMSEEK_Current) { @@ -865,16 +865,16 @@ int32_t CFX_BufferStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { return m_iPosition; } int32_t CFX_BufferStreamImp::GetPosition() { - ASSERT(m_pData != NULL); + ASSERT(m_pData); return m_iPosition; } FX_BOOL CFX_BufferStreamImp::IsEOF() const { - ASSERT(m_pData != NULL); + ASSERT(m_pData); return m_iPosition >= m_iLength; } int32_t CFX_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { - ASSERT(m_pData != NULL); - ASSERT(pBuffer != NULL && iBufferSize > 0); + ASSERT(m_pData); + ASSERT(pBuffer && iBufferSize > 0); int32_t iLen = std::min(m_iLength - m_iPosition, iBufferSize); if (iLen <= 0) { return 0; @@ -886,8 +886,8 @@ int32_t CFX_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { int32_t CFX_BufferStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS) { - ASSERT(m_pData != NULL); - ASSERT(pStr != NULL && iMaxLength > 0); + ASSERT(m_pData); + ASSERT(pStr && iMaxLength > 0); int32_t iLen = std::min((m_iLength - m_iPosition) / 2, iMaxLength); if (iLen <= 0) { return 0; @@ -934,19 +934,19 @@ int32_t CFX_BufferStreamImp::WriteString(const FX_WCHAR* pStr, } IFX_Stream* IFX_Stream::CreateTextStream(IFX_Stream* pBaseStream, FX_BOOL bDeleteOnRelease) { - ASSERT(pBaseStream != NULL); + ASSERT(pBaseStream); return new CFX_TextStream(pBaseStream, bDeleteOnRelease); } CFX_TextStream::CFX_TextStream(IFX_Stream* pStream, FX_BOOL bDelStream) : m_wCodePage(FX_CODEPAGE_DefANSI), m_wBOMLength(0), m_dwBOM(0), - m_pBuf(NULL), + m_pBuf(nullptr), m_iBufSize(0), m_bDelStream(bDelStream), m_pStreamImp(pStream), m_iRefCount(1) { - ASSERT(m_pStreamImp != NULL); + ASSERT(m_pStreamImp); m_pStreamImp->Retain(); InitStream(); } @@ -955,7 +955,7 @@ CFX_TextStream::~CFX_TextStream() { if (m_bDelStream) { m_pStreamImp->Release(); } - if (m_pBuf != NULL) { + if (m_pBuf) { FX_Free(m_pBuf); } } @@ -1048,8 +1048,8 @@ IFX_Stream* CFX_TextStream::CreateSharedStream(uint32_t dwAccess, int32_t iLength) { IFX_Stream* pSR = m_pStreamImp->CreateSharedStream(dwAccess, iOffset, iLength); - if (pSR == NULL) { - return NULL; + if (!pSR) { + return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { return new CFX_TextStream(pSR, TRUE); @@ -1075,14 +1075,14 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS, int32_t const* pByteSize) { - ASSERT(pStr != NULL && iMaxLength > 0); - if (m_pStreamImp == NULL) { + ASSERT(pStr && iMaxLength > 0); + if (!m_pStreamImp) { return -1; } int32_t iLen; if (m_wCodePage == FX_CODEPAGE_UTF16LE || m_wCodePage == FX_CODEPAGE_UTF16BE) { - int32_t iBytes = pByteSize == NULL ? iMaxLength * 2 : *pByteSize; + int32_t iBytes = pByteSize ? *pByteSize : iMaxLength * 2; iLen = m_pStreamImp->ReadData((uint8_t*)pStr, iBytes); iMaxLength = iLen / 2; if (sizeof(FX_WCHAR) > 2) { @@ -1099,10 +1099,10 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr, #endif } else { int32_t pos = m_pStreamImp->GetPosition(); - int32_t iBytes = pByteSize == NULL ? iMaxLength : *pByteSize; + int32_t iBytes = pByteSize ? *pByteSize : iMaxLength; iBytes = std::min(iBytes, m_pStreamImp->GetLength() - pos); if (iBytes > 0) { - if (m_pBuf == NULL) { + if (!m_pBuf) { m_pBuf = FX_Alloc(uint8_t, iBytes); m_iBufSize = iBytes; } else if (iBytes > m_iBufSize) { @@ -1125,7 +1125,7 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr, return iMaxLength; } int32_t CFX_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { - ASSERT(pStr != NULL && iLength > 0); + ASSERT(pStr && iLength > 0); if ((m_pStreamImp->GetAccessModes() & FX_STREAMACCESS_Write) == 0) { return -1; } @@ -1143,7 +1143,7 @@ int32_t CFX_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { } CFX_Stream::CFX_Stream() : m_eStreamType(FX_SREAMTYPE_Unknown), - m_pStreamImp(NULL), + m_pStreamImp(nullptr), m_dwAccess(0), m_iTotalSize(0), m_iPosition(0), @@ -1269,7 +1269,7 @@ uint32_t CFX_Stream::GetAccessModes() const { } int32_t CFX_Stream::GetLength() const { - if (m_pStreamImp == NULL) { + if (!m_pStreamImp) { return -1; } if (m_eStreamType == FX_STREAMTYPE_File || @@ -1279,7 +1279,7 @@ int32_t CFX_Stream::GetLength() const { return m_iLength; } int32_t CFX_Stream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { - if (m_pStreamImp == NULL) { + if (!m_pStreamImp) { return -1; } if (m_eStreamType == FX_STREAMTYPE_File || @@ -1304,7 +1304,7 @@ int32_t CFX_Stream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { return m_iPosition - m_iStart; } int32_t CFX_Stream::GetPosition() { - if (m_pStreamImp == NULL) { + if (!m_pStreamImp) { return -1; } if (m_eStreamType == FX_STREAMTYPE_File || @@ -1314,7 +1314,7 @@ int32_t CFX_Stream::GetPosition() { return m_iPosition - m_iStart; } FX_BOOL CFX_Stream::IsEOF() const { - if (m_pStreamImp == NULL) { + if (!m_pStreamImp) { return TRUE; } if (m_eStreamType == FX_STREAMTYPE_File || @@ -1324,8 +1324,8 @@ FX_BOOL CFX_Stream::IsEOF() const { return m_iPosition >= m_iStart + m_iLength; } int32_t CFX_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { - ASSERT(pBuffer != NULL && iBufferSize > 0); - if (m_pStreamImp == NULL) { + ASSERT(pBuffer && iBufferSize > 0); + if (!m_pStreamImp) { return -1; } int32_t iLen = std::min(m_iStart + m_iLength - m_iPosition, iBufferSize); @@ -1343,13 +1343,13 @@ int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS, int32_t const* pByteSize) { - ASSERT(pStr != NULL && iMaxLength > 0); - if (m_pStreamImp == NULL) { + ASSERT(pStr && iMaxLength > 0); + if (!m_pStreamImp) { return -1; } int32_t iEnd = m_iStart + m_iLength; int32_t iLen = iEnd - m_iPosition; - if (pByteSize != NULL) { + if (pByteSize) { iLen = std::min(iLen, *pByteSize); } iLen = std::min(iEnd / 2, iMaxLength); @@ -1368,8 +1368,8 @@ int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, } int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { - ASSERT(pBuffer != NULL && iBufferSize > 0); - if (m_pStreamImp == NULL) { + ASSERT(pBuffer && iBufferSize > 0); + if (!m_pStreamImp) { return -1; } if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) { @@ -1394,8 +1394,8 @@ int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { return iLen; } int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { - ASSERT(pStr != NULL && iLength > 0); - if (m_pStreamImp == NULL) { + ASSERT(pStr && iLength > 0); + if (!m_pStreamImp) { return -1; } if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) { @@ -1420,7 +1420,7 @@ int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { return iLen; } void CFX_Stream::Flush() { - if (m_pStreamImp == NULL) { + if (!m_pStreamImp) { return; } if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) { @@ -1429,7 +1429,7 @@ void CFX_Stream::Flush() { m_pStreamImp->Flush(); } FX_BOOL CFX_Stream::SetLength(int32_t iLength) { - if (m_pStreamImp == NULL) { + if (!m_pStreamImp) { return FALSE; } if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) { @@ -1438,7 +1438,7 @@ FX_BOOL CFX_Stream::SetLength(int32_t iLength) { return m_pStreamImp->SetLength(iLength); } int32_t CFX_Stream::GetBOM(uint8_t bom[4]) const { - if (m_pStreamImp == NULL) { + if (!m_pStreamImp) { return -1; } return 0; @@ -1461,25 +1461,25 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess, int32_t iOffset, int32_t iLength) { ASSERT(iLength > 0); - if (m_pStreamImp == NULL) { - return NULL; + if (!m_pStreamImp) { + return nullptr; } if ((m_dwAccess & FX_STREAMACCESS_Text) != 0 && (dwAccess & FX_STREAMACCESS_Text) == 0) { - return NULL; + return nullptr; } if ((m_dwAccess & FX_STREAMACCESS_Write) == 0 && (dwAccess & FX_STREAMACCESS_Write) != 0) { - return NULL; + return nullptr; } int32_t iStart = m_iStart + iOffset; int32_t iTotal = m_iStart + m_iLength; if (iStart < m_iStart || iStart >= iTotal) { - return NULL; + return nullptr; } int32_t iEnd = iStart + iLength; if (iEnd < iStart || iEnd > iTotal) { - return NULL; + return nullptr; } CFX_Stream* pShared = new CFX_Stream; pShared->m_eStreamType = FX_STREAMTYPE_Stream; @@ -1496,12 +1496,12 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess, } IFX_FileRead* FX_CreateFileRead(IFX_Stream* pBaseStream, FX_BOOL bReleaseStream) { - ASSERT(pBaseStream != NULL); + ASSERT(pBaseStream); return new CFGAS_FileRead(pBaseStream, bReleaseStream); } CFGAS_FileRead::CFGAS_FileRead(IFX_Stream* pStream, FX_BOOL bReleaseStream) : m_bReleaseStream(bReleaseStream), m_pStream(pStream) { - ASSERT(m_pStream != NULL); + ASSERT(m_pStream); } CFGAS_FileRead::~CFGAS_FileRead() { if (m_bReleaseStream) { diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h index 2da06fc7ed..5cd2a3daa7 100644 --- a/xfa/fgas/crt/fgas_stream.h +++ b/xfa/fgas/crt/fgas_stream.h @@ -58,7 +58,7 @@ class IFX_Stream { virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS, - int32_t const* pByteSize = NULL) = 0; + int32_t const* pByteSize = nullptr) = 0; virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; virtual void Flush() = 0; diff --git a/xfa/fgas/crt/fgas_system.cpp b/xfa/fgas/crt/fgas_system.cpp index 43d55b108a..b5cabedec5 100644 --- a/xfa/fgas/crt/fgas_system.cpp +++ b/xfa/fgas/crt/fgas_system.cpp @@ -23,7 +23,7 @@ inline int32_t FX_tolower(int32_t ch) { } // namespace int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) { - ASSERT(s1 != NULL && s2 != NULL && count > 0); + ASSERT(s1 && s2 && count > 0); FX_WCHAR wch1 = 0; FX_WCHAR wch2 = 0; while (count-- > 0) { @@ -37,7 +37,7 @@ int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) { } FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen) { - ASSERT(pwsStr != NULL); + ASSERT(pwsStr); if (iLength < 0) { iLength = FXSYS_wcslen(pwsStr); } diff --git a/xfa/fgas/crt/fgas_system.h b/xfa/fgas/crt/fgas_system.h index a3215ffa37..83c67735dc 100644 --- a/xfa/fgas/crt/fgas_system.h +++ b/xfa/fgas/crt/fgas_system.h @@ -11,7 +11,7 @@ FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength = -1, - int32_t* pUsedLen = NULL); + int32_t* pUsedLen = nullptr); int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); #endif // XFA_FGAS_CRT_FGAS_SYSTEM_H_ diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp index 6db7aa35ab..7207f055e5 100644 --- a/xfa/fgas/crt/fgas_utils.cpp +++ b/xfa/fgas/crt/fgas_utils.cpp @@ -133,9 +133,9 @@ int32_t CFX_BaseArray::RemoveLast(int32_t iCount) { void CFX_BaseArray::RemoveAll(FX_BOOL bLeaveMemory) { if (!bLeaveMemory) { uint8_t*& pBuffer = m_pData->pBuffer; - if (pBuffer != NULL) { + if (pBuffer) { FX_Free(pBuffer); - pBuffer = NULL; + pBuffer = nullptr; } m_pData->iTotalCount = 0; } @@ -178,14 +178,14 @@ uint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) { } } } - ASSERT(pChunk != NULL); + ASSERT(pChunk); m_iBlockCount = index + 1; return pChunk + (index % m_iChunkSize) * m_iBlockSize; } uint8_t* CFX_BaseMassArrayImp::GetAt(int32_t index) const { ASSERT(index > -1 && index < m_iBlockCount); uint8_t* pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize); - ASSERT(pChunk != NULL); + ASSERT(pChunk); return pChunk + (index % m_iChunkSize) * m_iBlockSize; } int32_t CFX_BaseMassArrayImp::Append(const CFX_BaseMassArrayImp& src, @@ -258,7 +258,7 @@ void CFX_BaseMassArrayImp::Append(int32_t iDstStart, std::min(iSrcCount, std::min(iSrcChunkSize, iDstChunkSize)); int32_t iCopyBytes = iCopySize * m_iBlockSize; while (iSrcCount > 0) { - ASSERT(pDstChunk != NULL && pSrcChunk != NULL); + ASSERT(pDstChunk && pSrcChunk); FXSYS_memcpy(pDstChunk, pSrcChunk, iCopyBytes); iSrcCount -= iCopySize; iSrcChunkSize -= iCopySize; @@ -294,13 +294,9 @@ void CFX_BaseMassArrayImp::RemoveAll(FX_BOOL bLeaveMemory) { m_iBlockCount = 0; return; } - for (int32_t i = 0; i < m_iChunkCount; i++) { - void* p = m_pData->GetAt(i); - if (p == NULL) { - continue; - } - FX_Free(p); - } + for (int32_t i = 0; i < m_iChunkCount; i++) + FX_Free(m_pData->GetAt(i)); + m_pData->RemoveAll(); m_iChunkCount = 0; m_iBlockCount = 0; @@ -363,7 +359,7 @@ uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) { FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData; int32_t& iChunkCount = pData->iChunkCount; int32_t iChunkSize = pData->iChunkSize; - uint8_t* pChunk = NULL; + uint8_t* pChunk = nullptr; int32_t iChunk = index / iChunkSize; if (iChunk < iChunkCount) { pChunk = pData->ChunkBuffer.GetAt(iChunk); @@ -421,7 +417,7 @@ void CFX_BaseStack::Pop() { uint8_t* CFX_BaseStack::GetTopElement() const { int32_t iSize = m_pData->m_iBlockCount; if (iSize < 1) { - return NULL; + return nullptr; } return m_pData->GetAt(iSize - 1); } diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h index f01d115b3e..0cf853fa70 100644 --- a/xfa/fgas/crt/fgas_utils.h +++ b/xfa/fgas/crt/fgas_utils.h @@ -378,7 +378,7 @@ class CFX_DiscreteArrayTemplate : public CFX_BaseDiscreteArray { : CFX_BaseDiscreteArray(iChunkSize, sizeof(baseType)) {} baseType& GetAt(int32_t index, const baseType& defValue) const { baseType* p = (baseType*)CFX_BaseDiscreteArray::GetAt(index); - return p == NULL ? (baseType&)defValue : *p; + return p ? *p : (baseType&)defValue; } baseType* GetPtrAt(int32_t index) const { return (baseType*)CFX_BaseDiscreteArray::GetAt(index); @@ -447,7 +447,7 @@ class CFX_ObjectStackTemplate : public CFX_BaseStack { } void Pop() { baseType* p = (baseType*)CFX_BaseStack::GetTopElement(); - if (p != NULL) { + if (p) { p->~baseType(); } CFX_BaseStack::Pop(); diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h index 89641d7c72..7fcfbd715b 100644 --- a/xfa/fgas/font/fgas_font.h +++ b/xfa/fgas/font/fgas_font.h @@ -88,25 +88,25 @@ class IFGAS_FontMgr { virtual CFGAS_GEFont* GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetDefFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetDefFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF) = 0; virtual CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, int32_t iLength) = 0; virtual CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, - const FX_WCHAR* pszFontAlias = NULL, + const FX_WCHAR* pszFontAlias = nullptr, uint32_t dwFontStyles = 0, uint16_t wCodePage = 0, FX_BOOL bSaveStream = FALSE) = 0; @@ -127,23 +127,23 @@ class IFGAS_FontMgr { virtual CFGAS_GEFont* GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetDefFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetDefFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; inline CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { @@ -152,15 +152,15 @@ class IFGAS_FontMgr { virtual CFGAS_GEFont* GetFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual CFGAS_GEFont* GetFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; + const FX_WCHAR* pszFontFamily = nullptr) = 0; virtual void ClearFontCache() = 0; virtual void RemoveFont(CFGAS_GEFont* pFont) = 0; }; diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp index bccaf2cdb6..c31e1e08ca 100644 --- a/xfa/fgas/font/fgas_fontutils.cpp +++ b/xfa/fgas/font/fgas_fontutils.cpp @@ -149,5 +149,5 @@ const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode) { return &usb; } } while (iStart <= iEnd); - return NULL; + return nullptr; } diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index 7863ef715b..a7d8c49cbf 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -16,15 +16,15 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFontFamily, uint16_t wCodePage, IFGAS_FontMgr* pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - if (NULL != pFontMgr) { + if (pFontMgr) { return pFontMgr->GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); } - return NULL; + return nullptr; #else CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr); if (!pFont->LoadFontInternal(pszFontFamily, dwFontStyles, wCodePage)) { pFont->Release(); - return NULL; + return nullptr; } return pFont; #endif @@ -36,7 +36,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pExtFont, CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr); if (!pFont->LoadFontInternal(pExtFont)) { pFont->Release(); - return NULL; + return nullptr; } return pFont; } @@ -73,17 +73,17 @@ CFGAS_GEFont::CFGAS_GEFont(IFGAS_FontMgr* pFontMgr) m_bUseLogFontStyle(FALSE), m_dwLogFontStyle(0), #endif - m_pFont(NULL), + m_pFont(nullptr), m_pFontMgr(pFontMgr), m_iRefCount(1), m_bExtFont(FALSE), - m_pStream(NULL), - m_pFileRead(NULL), - m_pFontEncoding(NULL), - m_pCharWidthMap(NULL), - m_pRectArray(NULL), - m_pBBoxMap(NULL), - m_pProvider(NULL) { + m_pStream(nullptr), + m_pFileRead(nullptr), + m_pFontEncoding(nullptr), + m_pCharWidthMap(nullptr), + m_pRectArray(nullptr), + m_pBBoxMap(nullptr), + m_pProvider(nullptr) { } CFGAS_GEFont::CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles) @@ -92,17 +92,17 @@ CFGAS_GEFont::CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles) m_bUseLogFontStyle(FALSE), m_dwLogFontStyle(0), #endif - m_pFont(NULL), + m_pFont(nullptr), m_pFontMgr(src.m_pFontMgr), m_iRefCount(1), m_bExtFont(FALSE), - m_pStream(NULL), - m_pFileRead(NULL), - m_pFontEncoding(NULL), - m_pCharWidthMap(NULL), - m_pRectArray(NULL), - m_pBBoxMap(NULL), - m_pProvider(NULL) { + m_pStream(nullptr), + m_pFileRead(nullptr), + m_pFontEncoding(nullptr), + m_pCharWidthMap(nullptr), + m_pRectArray(nullptr), + m_pBBoxMap(nullptr), + m_pProvider(nullptr) { ASSERT(src.m_pFont); m_pFont = new CFX_Font; m_pFont->LoadClone(src.m_pFont); @@ -141,7 +141,7 @@ CFGAS_GEFont::~CFGAS_GEFont() { void CFGAS_GEFont::Release() { if (--m_iRefCount < 1) { - if (m_pFontMgr != NULL) { + if (m_pFontMgr) { m_pFontMgr->RemoveFont(this); } delete this; @@ -160,7 +160,7 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, return FALSE; } CFX_ByteString csFontFamily; - if (pszFontFamily != NULL) { + if (pszFontFamily) { csFontFamily = CFX_ByteString::FromUnicode(pszFontFamily); } uint32_t dwFlags = 0; @@ -276,7 +276,7 @@ void CFGAS_GEFont::GetFamilyName(CFX_WideString& wsFamily) const { } uint32_t CFGAS_GEFont::GetFontStyles() const { - ASSERT(m_pFont != NULL); + ASSERT(m_pFont); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (m_bUseLogFontStyle) { return m_dwLogFontStyle; @@ -309,14 +309,14 @@ FX_BOOL CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, int32_t& iWidth, FX_BOOL bRecursive, FX_BOOL bCharCode) { - ASSERT(m_pCharWidthMap != NULL); + ASSERT(m_pCharWidthMap); iWidth = m_pCharWidthMap->GetAt(wUnicode, 0); if (iWidth < 1) { if (!m_pProvider || !m_pProvider->GetCharWidth(this, wUnicode, iWidth, bCharCode)) { - CFGAS_GEFont* pFont = NULL; + CFGAS_GEFont* pFont = nullptr; int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); - if (iGlyph != 0xFFFF && pFont != NULL) { + if (iGlyph != 0xFFFF && pFont) { if (pFont == this) { iWidth = m_pFont->GetGlyphWidth(iGlyph); if (iWidth < 0) { @@ -345,13 +345,13 @@ FX_BOOL CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode, CFX_Rect& bbox, FX_BOOL bRecursive, FX_BOOL bCharCode) { - ASSERT(m_pRectArray != NULL); - ASSERT(m_pBBoxMap != NULL); - void* pRect = NULL; + ASSERT(m_pRectArray); + ASSERT(m_pBBoxMap); + void* pRect = nullptr; if (!m_pBBoxMap->Lookup((void*)(uintptr_t)wUnicode, pRect)) { - CFGAS_GEFont* pFont = NULL; + CFGAS_GEFont* pFont = nullptr; int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); - if (iGlyph != 0xFFFF && pFont != NULL) { + if (iGlyph != 0xFFFF && pFont) { if (pFont == this) { FX_RECT rtBBox; if (m_pFont->GetGlyphBBox(iGlyph, rtBBox)) { @@ -390,22 +390,22 @@ int32_t CFGAS_GEFont::GetItalicAngle() const { return m_pFont->GetSubstFont()->m_ItalicAngle; } int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode) { - return GetGlyphIndex(wUnicode, TRUE, NULL, bCharCode); + return GetGlyphIndex(wUnicode, TRUE, nullptr, bCharCode); } int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, CFGAS_GEFont** ppFont, FX_BOOL bCharCode) { - ASSERT(m_pFontEncoding != NULL); + ASSERT(m_pFontEncoding); int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { - if (ppFont != NULL) { + if (ppFont) { *ppFont = this; } return iGlyphIndex; } const FGAS_FONTUSB* pFontUSB = FGAS_GetUnicodeBitField(wUnicode); - if (pFontUSB == NULL) { + if (!pFontUSB) { return 0xFFFF; } uint16_t wBitField = pFontUSB->wBitField; @@ -415,7 +415,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, auto it = m_FontMapper.find(wUnicode); CFGAS_GEFont* pFont = it != m_FontMapper.end() ? it->second : nullptr; if (pFont && pFont != this) { - iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, NULL, bCharCode); + iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode); if (iGlyphIndex != 0xFFFF) { int32_t i = m_SubstFonts.Find(pFont); if (i > -1) { @@ -436,7 +436,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, CFGAS_GEFont* pFont = m_pFontMgr->GetFontByUnicode( wUnicode, GetFontStyles(), wsFamily.c_str()); if (!pFont) - pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), NULL); + pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), nullptr); #endif if (pFont) { if (pFont == this) { @@ -446,7 +446,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, m_FontMapper[wUnicode] = pFont; int32_t i = m_SubstFonts.GetSize(); m_SubstFonts.Add(pFont); - iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, NULL, bCharCode); + iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode); if (iGlyphIndex != 0xFFFF) { iGlyphIndex |= ((i + 1) << 24); if (ppFont) @@ -466,13 +466,13 @@ int32_t CFGAS_GEFont::GetDescent() const { void CFGAS_GEFont::Reset() { for (int32_t i = 0; i < m_SubstFonts.GetSize(); i++) m_SubstFonts[i]->Reset(); - if (m_pCharWidthMap != NULL) { + if (m_pCharWidthMap) { m_pCharWidthMap->RemoveAll(); } - if (m_pBBoxMap != NULL) { + if (m_pBBoxMap) { m_pBBoxMap->RemoveAll(); } - if (m_pRectArray != NULL) { + if (m_pRectArray) { m_pRectArray->RemoveAll(); } } diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 34f5078962..47ec72b807 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -28,7 +28,7 @@ CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator) m_StreamFonts(4), m_DeriveFonts(4) { if (m_pEnumerator) { - m_pEnumerator(m_FontFaces, NULL, 0xFEFF); + m_pEnumerator(m_FontFaces, nullptr, 0xFEFF); } } @@ -53,18 +53,19 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage( uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); - CFGAS_GEFont* pFont = NULL; + CFGAS_GEFont* pFont = nullptr; if (m_CPFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { - return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : NULL; - } - FX_FONTDESCRIPTOR const* pFD; - if ((pFD = FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage)) == NULL) { - if ((pFD = FindFont(NULL, dwFontStyles, TRUE, wCodePage)) == NULL) { - if ((pFD = FindFont(NULL, dwFontStyles, FALSE, wCodePage)) == NULL) - return NULL; - } + return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr; } - ASSERT(pFD); + FX_FONTDESCRIPTOR const* pFD = + FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage); + if (!pFD) + pFD = FindFont(nullptr, dwFontStyles, TRUE, wCodePage); + if (!pFD) + pFD = FindFont(nullptr, dwFontStyles, FALSE, wCodePage); + if (!pFD) + return nullptr; + pFont = CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); if (pFont) { @@ -74,7 +75,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage( m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); return LoadFont(pFont, dwFontStyles, wCodePage); } - return NULL; + return nullptr; } CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCharset( @@ -137,18 +138,17 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, uint16_t wCodePage) { uint32_t dwHash = FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); - CFGAS_GEFont* pFont = NULL; + CFGAS_GEFont* pFont = nullptr; if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { - return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : NULL; + return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr; } - FX_FONTDESCRIPTOR const* pFD = NULL; - if ((pFD = FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage)) == NULL) { - if ((pFD = FindFont(pszFontFamily, dwFontStyles, FALSE, wCodePage)) == - NULL) { - return NULL; - } - } - ASSERT(pFD); + FX_FONTDESCRIPTOR const* pFD = + FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage); + if (!pFD) + pFD = FindFont(pszFontFamily, dwFontStyles, FALSE, wCodePage); + if (!pFD) + return nullptr; + if (wCodePage == 0xFFFF) { wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet); } @@ -161,13 +161,13 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); return LoadFont(pFont, dwFontStyles, wCodePage); } - return NULL; + return nullptr; } CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) { ASSERT(pBuffer && iLength > 0); - CFGAS_GEFont* pFont = NULL; + CFGAS_GEFont* pFont = nullptr; if (m_BufferFonts.Lookup((void*)pBuffer, (void*&)pFont)) { if (pFont) { return pFont->Retain(); @@ -179,7 +179,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, m_BufferFonts.SetAt((void*)pBuffer, pFont); return pFont->Retain(); } - return NULL; + return nullptr; } CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, @@ -188,7 +188,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, uint16_t wCodePage, FX_BOOL bSaveStream) { ASSERT(pFontStream && pFontStream->GetLength() > 0); - CFGAS_GEFont* pFont = NULL; + CFGAS_GEFont* pFont = nullptr; if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) { if (pFont) { if (pszFontAlias) { @@ -210,7 +210,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, } return LoadFont(pFont, dwFontStyles, wCodePage); } - return NULL; + return nullptr; } CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont, @@ -224,7 +224,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont, (void*)(uintptr_t)wCodePage}; uint32_t dwHash = FX_HashCode_GetA( CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false); - CFGAS_GEFont* pFont = NULL; + CFGAS_GEFont* pFont = nullptr; if (m_DeriveFonts.GetCount() > 0) { m_DeriveFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont); if (pFont) { @@ -241,7 +241,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont, } return pFont; } - return NULL; + return nullptr; } void CFGAS_StdFontMgrImp::ClearFontCache() { @@ -255,7 +255,7 @@ void CFGAS_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, void* pKey; void* pFind; while (pos) { - pFind = NULL; + pFind = nullptr; fontMap.GetNextAssoc(pos, pKey, pFind); if (pFind != (void*)pFont) { continue; @@ -300,10 +300,10 @@ FX_FONTDESCRIPTOR const* CFGAS_StdFontMgrImp::FindFont( if (pszFontFamily && m_pEnumerator) { CFX_FontDescriptors namedFonts; m_pEnumerator(namedFonts, pszFontFamily, wUnicode); - params.pwsFamily = NULL; + params.pwsFamily = nullptr; pDesc = FX_DefFontMatcher(¶ms, namedFonts); - if (pDesc == NULL) { - return NULL; + if (!pDesc) { + return nullptr; } for (int32_t i = m_FontFaces.GetSize() - 1; i >= 0; i--) { FX_FONTDESCRIPTOR const* pMatch = m_FontFaces.GetPtrAt(i); @@ -314,12 +314,12 @@ FX_FONTDESCRIPTOR const* CFGAS_StdFontMgrImp::FindFont( int index = m_FontFaces.Add(*pDesc); return m_FontFaces.GetPtrAt(index); } - return NULL; + return nullptr; } FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors& fonts) { - FX_FONTDESCRIPTOR const* pBestFont = NULL; + FX_FONTDESCRIPTOR const* pBestFont = nullptr; int32_t iBestSimilar = 0; FX_BOOL bMatchStyle = (pParams->dwMatchFlags & FX_FONTMATCHPARA_MacthStyle) > 0; @@ -370,7 +370,7 @@ FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, pBestFont = pFont; } } - return iBestSimilar < 1 ? NULL : pBestFont; + return iBestSimilar < 1 ? nullptr : pBestFont; } int32_t FX_GetSimilarValue(FX_FONTDESCRIPTOR const* pFont, @@ -444,7 +444,7 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe, static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts, const FX_WCHAR* pwsFaceName, FX_WCHAR wUnicode) { - HDC hDC = ::GetDC(NULL); + HDC hDC = ::GetDC(nullptr); LOGFONTW lfFind; FXSYS_memset(&lfFind, 0, sizeof(lfFind)); lfFind.lfCharSet = DEFAULT_CHARSET; @@ -454,7 +454,7 @@ static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts, } EnumFontFamiliesExW(hDC, (LPLOGFONTW)&lfFind, (FONTENUMPROCW)FX_GdiFontEnumProc, (LPARAM)&fonts, 0); - ::ReleaseDC(NULL, hDC); + ::ReleaseDC(nullptr, hDC); } FX_LPEnumAllFonts FX_GetDefFontEnumerator() { @@ -488,10 +488,10 @@ CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {} CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { Restart: void* pCurHandle = - m_FolderQueue.GetSize() == 0 - ? NULL - : m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle; - if (NULL == pCurHandle) { + m_FolderQueue.GetSize() != 0 + ? m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle + : nullptr; + if (!pCurHandle) { if (m_FolderPaths.GetSize() < 1) { return ""; } @@ -531,7 +531,7 @@ Restart: m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + bsFolderSpearator + bsName; hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str()); - if (hpp.pFileHandle == NULL) { + if (!hpp.pFileHandle) { continue; } m_FolderQueue.Add(hpp); @@ -548,7 +548,7 @@ Restart: FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() { m_wsNext = GetNextFile().UTF8Decode(); - if (0 == m_wsNext.GetLength()) { + if (m_wsNext.GetLength() == 0) { return (FX_POSITION)0; } return (FX_POSITION)-1; @@ -557,7 +557,7 @@ FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() { IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos) { IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext.AsStringC()); m_wsNext = GetNextFile().UTF8Decode(); - pos = 0 != m_wsNext.GetLength() ? pAccess : NULL; + pos = m_wsNext.GetLength() != 0 ? pAccess : nullptr; return pAccess; } @@ -742,7 +742,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { CFGAS_GEFont* pFont = nullptr; - if (m_FailedUnicodes2NULL.Lookup(wUnicode, pFont)) + if (m_FailedUnicodes2Nullptr.Lookup(wUnicode, pFont)) return nullptr; const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode); uint16_t wCodePage = x ? x->wCodePage : 0xFFFF; @@ -785,7 +785,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( return pFont; } if (!pszFontFamily) - m_FailedUnicodes2NULL.SetAt(wUnicode, nullptr); + m_FailedUnicodes2Nullptr.SetAt(wUnicode, nullptr); return nullptr; } @@ -1131,7 +1131,7 @@ void CFGAS_FontMgrImp::ClearFontCache() { } void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) { - if (NULL == pEFont) { + if (!pEFont) { return; } IFX_FileRead* pFileRead; @@ -1145,10 +1145,10 @@ void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) { uint32_t dwHash; CFX_ArrayTemplate* pFonts; m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts); - if (NULL != pFonts) { + if (pFonts) { for (int32_t i = 0; i < pFonts->GetSize(); i++) { if (pFonts->GetAt(i) == pEFont) { - pFonts->SetAt(i, NULL); + pFonts->SetAt(i, nullptr); } } } else { @@ -1239,7 +1239,7 @@ uint32_t CFGAS_FontMgrImp::GetFlags(FXFT_Face pFace) { void CFGAS_FontMgrImp::GetNames(const uint8_t* name_table, CFX_WideStringArray& Names) { - if (NULL == name_table) { + if (!name_table) { return; } uint8_t* lpTable = (uint8_t*)name_table; @@ -1369,7 +1369,7 @@ void CFGAS_FontMgrImp::GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB) { TT_OS2* pOS2 = (TT_OS2*)FT_Get_Sfnt_Table(pFace, ft_sfnt_os2); - if (NULL != pOS2) { + if (pOS2) { USB[0] = pOS2->ulUnicodeRange1; USB[1] = pOS2->ulUnicodeRange2; USB[2] = pOS2->ulUnicodeRange3; diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index f66729e21b..8c83884236 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -30,25 +30,25 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { CFGAS_GEFont* GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* GetDefFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* GetDefFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF) override; CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, int32_t iLength) override; CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, - const FX_WCHAR* pszFontAlias = NULL, + const FX_WCHAR* pszFontAlias = nullptr, uint32_t dwFontStyles = 0, uint16_t wCodePage = 0, FX_BOOL bSaveStream = FALSE) override; @@ -152,33 +152,35 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { CFGAS_GEFont* GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* GetDefFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* GetDefFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - CFGAS_GEFont* GetFontByCharset(uint8_t nCharset, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - CFGAS_GEFont* GetFontByUnicode(FX_WCHAR wUnicode, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; + CFGAS_GEFont* GetFontByCharset( + uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = nullptr) override; + CFGAS_GEFont* GetFontByUnicode( + FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = nullptr) override; CFGAS_GEFont* GetFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; + const FX_WCHAR* pszFontFamily = nullptr) override; void ClearFontCache() override; void RemoveFont(CFGAS_GEFont* pFont) override; @@ -222,7 +224,7 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { CFX_MapPtrTemplate m_Hash2CandidateList; CFX_MapPtrTemplate*> m_Hash2Fonts; CFX_MapPtrTemplate m_IFXFont2FileRead; - CFX_MapPtrTemplate m_FailedUnicodes2NULL; + CFX_MapPtrTemplate m_FailedUnicodes2Nullptr; CFX_FontSourceEnum_File* const m_pFontSource; }; #endif diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index 80591f1714..8a4f6eac2b 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -23,7 +23,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies) m_bVertical(FALSE), m_bSingleLine(FALSE), m_bCharCode(FALSE), - m_pFont(NULL), + m_pFont(nullptr), m_iFontHeight(240), m_iFontSize(240), m_iTabWidth(720000), @@ -42,12 +42,12 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies) m_iWordSpace(0), m_bRTL(FALSE), m_iAlignment(FX_RTFLINEALIGNMENT_Left), - m_pUserData(NULL), + m_pUserData(nullptr), m_eCharType(FX_CHARTYPE_Unknown), m_dwIdentity(0), m_RTFLine1(), m_RTFLine2(), - m_pCurLine(NULL), + m_pCurLine(nullptr), m_iReady(0), m_iTolerance(0) { m_pCurLine = &m_RTFLine1; @@ -55,7 +55,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies) CFX_RTFBreak::~CFX_RTFBreak() { Reset(); m_PositionedTabs.RemoveAll(); - if (m_pUserData != NULL) { + if (m_pUserData) { m_pUserData->Release(); } } @@ -88,7 +88,7 @@ void CFX_RTFBreak::SetLayoutStyles(uint32_t dwLayoutStyles) { m_iRotation %= 4; } void CFX_RTFBreak::SetFont(CFGAS_GEFont* pFont) { - if (pFont == NULL) { + if (!pFont) { return; } if (m_pFont == pFont) { @@ -97,7 +97,7 @@ void CFX_RTFBreak::SetFont(CFGAS_GEFont* pFont) { SetBreakStatus(); m_pFont = pFont; m_iDefChar = 0; - if (m_pFont != NULL) { + if (m_pFont) { m_iFontHeight = m_iFontSize; if (m_wDefChar != 0xFEFF) { m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); @@ -113,7 +113,7 @@ void CFX_RTFBreak::SetFontSize(FX_FLOAT fFontSize) { SetBreakStatus(); m_iFontSize = iFontSize; m_iDefChar = 0; - if (m_pFont != NULL) { + if (m_pFont) { m_iFontHeight = m_iFontSize; if (m_wDefChar != 0xFEFF) { m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); @@ -173,7 +173,7 @@ void CFX_RTFBreak::ClearPositionedTabs() { void CFX_RTFBreak::SetDefaultChar(FX_WCHAR wch) { m_wDefChar = wch; m_iDefChar = 0; - if (m_wDefChar != 0xFEFF && m_pFont != NULL) { + if (m_wDefChar != 0xFEFF && m_pFont) { m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); if (m_iDefChar < 0) { m_iDefChar = 0; @@ -245,11 +245,11 @@ void CFX_RTFBreak::SetUserData(IFX_Retainable* pUserData) { return; } SetBreakStatus(); - if (m_pUserData != NULL) { + if (m_pUserData) { m_pUserData->Release(); } m_pUserData = pUserData; - if (m_pUserData != NULL) { + if (m_pUserData) { m_pUserData->Retain(); } } @@ -272,7 +272,7 @@ CFX_RTFChar* CFX_RTFBreak::GetLastChar(int32_t index) const { CFX_RTFCharArray& tca = m_pCurLine->m_LineChars; int32_t iCount = tca.GetSize(); if (index < 0 || index >= iCount) { - return NULL; + return nullptr; } CFX_RTFChar* pTC; int32_t iStart = iCount - 1; @@ -285,7 +285,7 @@ CFX_RTFChar* CFX_RTFBreak::GetLastChar(int32_t index) const { } } } - return NULL; + return nullptr; } CFX_RTFLine* CFX_RTFBreak::GetRTFLine(FX_BOOL bReady) const { if (bReady) { @@ -294,18 +294,15 @@ CFX_RTFLine* CFX_RTFBreak::GetRTFLine(FX_BOOL bReady) const { } else if (m_iReady == 2) { return (CFX_RTFLine*)&m_RTFLine2; } else { - return NULL; + return nullptr; } } - ASSERT(m_pCurLine != NULL); + ASSERT(m_pCurLine); return m_pCurLine; } CFX_RTFPieceArray* CFX_RTFBreak::GetRTFPieces(FX_BOOL bReady) const { CFX_RTFLine* pRTFLine = GetRTFLine(bReady); - if (pRTFLine == NULL) { - return NULL; - } - return &pRTFLine->m_LinePieces; + return pRTFLine ? &pRTFLine->m_LinePieces : nullptr; } inline FX_CHARTYPE CFX_RTFBreak::GetUnifiedCharType( FX_CHARTYPE chartype) const { @@ -362,7 +359,7 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) { pCurChar->m_nRotation = m_iCharRotation; pCurChar->m_iCharWidth = 0; pCurChar->m_dwIdentity = m_dwIdentity; - if (m_pUserData != NULL) { + if (m_pUserData) { m_pUserData->Retain(); } pCurChar->m_pUserData = m_pUserData; @@ -392,7 +389,7 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) { return std::max(dwRet1, dwRet2); } uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) { - ASSERT(m_pFont != NULL && m_pCurLine != NULL); + ASSERT(m_pFont && m_pCurLine); ASSERT(m_bCharCode); m_pCurLine->m_iMBCSChars++; CFX_RTFCharArray& tca = m_pCurLine->m_LineChars; @@ -409,7 +406,7 @@ uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) { pCurChar->m_nRotation = m_iCharRotation; pCurChar->m_iCharWidth = 0; pCurChar->m_dwIdentity = m_dwIdentity; - if (m_pUserData != NULL) { + if (m_pUserData) { m_pUserData->Retain(); } pCurChar->m_pUserData = m_pUserData; @@ -447,7 +444,7 @@ uint32_t CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar, iCharWidth *= m_iFontSize; iCharWidth = iCharWidth * m_iHorizontalScale / 100; CFX_RTFChar* pLastChar = GetLastChar(0); - if (pLastChar != NULL && pLastChar->GetCharType() > FX_CHARTYPE_Combination) { + if (pLastChar && pLastChar->GetCharType() > FX_CHARTYPE_Combination) { iCharWidth = -iCharWidth; } else { m_eCharType = FX_CHARTYPE_Combination; @@ -509,7 +506,7 @@ uint32_t CFX_RTFBreak::AppendChar_Control(CFX_RTFChar* pCurChar, } uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t iRotation) { - CFX_RTFChar* pLastChar = NULL; + CFX_RTFChar* pLastChar = nullptr; int32_t& iLineWidth = m_pCurLine->m_iWidth; int32_t iCharWidth = 0; FX_WCHAR wForm; @@ -517,7 +514,7 @@ uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar, if (m_eCharType >= FX_CHARTYPE_ArabicAlef && m_eCharType <= FX_CHARTYPE_ArabicDistortion) { pLastChar = GetLastChar(1); - if (pLastChar != NULL) { + if (pLastChar) { iLineWidth -= pLastChar->m_iCharWidth; CFX_RTFChar* pPrevChar = GetLastChar(2); wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar); @@ -621,7 +618,7 @@ uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) { return dwStatus; } else { CFX_RTFLine* pLastLine = GetRTFLine(TRUE); - if (pLastLine != NULL) { + if (pLastLine) { pCurPieces = &pLastLine->m_LinePieces; iCount = pCurPieces->GetSize(); if (iCount-- > 0) { @@ -1063,7 +1060,7 @@ int32_t CFX_RTFBreak::GetBreakPos(CFX_RTFCharArray& tca, void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine, CFX_RTFLine* pNextLine, FX_BOOL bAllChars) { - ASSERT(pCurLine != NULL && pNextLine != NULL); + ASSERT(pCurLine && pNextLine); int32_t iCount = pCurLine->CountChars(); if (iCount < 2) { return; @@ -1110,25 +1107,22 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine, } int32_t CFX_RTFBreak::CountBreakPieces() const { CFX_RTFPieceArray* pRTFPieces = GetRTFPieces(TRUE); - if (pRTFPieces == NULL) { - return 0; - } - return pRTFPieces->GetSize(); + return pRTFPieces ? pRTFPieces->GetSize() : 0; } const CFX_RTFPiece* CFX_RTFBreak::GetBreakPiece(int32_t index) const { CFX_RTFPieceArray* pRTFPieces = GetRTFPieces(TRUE); - if (pRTFPieces == NULL) { - return NULL; + if (!pRTFPieces) { + return nullptr; } if (index < 0 || index >= pRTFPieces->GetSize()) { - return NULL; + return nullptr; } return pRTFPieces->GetPtrAt(index); } void CFX_RTFBreak::GetLineRect(CFX_RectF& rect) const { rect.top = 0; CFX_RTFLine* pRTFLine = GetRTFLine(TRUE); - if (pRTFLine == NULL) { + if (!pRTFLine) { rect.left = ((FX_FLOAT)m_iBoundaryStart) / 20000.0f; rect.width = rect.height = 0; return; @@ -1158,7 +1152,7 @@ void CFX_RTFBreak::GetLineRect(CFX_RectF& rect) const { } void CFX_RTFBreak::ClearBreakPieces() { CFX_RTFLine* pRTFLine = GetRTFLine(TRUE); - if (pRTFLine != NULL) { + if (pRTFLine) { pRTFLine->RemoveAll(TRUE); } m_iReady = 0; @@ -1173,11 +1167,10 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, FX_BOOL bCharCode, CFX_WideString* pWSForms, FX_AdjustCharDisplayPos pAdjustPos) const { - if (pText == NULL || pText->iLength < 1) { + if (!pText || pText->iLength < 1) { return 0; } - ASSERT(pText->pStr != NULL && pText->pWidths != NULL && - pText->pFont != NULL && pText->pRect != NULL); + ASSERT(pText->pStr && pText->pWidths && pText->pFont && pText->pRect); const FX_WCHAR* pStr = pText->pStr; int32_t* pWidths = pText->pWidths; int32_t iLength = pText->iLength - 1; @@ -1248,7 +1241,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, if (!bEmptyChar) { iCount++; } - if (pCharPos != NULL) { + if (pCharPos) { iCharWidth /= iFontSize; wForm = wch; if (!bMBCSCode) { @@ -1416,11 +1409,10 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText, CFX_RectFArray& rtArray, FX_BOOL bCharBBox) const { - if (pText == NULL || pText->iLength < 1) { + if (!pText || pText->iLength < 1) { return 0; } - ASSERT(pText->pStr != NULL && pText->pWidths != NULL && - pText->pFont != NULL && pText->pRect != NULL); + ASSERT(pText->pStr && pText->pWidths && pText->pFont && pText->pRect); const FX_WCHAR* pStr = pText->pStr; int32_t* pWidths = pText->pWidths; int32_t iLength = pText->iLength; @@ -1430,7 +1422,7 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText, int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); FX_FLOAT fScale = fFontSize / 1000.0f; CFGAS_GEFont* pFont = pText->pFont; - if (pFont == NULL) { + if (!pFont) { bCharBBox = FALSE; } CFX_Rect bbox; @@ -1533,8 +1525,8 @@ CFX_RTFPiece::CFX_RTFPiece() m_iVerticalScale(100), m_dwLayoutStyles(0), m_dwIdentity(0), - m_pChars(NULL), - m_pUserData(NULL) {} + m_pChars(nullptr), + m_pUserData(nullptr) {} CFX_RTFPiece::~CFX_RTFPiece() { Reset(); diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index 993dc50f97..9d01809045 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -86,7 +86,7 @@ class CFX_RTFPiece : public CFX_Target { ~CFX_RTFPiece() override; void AppendChar(const CFX_RTFChar& tc) { - ASSERT(m_pChars != NULL); + ASSERT(m_pChars); m_pChars->Add(tc); if (m_iWidth < 0) { m_iWidth = tc.m_iCharWidth; @@ -101,15 +101,15 @@ class CFX_RTFPiece : public CFX_Target { int32_t GetLength() const { return m_iChars; } int32_t GetEndChar() const { return m_iStartChar + m_iChars; } CFX_RTFChar& GetChar(int32_t index) { - ASSERT(index > -1 && index < m_iChars && m_pChars != NULL); + ASSERT(index > -1 && index < m_iChars && m_pChars); return *m_pChars->GetDataPtr(m_iStartChar + index); } CFX_RTFChar* GetCharPtr(int32_t index) const { - ASSERT(index > -1 && index < m_iChars && m_pChars != NULL); + ASSERT(index > -1 && index < m_iChars && m_pChars); return m_pChars->GetDataPtr(m_iStartChar + index); } void GetString(FX_WCHAR* pText) const { - ASSERT(pText != NULL); + ASSERT(pText); int32_t iEndChar = m_iStartChar + m_iChars; CFX_RTFChar* pChar; for (int32_t i = m_iStartChar; i < iEndChar; i++) { @@ -123,7 +123,7 @@ class CFX_RTFPiece : public CFX_Target { wsText.ReleaseBuffer(m_iChars); } void GetWidths(int32_t* pWidths) const { - ASSERT(pWidths != NULL); + ASSERT(pWidths); int32_t iEndChar = m_iStartChar + m_iChars; CFX_RTFChar* pChar; for (int32_t i = m_iStartChar; i < iEndChar; i++) { @@ -190,13 +190,11 @@ class CFX_RTFLine { int32_t GetLineEnd() const { return m_iStart + m_iWidth; } void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { CFX_RTFChar* pChar; - IFX_Retainable* pUnknown; int32_t iCount = m_LineChars.GetSize(); for (int32_t i = 0; i < iCount; i++) { pChar = m_LineChars.GetDataPtr(i); - if ((pUnknown = pChar->m_pUserData) != NULL) { - pUnknown->Release(); - } + if (pChar->m_pUserData) + pChar->m_pUserData->Release(); } m_LineChars.RemoveAll(); m_LinePieces.RemoveAll(bLeaveMemory); @@ -249,8 +247,8 @@ class CFX_RTFBreak { int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText, FXTEXT_CHARPOS* pCharPos, FX_BOOL bCharCode = FALSE, - CFX_WideString* pWSForms = NULL, - FX_AdjustCharDisplayPos pAdjustPos = NULL) const; + CFX_WideString* pWSForms = nullptr, + FX_AdjustCharDisplayPos pAdjustPos = nullptr) const; int32_t GetCharRects(const FX_RTFTEXTOBJ* pText, CFX_RectFArray& rtArray, FX_BOOL bCharBBox = FALSE) const; diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index a272d0cfc7..0c1c6a2202 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -45,7 +45,7 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies) m_bCombText(FALSE), m_iArabicContext(1), m_iCurArabicContext(1), - m_pFont(NULL), + m_pFont(nullptr), m_iFontSize(240), m_bEquidistant(TRUE), m_iTabWidth(720000), @@ -58,11 +58,11 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies) m_iAlignment(FX_TXTLINEALIGNMENT_Left), m_dwContextCharStyles(0), m_iCombWidth(360000), - m_pUserData(NULL), + m_pUserData(nullptr), m_eCharType(FX_CHARTYPE_Unknown), m_bArabicNumber(FALSE), m_bArabicComma(FALSE), - m_pCurLine(NULL), + m_pCurLine(nullptr), m_iReady(0), m_iTolerance(0), m_iHorScale(100), @@ -113,7 +113,7 @@ void CFX_TxtBreak::SetLayoutStyles(uint32_t dwLayoutStyles) { m_iRotation %= 4; } void CFX_TxtBreak::SetFont(CFGAS_GEFont* pFont) { - if (pFont == NULL) { + if (!pFont) { return; } if (m_pFont == pFont) { @@ -122,7 +122,7 @@ void CFX_TxtBreak::SetFont(CFGAS_GEFont* pFont) { SetBreakStatus(); m_pFont = pFont; m_iDefChar = 0; - if (m_wDefChar != 0xFEFF && m_pFont != NULL) { + if (m_wDefChar != 0xFEFF && m_pFont) { m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); m_iDefChar *= m_iFontSize; } @@ -135,7 +135,7 @@ void CFX_TxtBreak::SetFontSize(FX_FLOAT fFontSize) { SetBreakStatus(); m_iFontSize = iFontSize; m_iDefChar = 0; - if (m_wDefChar != 0xFEFF && m_pFont != NULL) { + if (m_wDefChar != 0xFEFF && m_pFont) { m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); m_iDefChar *= m_iFontSize; } @@ -150,7 +150,7 @@ void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { void CFX_TxtBreak::SetDefaultChar(FX_WCHAR wch) { m_wDefChar = wch; m_iDefChar = 0; - if (m_wDefChar != 0xFEFF && m_pFont != NULL) { + if (m_wDefChar != 0xFEFF && m_pFont) { m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); if (m_iDefChar < 0) { m_iDefChar = 0; @@ -266,7 +266,7 @@ CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const { CFX_TxtCharArray& ca = *m_pCurLine->m_pLineChars; int32_t iCount = ca.GetSize(); if (index < 0 || index >= iCount) { - return NULL; + return nullptr; } CFX_TxtChar* pTC; int32_t iStart = iCount - 1; @@ -279,24 +279,21 @@ CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const { return pTC; } } - return NULL; + return nullptr; } CFX_TxtLine* CFX_TxtBreak::GetTxtLine(FX_BOOL bReady) const { - if (!bReady) { + if (!bReady) return m_pCurLine; - } - if (m_iReady == 1) { + if (m_iReady == 1) return m_pTxtLine1; - } else if (m_iReady == 2) { + if (m_iReady == 2) return m_pTxtLine2; - } else { - return NULL; - } + return nullptr; } CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(FX_BOOL bReady) const { CFX_TxtLine* pTxtLine = GetTxtLine(bReady); - if (pTxtLine == NULL) { - return NULL; + if (!pTxtLine) { + return nullptr; } return pTxtLine->m_pLinePieces; } @@ -350,7 +347,7 @@ void CFX_TxtBreak::AppendChar_PageLoad(CFX_TxtChar* pCurChar, ResetArabicContext(); if (!m_bPagination) { CFX_TxtChar* pLastChar = GetLastChar(1, FALSE); - if (pLastChar != NULL && pLastChar->m_dwStatus < 1) { + if (pLastChar && pLastChar->m_dwStatus < 1) { pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak; } } @@ -468,12 +465,12 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar, int32_t& iLineWidth = m_pCurLine->m_iWidth; FX_WCHAR wForm; int32_t iCharWidth = 0; - CFX_Char* pLastChar = NULL; + CFX_Char* pLastChar = nullptr; FX_BOOL bAlef = FALSE; if (!m_bCombText && m_eCharType >= FX_CHARTYPE_ArabicAlef && m_eCharType <= FX_CHARTYPE_ArabicDistortion) { pLastChar = GetLastChar(1); - if (pLastChar != NULL) { + if (pLastChar) { iCharWidth = pLastChar->m_iCharWidth; if (iCharWidth > 0) { iLineWidth -= iCharWidth; @@ -502,7 +499,8 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar, } } m_eCharType = chartype; - wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? NULL : pLastChar, NULL); + wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? nullptr : pLastChar, + nullptr); if (m_bCombText) { iCharWidth = m_iCombWidth; } else { @@ -585,7 +583,7 @@ uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) { pCurChar->m_iBidiLevel = 0; pCurChar->m_iBidiPos = 0; pCurChar->m_iBidiOrder = 0; - pCurChar->m_pUserData = NULL; + pCurChar->m_pUserData = nullptr; AppendChar_PageLoad(pCurChar, dwProps); uint32_t dwRet1 = FX_TXTBREAK_None; if (chartype != FX_CHARTYPE_Combination && @@ -630,7 +628,7 @@ void CFX_TxtBreak::EndBreak_UpdateArabicShapes() { pNext = m_pCurLine->GetCharPtr(i); bNextNum = (pNext->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; } else { - pNext = NULL; + pNext = nullptr; bNextNum = FALSE; } wch = pCur->m_wCharCode; @@ -923,7 +921,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) { return dwStatus; } else { CFX_TxtLine* pLastLine = GetTxtLine(TRUE); - if (pLastLine != NULL) { + if (pLastLine) { pCurPieces = pLastLine->m_pLinePieces; iCount = pCurPieces->GetSize(); if (iCount-- > 0) { @@ -1074,7 +1072,7 @@ int32_t CFX_TxtBreak::GetBreakPos(CFX_TxtCharArray& ca, void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine, CFX_TxtLine* pNextLine, FX_BOOL bAllChars) { - ASSERT(pCurLine != NULL && pNextLine != NULL); + ASSERT(pCurLine && pNextLine); int32_t iCount = pCurLine->CountChars(); if (iCount < 2) { return; @@ -1124,28 +1122,25 @@ void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine, } int32_t CFX_TxtBreak::CountBreakChars() const { CFX_TxtLine* pTxtLine = GetTxtLine(TRUE); - return pTxtLine == NULL ? 0 : pTxtLine->CountChars(); + return pTxtLine ? pTxtLine->CountChars() : 0; } int32_t CFX_TxtBreak::CountBreakPieces() const { CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(TRUE); - if (pTxtPieces == NULL) { - return 0; - } - return pTxtPieces->GetSize(); + return pTxtPieces ? pTxtPieces->GetSize() : 0; } const CFX_TxtPiece* CFX_TxtBreak::GetBreakPiece(int32_t index) const { CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(TRUE); - if (pTxtPieces == NULL) { - return NULL; + if (!pTxtPieces) { + return nullptr; } if (index < 0 || index >= pTxtPieces->GetSize()) { - return NULL; + return nullptr; } return pTxtPieces->GetPtrAt(index); } void CFX_TxtBreak::ClearBreakPieces() { CFX_TxtLine* pTxtLine = GetTxtLine(TRUE); - if (pTxtLine != NULL) { + if (pTxtLine) { pTxtLine->RemoveAll(TRUE); } m_iReady = 0; @@ -1169,7 +1164,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, FX_BOOL bCharCode, CFX_WideString* pWSForms, FX_AdjustCharDisplayPos pAdjustPos) const { - if (pTxtRun == NULL || pTxtRun->iLength < 1) { + if (!pTxtRun || pTxtRun->iLength < 1) { return 0; } IFX_TxtAccess* pAccess = pTxtRun->pAccess; @@ -1226,7 +1221,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, for (int32_t i = 0; i <= iLength; i++) { int32_t iWidth; FX_WCHAR wch; - if (pAccess != NULL) { + if (pAccess) { wch = pAccess->GetChar(pIdentity, i); iWidth = pAccess->GetWidth(pIdentity, i); } else { @@ -1242,7 +1237,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } if (chartype >= FX_CHARTYPE_ArabicAlef) { if (i < iLength) { - if (pAccess != NULL) { + if (pAccess) { iNext = i + 1; while (iNext <= iLength) { wNext = pAccess->GetChar(pIdentity, iNext); @@ -1282,7 +1277,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, bShadda = FALSE; } else { wNext = 0xFEFF; - if (pAccess != NULL) { + if (pAccess) { iNext = i + 1; if (iNext <= iLength) { wNext = pAccess->GetChar(pIdentity, iNext); @@ -1316,7 +1311,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, wForm = wch; if (bArabicNumber) { wNext = 0xFEFF; - if (pAccess != NULL) { + if (pAccess) { iNext = i + 1; if (iNext <= iLength) { wNext = pAccess->GetChar(pIdentity, iNext); @@ -1359,7 +1354,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } int32_t iForms = bLam ? 3 : 1; iCount += (bEmptyChar && bSkipSpace) ? 0 : iForms; - if (pCharPos == NULL) { + if (!pCharPos) { if (iWidth > 0) { wPrev = wch; } @@ -1556,7 +1551,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, CFX_RectFArray& rtArray, FX_BOOL bCharBBox) const { - if (pTxtRun == NULL || pTxtRun->iLength < 1) { + if (!pTxtRun || pTxtRun->iLength < 1) { return 0; } IFX_TxtAccess* pAccess = pTxtRun->pAccess; @@ -1571,7 +1566,7 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); FX_FLOAT fScale = fFontSize / 1000.0f; CFGAS_GEFont* pFont = pTxtRun->pFont; - if (pFont == NULL) { + if (!pFont) { bCharBBox = FALSE; } CFX_Rect bbox; @@ -1596,7 +1591,7 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, fStart = bRTLPiece ? rect.right() : rect.left; } for (int32_t i = 0; i < iLength; i++) { - if (pAccess != NULL) { + if (pAccess) { wch = pAccess->GetChar(pIdentity, i); iCharSize = pAccess->GetWidth(pIdentity, i); } else { @@ -1696,8 +1691,8 @@ CFX_TxtPiece::CFX_TxtPiece() m_iHorizontalScale(100), m_iVerticalScale(100), m_dwCharStyles(0), - m_pChars(NULL), - m_pUserData(NULL) {} + m_pChars(nullptr), + m_pUserData(nullptr) {} CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize) : m_iStart(0), m_iWidth(0), m_iArabicChars(0) { diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index 020fa1a3d3..3d8e3bdbb8 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -113,11 +113,11 @@ class CFX_TxtPiece : public CFX_Target { int32_t GetLength() const { return m_iChars; } int32_t GetEndChar() const { return m_iStartChar + m_iChars; } CFX_TxtChar* GetCharPtr(int32_t index) const { - ASSERT(index > -1 && index < m_iChars && m_pChars != NULL); + ASSERT(index > -1 && index < m_iChars && m_pChars); return m_pChars->GetDataPtr(m_iStartChar + index); } void GetString(FX_WCHAR* pText) const { - ASSERT(pText != NULL); + ASSERT(pText); int32_t iEndChar = m_iStartChar + m_iChars; CFX_Char* pChar; for (int32_t i = m_iStartChar; i < iEndChar; i++) { @@ -131,7 +131,7 @@ class CFX_TxtPiece : public CFX_Target { wsText.ReleaseBuffer(m_iChars); } void GetWidths(int32_t* pWidths) const { - ASSERT(pWidths != NULL); + ASSERT(pWidths); int32_t iEndChar = m_iStartChar + m_iChars; CFX_Char* pChar; for (int32_t i = m_iStartChar; i < iEndChar; i++) { @@ -229,8 +229,8 @@ class CFX_TxtBreak { int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun, FXTEXT_CHARPOS* pCharPos, FX_BOOL bCharCode = FALSE, - CFX_WideString* pWSForms = NULL, - FX_AdjustCharDisplayPos pAdjustPos = NULL) const; + CFX_WideString* pWSForms = nullptr, + FX_AdjustCharDisplayPos pAdjustPos = nullptr) const; int32_t GetCharRects(const FX_TXTRUN* pTxtRun, CFX_RectFArray& rtArray, FX_BOOL bCharBBox = FALSE) const; diff --git a/xfa/fgas/localization/fgas_datetime.cpp b/xfa/fgas/localization/fgas_datetime.cpp index f3c560b823..f658d3597d 100644 --- a/xfa/fgas/localization/fgas_datetime.cpp +++ b/xfa/fgas/localization/fgas_datetime.cpp @@ -142,7 +142,7 @@ void CFX_Unitime::Now() { #elif _FX_OS_ != _FX_EMBEDDED_ #if 1 timeval curTime; - gettimeofday(&curTime, NULL); + gettimeofday(&curTime, nullptr); #else struct timespec curTime; clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &curTime); @@ -170,7 +170,7 @@ void CFX_Unitime::SetGMTime() { #elif _FX_OS_ != _FX_EMBEDDED_ #if 1 timeval curTime; - gettimeofday(&curTime, NULL); + gettimeofday(&curTime, nullptr); #else struct timespec curTime; clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &curTime); diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index ecd33e27cf..d61f6b53ed 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -478,7 +478,7 @@ CFX_WideString CFX_FormatString::GetLocaleName( IFX_Locale* CFX_FormatString::GetTextFormat(const CFX_WideString& wsPattern, const CFX_WideStringC& wsCategory, CFX_WideString& wsPurgePattern) { - IFX_Locale* pLocale = NULL; + IFX_Locale* pLocale = nullptr; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const FX_WCHAR* pStr = wsPattern.c_str(); @@ -535,7 +535,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, uint32_t& dwStyle, CFX_WideString& wsPurgePattern) { dwStyle = 0; - IFX_Locale* pLocale = NULL; + IFX_Locale* pLocale = nullptr; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const FX_WCHAR* pStr = wsPattern.c_str(); @@ -591,7 +591,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, if (!pLocale) { pLocale = m_pLocaleMgr->GetDefLocale(); } - ASSERT(pLocale != NULL); + ASSERT(pLocale); pLocale->GetNumPattern(eSubCategory, wsSubCategory); iDotIndex = wsSubCategory.Find('.'); if (iDotIndex > 0) { @@ -1922,7 +1922,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( IFX_Locale*& pLocale, CFX_WideString& wsDatePattern, CFX_WideString& wsTimePattern) { - pLocale = NULL; + pLocale = nullptr; CFX_WideString wsTempPattern; FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; @@ -2001,7 +2001,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( if (!pLocale) { pLocale = m_pLocaleMgr->GetDefLocale(); } - ASSERT(pLocale != NULL); + ASSERT(pLocale); switch (eCategory) { case FX_LOCALECATEGORY_Date: pLocale->GetDatePattern(eSubCategory, wsDatePattern); @@ -2476,7 +2476,7 @@ FX_BOOL CFX_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, return FALSE; } CFX_WideString wsDatePattern, wsTimePattern; - IFX_Locale* pLocale = NULL; + IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern); if (!pLocale) { @@ -3991,10 +3991,10 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, return FALSE; } CFX_WideString wsDatePattern, wsTimePattern; - IFX_Locale* pLocale = NULL; + IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern); - if (pLocale == NULL || eCategory == FX_DATETIMETYPE_Unknown) { + if (!pLocale || eCategory == FX_DATETIMETYPE_Unknown) { return FALSE; } CFX_Unitime dt(0); @@ -4023,7 +4023,7 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, return FALSE; } CFX_WideString wsDatePattern, wsTimePattern; - IFX_Locale* pLocale = NULL; + IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern); if (!pLocale) { @@ -4074,7 +4074,7 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_Unitime& dt, return FALSE; } CFX_WideString wsDatePattern, wsTimePattern; - IFX_Locale* pLocale = NULL; + IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern); if (!pLocale) { diff --git a/xfa/fwl/basewidget/cfx_barcode.cpp b/xfa/fwl/basewidget/cfx_barcode.cpp index 665317989a..723619fc5f 100644 --- a/xfa/fwl/basewidget/cfx_barcode.cpp +++ b/xfa/fwl/basewidget/cfx_barcode.cpp @@ -46,7 +46,7 @@ CBC_CodeBase* CreateBarCodeEngineObject(BC_TYPE type) { return new CBC_DataMatrix(); case BC_UNKNOWN: default: - return NULL; + return nullptr; } } @@ -60,7 +60,7 @@ CFX_Barcode::~CFX_Barcode() { FX_BOOL CFX_Barcode::Create(BC_TYPE type) { m_pBCEngine = CreateBarCodeEngineObject(type); - return m_pBCEngine != NULL; + return !!m_pBCEngine; } BC_TYPE CFX_Barcode::GetType() { return m_pBCEngine ? m_pBCEngine->GetType() : BC_UNKNOWN; @@ -225,7 +225,7 @@ FX_BOOL CFX_Barcode::SetFontColor(FX_ARGB color) { } FX_BOOL CFX_Barcode::SetTextLocation(BC_TEXT_LOC location) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(BC_TEXT_LOC); - memptrtype memptr = NULL; + memptrtype memptr = nullptr; switch (GetType()) { case BC_CODE39: memptr = (memptrtype)&CBC_Code39::SetTextLocation; @@ -245,7 +245,7 @@ FX_BOOL CFX_Barcode::SetTextLocation(BC_TEXT_LOC location) { } FX_BOOL CFX_Barcode::SetWideNarrowRatio(int32_t ratio) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); - memptrtype memptr = NULL; + memptrtype memptr = nullptr; switch (GetType()) { case BC_CODE39: memptr = (memptrtype)&CBC_Code39::SetWideNarrowRatio; @@ -260,7 +260,7 @@ FX_BOOL CFX_Barcode::SetWideNarrowRatio(int32_t ratio) { } FX_BOOL CFX_Barcode::SetStartChar(FX_CHAR start) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(FX_CHAR); - memptrtype memptr = NULL; + memptrtype memptr = nullptr; switch (GetType()) { case BC_CODABAR: memptr = (memptrtype)&CBC_Codabar::SetStartChar; @@ -272,7 +272,7 @@ FX_BOOL CFX_Barcode::SetStartChar(FX_CHAR start) { } FX_BOOL CFX_Barcode::SetEndChar(FX_CHAR end) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(FX_CHAR); - memptrtype memptr = NULL; + memptrtype memptr = nullptr; switch (GetType()) { case BC_CODABAR: memptr = (memptrtype)&CBC_Codabar::SetEndChar; @@ -284,7 +284,7 @@ FX_BOOL CFX_Barcode::SetEndChar(FX_CHAR end) { } FX_BOOL CFX_Barcode::SetVersion(int32_t version) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); - memptrtype memptr = NULL; + memptrtype memptr = nullptr; switch (GetType()) { case BC_QR_CODE: memptr = (memptrtype)&CBC_QRCode::SetVersion; @@ -296,7 +296,7 @@ FX_BOOL CFX_Barcode::SetVersion(int32_t version) { } FX_BOOL CFX_Barcode::SetErrorCorrectionLevel(int32_t level) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); - memptrtype memptr = NULL; + memptrtype memptr = nullptr; switch (GetType()) { case BC_QR_CODE: memptr = (memptrtype)&CBC_QRCode::SetErrorCorrectionLevel; @@ -311,7 +311,7 @@ FX_BOOL CFX_Barcode::SetErrorCorrectionLevel(int32_t level) { } FX_BOOL CFX_Barcode::SetTruncated(FX_BOOL truncated) { typedef void (CBC_CodeBase::*memptrtype)(FX_BOOL); - memptrtype memptr = NULL; + memptrtype memptr = nullptr; switch (GetType()) { case BC_PDF417: memptr = (memptrtype)&CBC_PDF417I::SetTruncated; diff --git a/xfa/fwl/basewidget/fwl_caretimp.h b/xfa/fwl/basewidget/fwl_caretimp.h index e7484e6edc..4f16715cd1 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.h +++ b/xfa/fwl/basewidget/fwl_caretimp.h @@ -63,7 +63,7 @@ class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner); void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; protected: CFWL_CaretImp* m_pOwner; diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp index 5b22dc5abb..581e45319f 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.cpp +++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp @@ -372,7 +372,7 @@ void CFWL_CheckBoxImp::NextStates() { if (!pWidgetMgr->IsFormDisabled()) { CFX_ArrayTemplate radioarr; pWidgetMgr->GetSameGroupRadioButton(m_pInterface, radioarr); - IFWL_CheckBox* pCheckBox = NULL; + IFWL_CheckBox* pCheckBox = nullptr; int32_t iCount = radioarr.GetSize(); for (int32_t i = 0; i < iCount; i++) { pCheckBox = static_cast(radioarr[i]); diff --git a/xfa/fwl/basewidget/fwl_checkboximp.h b/xfa/fwl/basewidget/fwl_checkboximp.h index 89f680c985..5d36ff00f0 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.h +++ b/xfa/fwl/basewidget/fwl_checkboximp.h @@ -56,7 +56,7 @@ class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; protected: void OnActivate(CFWL_Message* pMsg); diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index 8d4ac452f7..ded0da51f5 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -199,7 +199,7 @@ void CFWL_ComboEditImp::SetComboBoxFocus(FX_BOOL bSet) { CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) { - ASSERT(pOuter != NULL); + ASSERT(pOuter); } FWL_Error CFWL_ComboListImp::Initialize() { if (CFWL_ListBoxImp::Initialize() != FWL_Error::Succeeded) @@ -303,7 +303,7 @@ void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { pMsg->m_fx -= rect.left; pMsg->m_fy -= rect.top; IFWL_WidgetDelegate* pDelegate = - m_pOwner->m_pVertScrollBar->SetDelegate(NULL); + m_pOwner->m_pVertScrollBar->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMsg); return; } @@ -472,7 +472,7 @@ void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_WidgetImp(properties, pOuter), - m_pForm(NULL), + m_pForm(nullptr), m_bLButtonDown(FALSE), m_iCurSel(-1), m_iBtnState(CFWL_PartState_Normal), @@ -587,7 +587,7 @@ FWL_Error CFWL_ComboBoxImp::Update() { if (bDropDown && m_pEdit) { ReSetEditAlignment(); } - if (m_pProperties->m_pThemeProvider == NULL) { + if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } Layout(); @@ -638,7 +638,7 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, ->m_pProperties->m_pDataProvider); void* p = pData->GetItemData(m_pListBox.get(), pData->GetItem(m_pListBox.get(), m_iCurSel)); - if (p != NULL) { + if (p) { param.m_pData = p; } } @@ -871,14 +871,14 @@ FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { } return FWL_Error::Succeeded; } + FWL_Error CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved) { - if (m_pEdit != NULL) { - return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); - } else { + if (!m_pEdit) return FWL_Error::ParameterInvalid; - } + return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } + FX_FLOAT CFWL_ComboBoxImp::GetListHeight() { return static_cast(m_pProperties->m_pDataProvider) ->GetListHeight(m_pInterface); @@ -938,7 +938,7 @@ void CFWL_ComboBoxImp::ShowDropList(FX_BOOL bActivate) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListDrag) { FX_FLOAT fx = 0; FX_FLOAT fy = m_rtClient.top + m_rtClient.height / 2; - TransformTo(NULL, fx, fy); + TransformTo(nullptr, fx, fy); m_bUpFormHandler = fy > m_rtProxy.top; if (m_bUpFormHandler) { m_rtHandler.Set(0, 0, m_rtList.width, m_fComboFormHandler); @@ -1598,7 +1598,7 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { } FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); if (bDropDown) { - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMsg); } } @@ -1649,7 +1649,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( pKey->m_dwKeyCode == FWL_VKEY_Escape; if (bListKey) { IFWL_WidgetDelegate* pDelegate = - m_pOwner->m_pListBox->SetDelegate(NULL); + m_pOwner->m_pListBox->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMessage); break; } @@ -1688,17 +1688,17 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, if ((m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) == 0) { CFWL_MsgSetFocus msg; msg.m_pDstTarget = m_pOwner->m_pEdit.get(); - msg.m_pSrcTarget = NULL; - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); + msg.m_pSrcTarget = nullptr; + IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr); pDelegate->OnProcessMessage(&msg); } } else { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; m_pOwner->DisForm_ShowDropList(FALSE); CFWL_MsgKillFocus msg; - msg.m_pDstTarget = NULL; + msg.m_pDstTarget = nullptr; msg.m_pSrcTarget = m_pOwner->m_pEdit.get(); - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr); pDelegate->OnProcessMessage(&msg); } } @@ -1743,7 +1743,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { return; } if (m_pOwner->m_pEdit) { - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMsg); } } @@ -1852,7 +1852,7 @@ void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) { void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet) { if (!bSet) { - if (pMsg->m_pSetFocus == NULL) { + if (!pMsg->m_pSetFocus) { m_pComboBox->ShowDropList(FALSE); } } diff --git a/xfa/fwl/basewidget/fwl_comboboximp.h b/xfa/fwl/basewidget/fwl_comboboximp.h index 42452e6871..0ed5dbb1fa 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.h +++ b/xfa/fwl/basewidget/fwl_comboboximp.h @@ -170,7 +170,7 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { FWL_Error DisForm_Update(); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); FWL_Error DisForm_GetBBox(CFX_RectF& rect); void DisForm_Layout(); @@ -199,7 +199,7 @@ class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); @@ -226,7 +226,7 @@ class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate { CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox); void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; void Reset() { m_bLButtonUpSelf = FALSE; } protected: diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index bf534a7a97..d02f8483dd 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -183,7 +183,7 @@ void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (dwHashCode == CFWL_MessageType::SetFocus || dwHashCode == CFWL_MessageType::KillFocus) { IFWL_Widget* pOuter = m_pOwner->GetOuter(); - IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMessage); } } @@ -243,7 +243,7 @@ void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( if (dwCode == CFWL_MessageType::SetFocus || dwCode == CFWL_MessageType::KillFocus) { IFWL_Widget* pOuter = m_pOwner->GetOuter(); - IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMessage); return; } @@ -900,7 +900,7 @@ void CFWL_DateTimePickerImp::DisForm_ShowMonthCalendar(FX_BOOL bActivate) { CFWL_MsgSetFocus msg; msg.m_pDstTarget = m_pMonthCal.get(); msg.m_pSrcTarget = m_pEdit.get(); - IFWL_WidgetDelegate* pDelegate = m_pEdit->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pEdit->SetDelegate(nullptr); pDelegate->OnProcessMessage(&msg); } CFX_RectF rtInvalidate, rtCal; @@ -1065,7 +1065,8 @@ void CFWL_DateTimePickerImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Key: { if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = + m_pOwner->m_pEdit->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMessage); return; } @@ -1164,7 +1165,7 @@ void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, } rtInvalidate = m_pOwner->m_rtBtn; pMsg->m_pDstTarget = m_pOwner->m_pEdit.get(); - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMsg); } else { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; @@ -1174,7 +1175,7 @@ void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, } if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMsg); } } diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.h b/xfa/fwl/basewidget/fwl_datetimepickerimp.h index 5ec22c1fac..8306a26ba8 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.h +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.h @@ -216,7 +216,7 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); FWL_Error DisForm_GetBBox(CFX_RectF& rect); FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); }; class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { @@ -226,7 +226,7 @@ class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { // CFWL_WidgetImpDelegate void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 3fdd999d5d..ae0b7bcc9f 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -203,7 +203,7 @@ CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties, m_fVAlignOffset(0.0f), m_fScrollOffsetX(0.0f), m_fScrollOffsetY(0.0f), - m_pEdtEngine(NULL), + m_pEdtEngine(nullptr), m_bLButtonDown(FALSE), m_nSelStart(0), m_nLimit(-1), @@ -489,7 +489,7 @@ void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics, pGraphics->SetClipRect(rtClip); pGraphics->SetStrokeColor(&crLine); pGraphics->SetLineWidth(0); - pGraphics->StrokePath(&pathSpell, NULL); + pGraphics->StrokePath(&pathSpell, nullptr); } pGraphics->RestoreGraphState(); } @@ -1364,13 +1364,13 @@ IFWL_ScrollBar* CFWL_EditImp::UpdateScroll() { m_pVertScrollBar && ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Invisible) == 0); if (!bShowHorz && !bShowVert) { - return NULL; + return nullptr; } IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0); if (!pPage) - return NULL; + return nullptr; const CFX_RectF& rtFDE = pPage->GetContentsBox(); - IFWL_ScrollBar* pRepaint = NULL; + IFWL_ScrollBar* pRepaint = nullptr; if (bShowHorz) { CFX_RectF rtScroll; m_pHorzScrollBar->GetWidgetRect(rtScroll); @@ -1551,7 +1551,7 @@ void CFWL_EditImp::LayoutScrollBar() { 0) { return; } - FX_FLOAT* pfWidth = NULL; + FX_FLOAT* pfWidth = nullptr; FX_BOOL bShowVertScrollbar = IsShowScrollBar(TRUE); FX_BOOL bShowHorzScrollbar = IsShowScrollBar(FALSE); if (bShowVertScrollbar) { diff --git a/xfa/fwl/basewidget/fwl_editimp.h b/xfa/fwl/basewidget/fwl_editimp.h index 8f729f32e0..3f7a3862dd 100644 --- a/xfa/fwl/basewidget/fwl_editimp.h +++ b/xfa/fwl/basewidget/fwl_editimp.h @@ -42,7 +42,7 @@ class CFWL_EditImp : public CFWL_WidgetImp { FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; virtual FWL_Error SetText(const CFX_WideString& wsText); @@ -111,10 +111,10 @@ class CFWL_EditImp : public CFWL_WidgetImp { void DrawTextBk(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawContent(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void UpdateEditEngine(); void UpdateEditParams(); void UpdateEditLayout(); @@ -128,7 +128,7 @@ class CFWL_EditImp : public CFWL_WidgetImp { void DeviceToEngine(CFX_PointF& pt); void InitScrollBar(FX_BOOL bVert = TRUE); void InitEngine(); - virtual void ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect = NULL); + virtual void ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect = nullptr); FX_BOOL ValidateNumberChar(FX_WCHAR cNum); void InitCaret(); void ClearRecord(); @@ -138,7 +138,7 @@ class CFWL_EditImp : public CFWL_WidgetImp { void ProcessInsertError(int32_t iError); void DrawSpellCheck(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void AddSpellCheckObj(CFX_Path& PathData, int32_t nStart, int32_t nCount, @@ -181,7 +181,7 @@ class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { 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 DoActivate(CFWL_MsgActivate* pMsg); diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.cpp b/xfa/fwl/basewidget/fwl_formproxyimp.cpp index 2b76078e0c..0317ae38b2 100644 --- a/xfa/fwl/basewidget/fwl_formproxyimp.cpp +++ b/xfa/fwl/basewidget/fwl_formproxyimp.cpp @@ -54,6 +54,6 @@ CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner) : m_pOwner(pOwner) {} void CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMessage); } diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index 7198480b41..7a487f6363 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -68,10 +68,10 @@ CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, : CFWL_WidgetImp(properties, pOuter), m_dwTTOStyles(0), m_iTTOAligns(0), - m_hAnchor(NULL), + m_hAnchor(nullptr), m_fScorllBarWidth(0), m_bLButtonDown(FALSE), - m_pScrollBarTP(NULL) { + m_pScrollBarTP(nullptr) { m_rtClient.Reset(); m_rtConent.Reset(); m_rtStatic.Reset(); @@ -230,7 +230,7 @@ int32_t CFWL_ListBoxImp::CountSelItems() { } IFWL_ListItem* CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) { if (!m_pProperties->m_pDataProvider) - return NULL; + return nullptr; int32_t index = 0; IFWL_ListBoxDP* pData = static_cast(m_pProperties->m_pDataProvider); @@ -238,7 +238,7 @@ IFWL_ListItem* CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) { for (int32_t i = 0; i < iCount; i++) { IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); if (!pItem) { - return NULL; + return nullptr; } uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem); if (dwStyle & FWL_ITEMSTATE_LTB_Selected) { @@ -249,7 +249,7 @@ IFWL_ListItem* CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) { } } } - return NULL; + return nullptr; } int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) { if (!m_pProperties->m_pDataProvider) @@ -282,7 +282,7 @@ FWL_Error CFWL_ListBoxImp::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) { SelectAll(); } else { ClearSelection(); - SetFocusItem(NULL); + SetFocusItem(nullptr); } return FWL_Error::Indefinite; } @@ -317,7 +317,7 @@ FWL_Error CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { IFWL_ListItem* CFWL_ListBoxImp::GetItem(IFWL_ListItem* pItem, uint32_t dwKeyCode) { - IFWL_ListItem* hRet = NULL; + IFWL_ListItem* hRet = nullptr; switch (dwKeyCode) { case FWL_VKEY_Up: case FWL_VKEY_Down: @@ -422,12 +422,12 @@ IFWL_ListItem* CFWL_ListBoxImp::GetFocusedItem() { for (int32_t i = 0; i < iCount; i++) { IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); if (!pItem) - return NULL; + return nullptr; if (pData->GetItemStyles(m_pInterface, pItem) & FWL_ITEMSTATE_LTB_Focused) { return pItem; } } - return NULL; + return nullptr; } void CFWL_ListBoxImp::SetFocusItem(IFWL_ListItem* pItem) { IFWL_ListBoxDP* pData = @@ -471,7 +471,7 @@ IFWL_ListItem* CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { return pItem; } } - return NULL; + return nullptr; } FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(IFWL_ListItem* pItem, CFX_RectF& rtCheck) { @@ -958,7 +958,7 @@ void CFWL_ListBoxImp::ProcessSelChanged() { int32_t iCount = CountSelItems(); for (int32_t i = 0; i < iCount; i++) { IFWL_ListItem* item = GetSelItem(i); - if (item == NULL) { + if (!item) { continue; } selEvent.iarraySels.Add(i); @@ -1117,7 +1117,7 @@ void CFWL_ListBoxImpDelegate::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) { return; } IFWL_WidgetDelegate* pDelegate = - m_pOwner->m_pVertScrollBar->SetDelegate(NULL); + m_pOwner->m_pVertScrollBar->SetDelegate(nullptr); pDelegate->OnProcessMessage(pMsg); } void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { diff --git a/xfa/fwl/basewidget/fwl_listboximp.h b/xfa/fwl/basewidget/fwl_listboximp.h index 1a7a9419e5..6a2fcb138e 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.h +++ b/xfa/fwl/basewidget/fwl_listboximp.h @@ -66,16 +66,16 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { FX_BOOL ScrollToVisible(IFWL_ListItem* hItem); void DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawItems(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawItem(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, IFWL_ListItem* hItem, int32_t Index, const CFX_RectF& rtItem, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE); void GetItemSize(CFX_SizeF& size, @@ -109,7 +109,7 @@ class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index 209a857dad..ca141a2d7a 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -235,7 +235,7 @@ FWL_Error CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { if (!pGraphics) return FWL_Error::Indefinite; - if (m_pProperties->m_pThemeProvider == NULL) { + if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/basewidget/fwl_monthcalendarimp.h index a3a8f45aa0..db6ce7801c 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.h @@ -231,7 +231,7 @@ class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate { CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner); void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; protected: void OnActivate(CFWL_Message* pMsg); diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.h b/xfa/fwl/basewidget/fwl_pictureboximp.h index 9fa065216a..eb466c108e 100644 --- a/xfa/fwl/basewidget/fwl_pictureboximp.h +++ b/xfa/fwl/basewidget/fwl_pictureboximp.h @@ -35,7 +35,7 @@ class CFWL_PictureBoxImp : public CFWL_WidgetImp { void DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); FX_BOOL VStyle(FX_BOOL dwStyle); CFX_RectF m_rtClient; @@ -50,7 +50,7 @@ class CFWL_PictureBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_PictureBoxImpDelegate(CFWL_PictureBoxImp* pOwner); void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; protected: CFWL_PictureBoxImp* m_pOwner; diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp index 77c93f4537..834342ec93 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp @@ -67,7 +67,7 @@ FWL_Error CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); - if (m_pProperties->m_pThemeProvider == NULL) { + if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } CFX_WideString wsCaption; @@ -122,7 +122,7 @@ FWL_Error CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_Error::Indefinite; IFWL_PushButtonDP* pData = static_cast(m_pProperties->m_pDataProvider); - CFX_DIBitmap* pPicture = NULL; + CFX_DIBitmap* pPicture = nullptr; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.h b/xfa/fwl/basewidget/fwl_pushbuttonimp.h index 79a4859cc9..31ad5519bb 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.h +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.h @@ -57,7 +57,7 @@ class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.h b/xfa/fwl/basewidget/fwl_scrollbarimp.h index 4410830707..4a7a4634ab 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.h +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.h @@ -54,14 +54,14 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { void DrawTrack(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, FX_BOOL bLower = TRUE, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawArrowBtn(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, FX_BOOL bMinBtn = TRUE, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawThumb(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void Layout(); void CalcButtonLen(); void CalcMinButtonRect(CFX_RectF& rect); @@ -111,7 +111,7 @@ class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + const CFX_Matrix* pMatrix = nullptr) override; protected: void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.h b/xfa/fwl/basewidget/fwl_spinbuttonimp.h index d986f31cd2..3eca307cdc 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.h +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.h @@ -64,7 +64,7 @@ class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate { 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h index c21a47ec07..79e3f49f18 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h @@ -80,7 +80,7 @@ class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/core/cfwl_themetext.h b/xfa/fwl/core/cfwl_themetext.h index 7f3dde91d8..c8929bd1f0 100644 --- a/xfa/fwl/core/cfwl_themetext.h +++ b/xfa/fwl/core/cfwl_themetext.h @@ -13,7 +13,7 @@ class CFWL_ThemeText : public CFWL_ThemePart { public: - CFWL_ThemeText() : m_pGraphics(NULL) {} + CFWL_ThemeText() : m_pGraphics(nullptr) {} CFX_WideString m_wsText; uint32_t m_dwTTOStyles; int32_t m_iTTOAlign; diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp index d36ab7792b..b4f3a864bf 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.cpp +++ b/xfa/fwl/core/cfwl_widgetmgr.cpp @@ -139,8 +139,8 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { if (pItem->pParent->pChild == pItem) { pItem->pParent->pChild = pItem->pNext; } - pItem->pNext = NULL; - pItem->pPrevious = NULL; + pItem->pNext = nullptr; + pItem->pPrevious = nullptr; break; } if (!pChild->pNext) { @@ -157,7 +157,7 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { } pChild->pNext = pItem; pItem->pPrevious = pChild; - pItem->pNext = NULL; + pItem->pNext = nullptr; return TRUE; } i = 0; @@ -168,7 +168,7 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { if (!pChild->pNext) { pChild->pNext = pItem; pItem->pPrevious = pChild; - pItem->pNext = NULL; + pItem->pNext = nullptr; return TRUE; } if (pChild->pPrevious) { @@ -182,8 +182,8 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { } } else { pItem->pParent->pChild = pItem; - pItem->pPrevious = NULL; - pItem->pNext = NULL; + pItem->pPrevious = nullptr; + pItem->pNext = nullptr; } return TRUE; } @@ -213,7 +213,7 @@ FWL_Error CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, return m_pAdapter->RepaintWidget(pNative, &rect); } void CFWL_WidgetMgr::AddWidget(IFWL_Widget* pWidget) { - CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(NULL); + CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(nullptr); CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); if (!pItem) { pItem = new CFWL_WidgetMgrItem(pWidget); @@ -314,8 +314,8 @@ void CFWL_WidgetMgr::SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild) { if (pItem->pParent->pChild == pItem) { pItem->pParent->pChild = pItem->pNext; } - pItem->pNext = NULL; - pItem->pPrevious = NULL; + pItem->pNext = nullptr; + pItem->pPrevious = nullptr; } pItem->pParent = pParentItem; SetWidgetIndex(pChild, -1); @@ -357,7 +357,7 @@ IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent, FX_FLOAT x, FX_FLOAT y) { if (!parent) - return NULL; + return nullptr; FX_FLOAT x1; FX_FLOAT y1; IFWL_Widget* child = GetLastChildWidget(parent); @@ -453,7 +453,7 @@ void CFWL_WidgetMgr::GetSameGroupRadioButton( int32_t iGroup = CountRadioButtonGroup(pFirst); if (iGroup < 2) { IFWL_Widget* pNext = pFirst; - while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != NULL) { + while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != nullptr) { group.Add(pNext); } return; @@ -484,7 +484,7 @@ IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { } child = CFWL_WidgetMgr::GetInstance()->GetNextSiblingWidget(child); } - return NULL; + return nullptr; } void CFWL_WidgetMgr::AddRedrawCounts(IFWL_Widget* pWidget) { CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); @@ -621,20 +621,20 @@ void CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \ _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_ - IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr); pDelegate->OnDrawWidget(pTemp, pMatrix); pGraphics->GetClipRect(clipBounds); clipCopy = clipBounds; #elif _FX_OS_ == _FX_MACOSX_ if (m_pWidgetMgr->IsFormDisabled()) { - IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr); pDelegate->OnDrawWidget(pTemp, pMatrix); pGraphics->GetClipRect(clipBounds); clipCopy = clipBounds; } else { clipBounds.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d); const_cast(pMatrix)->SetIdentity(); // FIXME: const cast. - IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr); pDelegate->OnDrawWidget(pTemp, pMatrix); } #endif // _FX_OS_ == _FX_MACOSX_ @@ -688,7 +688,7 @@ void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, pGraphics->SetClipRect(clipBounds); } widgetMatrix.Translate(rtWidget.left, rtWidget.top, TRUE); - IFWL_WidgetDelegate* pDelegate = child->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = child->SetDelegate(nullptr); if (pDelegate) { if (m_pWidgetMgr->IsFormDisabled() || IsNeedRepaint(child, &widgetMatrix, rtClip)) { diff --git a/xfa/fwl/core/cfwl_widgetmgr.h b/xfa/fwl/core/cfwl_widgetmgr.h index 1f0df3beb6..346785fd97 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.h +++ b/xfa/fwl/core/cfwl_widgetmgr.h @@ -62,7 +62,8 @@ class CFWL_WidgetMgr { IFWL_Widget* GetSystemFormWidget(IFWL_Widget* pWidget) const; FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex); - FWL_Error RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect = NULL); + FWL_Error RepaintWidget(IFWL_Widget* pWidget, + const CFX_RectF* pRect = nullptr); void AddWidget(IFWL_Widget* pWidget); void InsertWidget(IFWL_Widget* pParent, @@ -99,7 +100,7 @@ class CFWL_WidgetMgr { int32_t TravelWidgetMgr(CFWL_WidgetMgrItem* pParent, int32_t* pIndex, CFWL_WidgetMgrItem* pItem, - IFWL_Widget** pWidget = NULL); + IFWL_Widget** pWidget = nullptr); FX_BOOL IsAbleNative(IFWL_Widget* pWidget) const; uint32_t m_dwCapability; diff --git a/xfa/fwl/core/fwl_appimp.cpp b/xfa/fwl/core/fwl_appimp.cpp index 2c4258ce74..2df579ca38 100644 --- a/xfa/fwl/core/fwl_appimp.cpp +++ b/xfa/fwl/core/fwl_appimp.cpp @@ -103,7 +103,7 @@ IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const { CXFA_FFApp* FWL_GetAdapterNative() { IFWL_App* pApp = FWL_GetApp(); if (!pApp) - return NULL; + return nullptr; return pApp->GetAdapterNative(); } diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 8b4ef9fc43..a3fc6be816 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -397,8 +397,8 @@ IFWL_Widget* CFWL_FormImp::DoModal() { pDriver->PopNoteLoop(); #endif delete m_pNoteLoop; - m_pNoteLoop = NULL; - return NULL; + m_pNoteLoop = nullptr; + return nullptr; } IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { return DoModal(); @@ -499,7 +499,7 @@ CFWL_SysBtn* CFWL_FormImp::GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy) { if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) { return m_pCaptionBox; } - return NULL; + return nullptr; } CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) { if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) { @@ -514,7 +514,7 @@ CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) { if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) { return m_pCaptionBox; } - return NULL; + return nullptr; } CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) { if (nIndex < 0) @@ -801,7 +801,7 @@ void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft, FX_BOOL bLeft) { FX_FLOAT fx = fCurX; FX_FLOAT fy = 0; - TransformTo(NULL, fx, fy); + TransformTo(nullptr, fx, fy); FX_FLOAT fTemp = bLeft ? (fWidth - fx + fLeft + fSpace) : (fx - fLeft + fSpace); if (fTemp >= fLimitMin && fTemp <= fLimitMax) { @@ -826,7 +826,7 @@ void CFWL_FormImp::DoHeightLimit(FX_FLOAT& fTop, FX_BOOL bTop) { FX_FLOAT fx = 0; FX_FLOAT fy = fCurY; - TransformTo(NULL, fx, fy); + TransformTo(nullptr, fx, fy); FX_FLOAT fTemp = bTop ? (fHeight - fy + fTop + fSpace) : (fy - fTop + fSpace); if (fTemp >= fLimitMin && fTemp <= fLimitMax) { fHeight = fTemp; diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index 7278afb681..ee1507d17e 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -94,10 +94,10 @@ class CFWL_FormImp : public CFWL_WidgetImp { FX_FLOAT GetCaptionHeight(); void DrawCaptionText(CFX_Graphics* pGs, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawIconImage(CFX_Graphics* pGs, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void GetEdgeRect(CFX_RectF& rtEdge); void SetWorkAreaRect(); void SetCursor(FX_FLOAT fx, FX_FLOAT fy); @@ -162,7 +162,7 @@ class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate { 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 OnLButtonDown(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index b38592b2d3..cc5ff8d432 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -163,7 +163,7 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { if (bNotify) { ms.m_dwExtend = 1; } - IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(nullptr); if (pDelegate) { pDelegate->OnProcessMessage(&ms); } @@ -183,7 +183,7 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { if (bNotify) { ms.m_dwExtend = 1; } - IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(nullptr); if (pDelegate) { pDelegate->OnProcessMessage(&ms); } @@ -197,7 +197,7 @@ FWL_Error CFWL_NoteDriver::Run() { #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ _FX_OS_ == _FX_WIN64_) - CFWL_NoteLoop* pTopLoop = NULL; + CFWL_NoteLoop* pTopLoop = nullptr; for (;;) { pTopLoop = GetTopLoop(); if (!pTopLoop || !pTopLoop->ContinueModal()) @@ -220,28 +220,28 @@ void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { m_pHover = pHover; } void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) { - m_pGrab = bSet ? pGrab : NULL; + m_pGrab = bSet ? pGrab : nullptr; } void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) { if (m_pFocus == pNoteTarget) { - m_pFocus = NULL; + m_pFocus = nullptr; } if (m_pHover == pNoteTarget) { - m_pHover = NULL; + m_pHover = nullptr; } if (m_pGrab == pNoteTarget) { - m_pGrab = NULL; + m_pGrab = nullptr; } } void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) { if (m_pFocus == pNoteTarget) { - m_pFocus = NULL; + m_pFocus = nullptr; } if (m_pHover == pNoteTarget) { - m_pHover = NULL; + m_pHover = nullptr; } if (m_pGrab == pNoteTarget) { - m_pGrab = NULL; + m_pGrab = nullptr; } UnregisterEventTarget(pNoteTarget); int32_t count = m_forms.GetSize(); @@ -254,7 +254,7 @@ void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) { if (!pSubFocus) return; if (pSubFocus && pSubFocus->GetInterface() == pNoteTarget) { - pForm->SetSubFocus(NULL); + pForm->SetSubFocus(nullptr); } } } @@ -388,7 +388,8 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, } } if (bRet) { - IFWL_WidgetDelegate* pDelegate = pMessage->m_pDstTarget->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = + pMessage->m_pDstTarget->SetDelegate(nullptr); if (pDelegate) pDelegate->OnProcessMessage(pMessage); } @@ -458,7 +459,7 @@ FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); if (pWidgetMgr->IsFormDisabled()) { if (m_pFocus == pMsg->m_pDstTarget) { - m_pFocus = NULL; + m_pFocus = nullptr; } return TRUE; } @@ -470,7 +471,7 @@ FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { pMsg->m_pDstTarget = pSubFocus->GetInterface(); if (m_pFocus == pMsg->m_pDstTarget) { - m_pFocus = NULL; + m_pFocus = nullptr; return TRUE; } } @@ -523,7 +524,7 @@ FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || pMsg->m_dwCmd == FWL_MouseCommand::Hover || pMsg->m_dwCmd == FWL_MouseCommand::Enter) { - return pMsg->m_pDstTarget != NULL; + return !!pMsg->m_pDstTarget; } if (pMsg->m_pDstTarget != pMessageForm) { pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); @@ -569,7 +570,7 @@ FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); if (!pWidgetMgr) return FALSE; - IFWL_Widget* pTarget = NULL; + IFWL_Widget* pTarget = nullptr; if (m_pGrab) pTarget = m_pGrab; if (!pTarget) { @@ -706,7 +707,7 @@ int32_t CFWL_CoreToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { } CFX_DIBitmap* CFWL_CoreToolTipDP::GetToolTipIcon(IFWL_Widget* pWidget) { - return NULL; + return nullptr; } CFX_SizeF CFWL_CoreToolTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) { @@ -734,7 +735,7 @@ int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, } FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { - IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(nullptr); if (!pDelegate) return FALSE; if (m_eventSources.GetCount() == 0) { @@ -743,7 +744,7 @@ FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { } FX_POSITION pos = m_eventSources.GetStartPosition(); while (pos) { - IFWL_Widget* pSource = NULL; + IFWL_Widget* pSource = nullptr; uint32_t dwFilter = 0; m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); if (pSource == pEvent->m_pSrcTarget || @@ -784,10 +785,10 @@ FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { } } -CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = NULL; +CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr; CFWL_ToolTipContainer::CFWL_ToolTipContainer() - : pCurTarget(NULL), m_pToolTipImp(NULL) { + : pCurTarget(nullptr), m_pToolTipImp(nullptr) { m_ToolTipDp = new CFWL_CoreToolTipDP; m_ToolTipDp->m_nInitDelayTime = 0; m_ToolTipDp->m_nAutoPopDelayTime = 2000; @@ -812,7 +813,7 @@ CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { // static void CFWL_ToolTipContainer::DeleteInstance() { delete s_pInstance; - s_pInstance = NULL; + s_pInstance = nullptr; } FWL_Error CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { @@ -845,7 +846,7 @@ FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) { FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt, IFWL_Widget* pOwner) { if (HasToolTip(pEvt->m_pDstTarget)) { - if (NULL == m_pToolTipImp) { + if (!m_pToolTipImp) { CFWL_WidgetImpProperties prop; prop.m_pDataProvider = m_ToolTipDp; prop.m_pOwner = pOwner; @@ -884,7 +885,8 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt, } else { CFX_RectF rtAnchor; pCurTarget->GetWidget()->GetClientRect(rtAnchor); - pCurTarget->GetWidget()->TransformTo(NULL, rtAnchor.left, rtAnchor.top); + pCurTarget->GetWidget()->TransformTo(nullptr, rtAnchor.left, + rtAnchor.top); m_pToolTipImp->SetAnchor(rtAnchor); m_pToolTipImp->ModifyStylesEx(0, FWL_STYLEEXT_TTP_NoAnchor); } @@ -897,9 +899,9 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt, return FALSE; } FX_BOOL CFWL_ToolTipContainer::ProcessLeave(CFWL_EvtMouse* pEvt) { - if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { + if (HasToolTip(pEvt->m_pDstTarget) && m_pToolTipImp) { m_pToolTipImp->Hide(); - pCurTarget = NULL; + pCurTarget = nullptr; return TRUE; } return FALSE; diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index d556499e27..52a2978908 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -245,7 +245,7 @@ FWL_Error CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { ev.m_pSrcTarget = m_pInterface; ev.m_rtOld = rtOld; ev.m_rtNew = rect; - IFWL_WidgetDelegate* pDelegate = SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = SetDelegate(nullptr); if (pDelegate) { pDelegate->OnProcessEvent(&ev); } @@ -625,7 +625,7 @@ void CFWL_WidgetImp::GetRelativeRect(CFX_RectF& rect) { void* CFWL_WidgetImp::GetThemeCapacity(CFWL_WidgetCapacity dwCapacity) { IFWL_ThemeProvider* pTheme = GetAvailableTheme(); if (!pTheme) - return NULL; + return nullptr; CFWL_ThemePart part; part.m_pWidget = m_pInterface; return pTheme->GetCapacity(&part, dwCapacity); @@ -710,7 +710,7 @@ void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) { if (bFocus && curFocus != m_pInterface) { pDriver->SetFocus(m_pInterface); } else if (!bFocus && curFocus == m_pInterface) { - pDriver->SetFocus(NULL); + pDriver->SetFocus(nullptr); } } void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) { @@ -753,7 +753,7 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosMenu(FX_FLOAT fMinHeight, if (GetStylesEx() & FWL_STYLEEXT_MNU_Vert) { FX_BOOL bLeft = m_pProperties->m_rtWidget.left < 0; FX_FLOAT fRight = rtAnchor.right() + rtPopup.width; - TransformTo(NULL, fx, fy); + TransformTo(nullptr, fx, fy); if (fRight + fx > fScreenWidth || bLeft) { rtPopup.Set(rtAnchor.left - rtPopup.width, rtAnchor.top, rtPopup.width, rtPopup.height); @@ -763,7 +763,7 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosMenu(FX_FLOAT fMinHeight, } } else { FX_FLOAT fBottom = rtAnchor.bottom() + rtPopup.height; - TransformTo(NULL, fx, fy); + TransformTo(nullptr, fx, fy); if (fBottom + fy > fScreenHeight) { rtPopup.Set(rtAnchor.left, rtAnchor.top - rtPopup.height, rtPopup.width, rtPopup.height); @@ -792,7 +792,7 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosComboBox(FX_FLOAT fMinHeight, } FX_FLOAT fWidth = std::max(rtAnchor.width, rtPopup.width); FX_FLOAT fBottom = rtAnchor.bottom() + fPopHeight; - TransformTo(NULL, fx, fy); + TransformTo(nullptr, fx, fy); if (fBottom + fy > fScreenHeight) { rtPopup.Set(rtAnchor.left, rtAnchor.top - fPopHeight, fWidth, fPopHeight); } else { @@ -810,7 +810,7 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosGeneral(FX_FLOAT fMinHeight, FX_FLOAT fScreenWidth = 0; FX_FLOAT fScreenHeight = 0; GetScreenSize(fScreenWidth, fScreenHeight); - TransformTo(NULL, fx, fy); + TransformTo(nullptr, fx, fy); if (rtAnchor.bottom() + fy > fScreenHeight) { rtPopup.Set(rtAnchor.left, rtAnchor.top - rtPopup.height, rtPopup.width, rtPopup.height); @@ -860,7 +860,7 @@ void CFWL_WidgetImp::DispatchKeyEvent(CFWL_MsgKey* pNote) { } void CFWL_WidgetImp::DispatchEvent(CFWL_Event* pEvent) { if (m_pOuter) { - IFWL_WidgetDelegate* pDelegate = m_pOuter->SetDelegate(NULL); + IFWL_WidgetDelegate* pDelegate = m_pOuter->SetDelegate(nullptr); pDelegate->OnProcessEvent(pEvent); return; } diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h index be97c060f2..d8c4fe6eb6 100644 --- a/xfa/fwl/core/fwl_widgetimp.h +++ b/xfa/fwl/core/fwl_widgetimp.h @@ -63,7 +63,7 @@ class CFWL_WidgetImp { virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); virtual IFWL_ThemeProvider* GetThemeProvider(); virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); virtual FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); @@ -132,24 +132,24 @@ class CFWL_WidgetImp { const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); FX_BOOL GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy); - void RegisterEventTarget(IFWL_Widget* pEventSource = NULL, + void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr, uint32_t dwFilter = FWL_EVENT_ALL_MASK); void UnregisterEventTarget(); void DispatchKeyEvent(CFWL_MsgKey* pNote); void DispatchEvent(CFWL_Event* pEvent); - void Repaint(const CFX_RectF* pRect = NULL); + void Repaint(const CFX_RectF* pRect = nullptr); void DrawBackground(CFX_Graphics* pGraphics, CFWL_Part iPartBk, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawBorder(CFX_Graphics* pGraphics, CFWL_Part iPartBorder, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void DrawEdge(CFX_Graphics* pGraphics, CFWL_Part iPartEdge, IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); void NotifyDriver(); FX_BOOL IsParent(IFWL_Widget* pParent); @@ -174,7 +174,7 @@ class CFWL_WidgetImpDelegate : 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; }; #endif // XFA_FWL_CORE_FWL_WIDGETIMP_H_ diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index 90a484def2..21099921e8 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -93,7 +93,7 @@ class IFWL_Widget { FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); FWL_Error SetMatrix(const CFX_Matrix& matrix); FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); IFWL_ThemeProvider* GetThemeProvider(); FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); diff --git a/xfa/fwl/lightwidget/cfwl_barcode.h b/xfa/fwl/lightwidget/cfwl_barcode.h index 1a22064a97..466ff6ed09 100644 --- a/xfa/fwl/lightwidget/cfwl_barcode.h +++ b/xfa/fwl/lightwidget/cfwl_barcode.h @@ -17,7 +17,7 @@ class CFWL_WidgetProperties; class CFWL_Barcode : public CFWL_Edit { public: static CFWL_Barcode* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); void SetType(BC_TYPE type); FX_BOOL IsProtectedType(); diff --git a/xfa/fwl/lightwidget/cfwl_checkbox.h b/xfa/fwl/lightwidget/cfwl_checkbox.h index 7fcd43a6eb..eb23536e25 100644 --- a/xfa/fwl/lightwidget/cfwl_checkbox.h +++ b/xfa/fwl/lightwidget/cfwl_checkbox.h @@ -17,7 +17,7 @@ class CFWL_CheckBox : public CFWL_Widget { static CFWL_CheckBox* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error SetCaption(const CFX_WideStringC& wsCaption); FWL_Error SetBoxSize(FX_FLOAT fHeight); int32_t GetCheckState(); diff --git a/xfa/fwl/lightwidget/cfwl_combobox.cpp b/xfa/fwl/lightwidget/cfwl_combobox.cpp index 9d20c97824..01b64dcd07 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.cpp +++ b/xfa/fwl/lightwidget/cfwl_combobox.cpp @@ -169,9 +169,7 @@ FWL_Error CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) { void* CFWL_ComboBox::GetItemData(int32_t iIndex) { CFWL_ComboBoxItem* pItem = static_cast(m_comboBoxData.GetItem(m_pIface, iIndex)); - if (!pItem) - return NULL; - return pItem->m_pData; + return pItem ? pItem->m_pData : nullptr; } FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { @@ -357,9 +355,7 @@ FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget, void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) { - if (!pItem) - return NULL; - return static_cast(pItem)->m_pData; + return pItem ? static_cast(pItem)->m_pData : nullptr; } FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, @@ -396,9 +392,7 @@ FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon( IFWL_Widget* pWidget, IFWL_ListItem* pItem) { - if (!pItem) - return NULL; - return static_cast(pItem)->m_pDIB; + return pItem ? static_cast(pItem)->m_pDIB : nullptr; } FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, diff --git a/xfa/fwl/lightwidget/cfwl_combobox.h b/xfa/fwl/lightwidget/cfwl_combobox.h index ba5db16f87..ab703fe372 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.h +++ b/xfa/fwl/lightwidget/cfwl_combobox.h @@ -24,7 +24,7 @@ class CFWL_ComboBox : public CFWL_Widget { ~CFWL_ComboBox() override; static CFWL_ComboBox* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); int32_t AddString(const CFX_WideStringC& wsText); int32_t AddString(const CFX_WideStringC& wsText, CFX_DIBitmap* pIcon); bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range. diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.h b/xfa/fwl/lightwidget/cfwl_datetimepicker.h index 2fa385fede..4348b6cd38 100644 --- a/xfa/fwl/lightwidget/cfwl_datetimepicker.h +++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.h @@ -14,7 +14,7 @@ class CFWL_DateTimePicker : public CFWL_Widget { public: static CFWL_DateTimePicker* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error SetToday(int32_t iYear, int32_t iMonth, int32_t iDay); FWL_Error GetEditText(CFX_WideString& wsText); FWL_Error SetEditText(const CFX_WideString& wsText); diff --git a/xfa/fwl/lightwidget/cfwl_edit.h b/xfa/fwl/lightwidget/cfwl_edit.h index a9c058a514..a6db961a2b 100644 --- a/xfa/fwl/lightwidget/cfwl_edit.h +++ b/xfa/fwl/lightwidget/cfwl_edit.h @@ -20,7 +20,7 @@ class CFWL_Edit : public CFWL_Widget { ~CFWL_Edit() override; static CFWL_Edit* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error SetText(const CFX_WideString& wsText); int32_t GetTextLength() const; FWL_Error GetText(CFX_WideString& wsText, diff --git a/xfa/fwl/lightwidget/cfwl_listbox.cpp b/xfa/fwl/lightwidget/cfwl_listbox.cpp index be6a6b1249..e85e773813 100644 --- a/xfa/fwl/lightwidget/cfwl_listbox.cpp +++ b/xfa/fwl/lightwidget/cfwl_listbox.cpp @@ -81,7 +81,7 @@ int32_t CFWL_ListBox::CountSelItems() { IFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) { if (!m_pIface) - return NULL; + return nullptr; return static_cast(m_pIface)->GetSelItem(nIndexSel); } @@ -164,9 +164,7 @@ FWL_Error CFWL_ListBox::SetItemData(IFWL_ListItem* pItem, void* pData) { } void* CFWL_ListBox::GetItemData(IFWL_ListItem* pItem) { - if (!pItem) - return NULL; - return static_cast(pItem)->m_pData; + return pItem ? static_cast(pItem)->m_pData : nullptr; } IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { @@ -178,20 +176,20 @@ IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { FX_FLOAT fPosY = 0; static_cast(m_pIface)->GetScrollPos(fx); static_cast(m_pIface)->GetScrollPos(fy, FALSE); - int32_t nCount = m_ListBoxDP.CountItems(NULL); + int32_t nCount = m_ListBoxDP.CountItems(nullptr); for (int32_t i = 0; i < nCount; i++) { - IFWL_ListItem* pItem = m_ListBoxDP.GetItem(NULL, i); + IFWL_ListItem* pItem = m_ListBoxDP.GetItem(nullptr, i); if (!pItem) { continue; } CFX_RectF rtItem; - m_ListBoxDP.GetItemRect(NULL, pItem, rtItem); + m_ListBoxDP.GetItemRect(nullptr, pItem, rtItem); rtItem.Offset(-fPosX, -fPosY); if (rtItem.Contains(fx, fy)) { return pItem; } } - return NULL; + return nullptr; } uint32_t CFWL_ListBox::GetItemStates(IFWL_ListItem* pItem) { @@ -273,9 +271,7 @@ FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget, void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) { - if (!pItem) - return NULL; - return static_cast(pItem)->m_pData; + return pItem ? static_cast(pItem)->m_pData : nullptr; } FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget, @@ -346,8 +342,8 @@ CFWL_ListItem::CFWL_ListItem() { m_rtItem.Reset(); m_dwStates = 0; m_wsText = L""; - m_pDIB = NULL; - m_pData = NULL; + m_pDIB = nullptr; + m_pData = nullptr; m_dwCheckState = 0; m_rtCheckBox.Reset(); } diff --git a/xfa/fwl/lightwidget/cfwl_listbox.h b/xfa/fwl/lightwidget/cfwl_listbox.h index c684015b61..725a7248a1 100644 --- a/xfa/fwl/lightwidget/cfwl_listbox.h +++ b/xfa/fwl/lightwidget/cfwl_listbox.h @@ -23,7 +23,7 @@ class CFWL_ListBox : public CFWL_Widget { ~CFWL_ListBox() override; static CFWL_ListBox* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem); IFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, FX_BOOL bSelect = FALSE); diff --git a/xfa/fwl/lightwidget/cfwl_picturebox.h b/xfa/fwl/lightwidget/cfwl_picturebox.h index 95a0117224..ffc67f4446 100644 --- a/xfa/fwl/lightwidget/cfwl_picturebox.h +++ b/xfa/fwl/lightwidget/cfwl_picturebox.h @@ -18,7 +18,7 @@ class CFWL_PictureBox : public CFWL_Widget { static CFWL_PictureBox* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); CFX_DIBitmap* GetPicture(); FWL_Error SetPicture(CFX_DIBitmap* pBitmap); FX_FLOAT GetRotation(); diff --git a/xfa/fwl/lightwidget/cfwl_pushbutton.h b/xfa/fwl/lightwidget/cfwl_pushbutton.h index 145f5ed6f0..c2b71681c2 100644 --- a/xfa/fwl/lightwidget/cfwl_pushbutton.h +++ b/xfa/fwl/lightwidget/cfwl_pushbutton.h @@ -17,7 +17,7 @@ class CFWL_PushButton : public CFWL_Widget { static CFWL_PushButton* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error GetCaption(CFX_WideString& wsCaption); FWL_Error SetCaption(const CFX_WideStringC& wsCaption); CFX_DIBitmap* GetPicture(); @@ -26,7 +26,7 @@ class CFWL_PushButton : public CFWL_Widget { protected: class CFWL_PushButtonDP : public IFWL_PushButtonDP { public: - CFWL_PushButtonDP() : m_pBitmap(NULL) {} + CFWL_PushButtonDP() : m_pBitmap(nullptr) {} // IFWL_DataProvider FWL_Error GetCaption(IFWL_Widget* pWidget, diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h index ea17627063..2c180bad8f 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.h +++ b/xfa/fwl/lightwidget/cfwl_widget.h @@ -57,14 +57,14 @@ class CFWL_Widget { FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); FWL_Error SetMatrix(const CFX_Matrix& matrix); FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); - FWL_Error Repaint(const CFX_RectF* pRect = NULL); + FWL_Error Repaint(const CFX_RectF* pRect = nullptr); FWL_Error SetFocus(FX_BOOL bFocus); FWL_Error SetGrab(FX_BOOL bSet); CFWL_Widget(); - void RegisterEventTarget(CFWL_Widget* pEventSource = NULL, + void RegisterEventTarget(CFWL_Widget* pEventSource = nullptr, uint32_t dwFilter = FWL_EVENT_ALL_MASK); void DispatchEvent(CFWL_Event* pEvent); CFX_SizeF CalcTextSize(const CFX_WideString& wsText, @@ -76,7 +76,7 @@ class CFWL_Widget { CFWL_WidgetProperties* m_pProperties; protected: - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); }; #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ diff --git a/xfa/fwl/theme/cfwl_carettp.h b/xfa/fwl/theme/cfwl_carettp.h index 03b376a61e..faf37e725a 100644 --- a/xfa/fwl/theme/cfwl_carettp.h +++ b/xfa/fwl/theme/cfwl_carettp.h @@ -23,7 +23,7 @@ class CFWL_CaretTP : public CFWL_WidgetTP { uint32_t dwStates, const CFX_RectF* pRect, CFX_Color* crFill, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); }; #endif // XFA_FWL_THEME_CFWL_CARETTP_H_ diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h index a502b92926..ce44f70aef 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.h +++ b/xfa/fwl/theme/cfwl_checkboxtp.h @@ -30,44 +30,44 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP { CFX_Graphics* pGraphics, const CFX_RectF* pRect, uint32_t dwStates, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSign(IFWL_Widget* pWidget, CFX_Graphics* pGraphics, const CFX_RectF* pRtBox, uint32_t dwStates, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSignNeutral(CFX_Graphics* pGraphics, const CFX_RectF* pRtSign, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSignCheck(CFX_Graphics* pGraphics, const CFX_RectF* pRtSign, FX_ARGB argbFill, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSignCircle(CFX_Graphics* pGraphics, const CFX_RectF* pRtSign, FX_ARGB argbFill, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSignCross(CFX_Graphics* pGraphics, const CFX_RectF* pRtSign, FX_ARGB argbFill, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSignDiamond(CFX_Graphics* pGraphics, const CFX_RectF* pRtSign, FX_ARGB argbFill, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSignSquare(CFX_Graphics* pGraphics, const CFX_RectF* pRtSign, FX_ARGB argbFill, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSignStar(CFX_Graphics* pGraphics, const CFX_RectF* pRtSign, FX_ARGB argbFill, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawSignBorder(IFWL_Widget* pWidget, CFX_Graphics* pGraphics, const CFX_RectF* pRtBox, FX_BOOL bDisable = FALSE, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void SetThemeData(uint32_t dwID); void initCheckPath(FX_FLOAT fCheckLen); struct CKBThemeData { diff --git a/xfa/fwl/theme/cfwl_listboxtp.h b/xfa/fwl/theme/cfwl_listboxtp.h index a13df08845..9a6c457d5d 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.h +++ b/xfa/fwl/theme/cfwl_listboxtp.h @@ -24,8 +24,8 @@ class CFWL_ListBoxTP : public CFWL_WidgetTP { void DrawListBoxItem(CFX_Graphics* pGraphics, uint32_t dwStates, const CFX_RectF* prtItem, - void* pData = NULL, - CFX_Matrix* pMatrix = NULL); + void* pData = nullptr, + CFX_Matrix* pMatrix = nullptr); }; #endif // XFA_FWL_THEME_CFWL_LISTBOXTP_H_ diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h index 84e18193db..ce32f5e774 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.h +++ b/xfa/fwl/theme/cfwl_scrollbartp.h @@ -38,23 +38,23 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP { FX_BOOL bVert, FWLTHEME_STATE eState, FX_BOOL bPawButton = TRUE, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawTrack(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FX_BOOL bVert, FWLTHEME_STATE eState, FX_BOOL bLowerTrack, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawMaxMinBtn(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_DIRECTION eDict, FWLTHEME_STATE eState, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawPaw(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FX_BOOL bVert, FWLTHEME_STATE eState, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void SetThemeData(uint32_t dwID); struct SBThemeData* m_pThemeData; diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 867e908a0e..3ef9b0ba2d 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -150,7 +150,7 @@ void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, m_rtMargin.Set(0, 0, 0, 0); return &m_rtMargin; } - default: { return NULL; } + default: { return nullptr; } } return &m_fValue; } @@ -665,17 +665,17 @@ void CFWL_WidgetTP::DrawArrowBtn(CFX_Graphics* pGraphics, CFWL_ArrowData::GetInstance()->m_pColorData; DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); } -CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) { +CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(nullptr) { SetColorData(0); } CFWL_FontData::CFWL_FontData() : m_dwStyles(0), m_dwCodePage(0), m_pFont(0), - m_pFontMgr(NULL) + m_pFontMgr(nullptr) #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ , - m_pFontSource(NULL) + m_pFontSource(nullptr) #endif { } @@ -687,7 +687,7 @@ CFWL_FontData::~CFWL_FontData() { m_pFontMgr->Release(); } #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - if (m_pFontSource != NULL) { + if (m_pFontSource) { m_pFontSource->Release(); } #endif @@ -714,7 +714,7 @@ FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, } m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles, dwCodePage, m_pFontMgr); - return m_pFont != NULL; + return !!m_pFont; } CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; @@ -756,7 +756,7 @@ uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { return 0x0000ffff & dwThemeID; } -CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL; +CFWL_ArrowData* CFWL_ArrowData::m_pInstance = nullptr; CFWL_ArrowData* CFWL_ArrowData::GetInstance() { if (!m_pInstance) diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index 20be62619e..d8015e19db 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -147,7 +147,7 @@ class CFWL_WidgetTP { void DrawEdge(CFX_Graphics* pGraphics, uint32_t dwStyles, const CFX_RectF* pRect, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void Draw3DRect(CFX_Graphics* pGraphics, FWLTHEME_EDGE eType, FX_FLOAT fWidth, @@ -156,7 +156,7 @@ class CFWL_WidgetTP { FX_ARGB cr2, FX_ARGB cr3, FX_ARGB cr4, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void Draw3DCircle(CFX_Graphics* pGraphics, FWLTHEME_EDGE eType, FX_FLOAT fWidth, @@ -165,17 +165,17 @@ class CFWL_WidgetTP { FX_ARGB cr2, FX_ARGB cr3, FX_ARGB cr4, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawBorder(CFX_Graphics* pGraphics, const CFX_RectF* pRect, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void FillBackground(CFX_Graphics* pGraphics, const CFX_RectF* pRect, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void FillSoildRect(CFX_Graphics* pGraphics, FX_ARGB fillColor, const CFX_RectF* pRect, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawAxialShading(CFX_Graphics* pGraphics, FX_FLOAT fx1, FX_FLOAT fy1, @@ -185,40 +185,40 @@ class CFWL_WidgetTP { FX_ARGB endColor, CFX_Path* path, int32_t fillMode = FXFILL_WINDING, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawAnnulusRect(CFX_Graphics* pGraphics, FX_ARGB fillColor, const CFX_RectF* pRect, FX_FLOAT fRingWidth = 1, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawAnnulusCircle(CFX_Graphics* pGraphics, FX_ARGB fillColor, const CFX_RectF* pRect, FX_FLOAT fWidth = 1, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawFocus(CFX_Graphics* pGraphics, const CFX_RectF* pRect, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawArrow(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_DIRECTION eDict, FX_ARGB argbFill, FX_BOOL bPressed, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawArrow(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_DIRECTION eDict, FX_ARGB argSign, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawBtn(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_STATE eState, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); void DrawArrowBtn(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_DIRECTION eDict, FWLTHEME_STATE eState, - CFX_Matrix* pMatrix = NULL); + CFX_Matrix* pMatrix = nullptr); uint32_t m_dwRefCount; std::unique_ptr m_pTextOut; CFGAS_GEFont* m_pFDEFont; 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 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 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 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(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(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(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(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(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(m_pLayoutData.get()) ->GetTextLayout() - : NULL; + : nullptr; } CFX_DIBitmap* CXFA_WidgetAcc::GetImageImage() { return m_pLayoutData ? static_cast(m_pLayoutData.get()) ->m_pDIBitmap - : NULL; + : nullptr; } CFX_DIBitmap* CXFA_WidgetAcc::GetImageEditImage() { return m_pLayoutData ? static_cast(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); diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp index ebe68b9408..bc7b91b4e6 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.cpp +++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp @@ -514,7 +514,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePrimaryExpression() { if (m_pToken->m_type == TOKlbracket) { CXFA_FMSimpleExpression* s = ParseIndexExpression(); if (s) { - e.reset(new CXFA_FMDotAccessorExpression(line, NULL, TOKdot, + e.reset(new CXFA_FMDotAccessorExpression(line, nullptr, TOKdot, wsIdentifier, s)); } NextToken(); @@ -661,7 +661,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression( s.release()); } else { CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( - tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); + tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); e = new CXFA_FMDotAccessorExpression(line, e, TOKdot, tempStr, s); continue; } @@ -688,7 +688,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression( tempStr, s.release()); } else { CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( - tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); + tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); e = new CXFA_FMDotDotAccessorExpression(line, e, TOKdotdot, tempStr, s); continue; @@ -716,7 +716,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression( tempStr, s.release()); } else { CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( - tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); + tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); e = new CXFA_FMDotAccessorExpression(line, e, TOKdotscream, tempStr, s); continue; @@ -730,7 +730,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression( break; case TOKdotstar: { CXFA_FMSimpleExpression* s = - new CXFA_FMIndexExpression(line, ACCESSOR_NO_INDEX, NULL, FALSE); + new CXFA_FMIndexExpression(line, ACCESSOR_NO_INDEX, nullptr, FALSE); e = new CXFA_FMDotAccessorExpression(line, e, TOKdotstar, FX_WSTRC(L"*"), s); } break; diff --git a/xfa/fxfa/include/fxfa.h b/xfa/fxfa/include/fxfa.h index 4541cba9c2..04962937e3 100644 --- a/xfa/fxfa/include/fxfa.h +++ b/xfa/fxfa/include/fxfa.h @@ -313,7 +313,7 @@ class IXFA_DocProvider { CFX_RectF& rtPopup) = 0; virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup, - const CFX_RectF* pRectExclude = NULL) = 0; + const CFX_RectF* pRectExclude = nullptr) = 0; virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) = 0; virtual void WidgetPostAdd(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetData) = 0; diff --git a/xfa/fxfa/include/fxfa_widget.h b/xfa/fxfa/include/fxfa_widget.h index cf52bbe205..fa6d7fa49d 100644 --- a/xfa/fxfa/include/fxfa_widget.h +++ b/xfa/fxfa/include/fxfa_widget.h @@ -70,7 +70,7 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { CFX_DIBitmap* GetImageEditImage(); void SetImageImage(CFX_DIBitmap* newImage); void SetImageEditImage(CFX_DIBitmap* newImage); - void UpdateUIDisplay(CXFA_FFWidget* pExcept = NULL); + void UpdateUIDisplay(CXFA_FFWidget* pExcept = nullptr); CXFA_Node* GetDatasets(); CFGAS_GEFont* GetFDEFont(); diff --git a/xfa/fxfa/include/xfa_ffdoc.h b/xfa/fxfa/include/xfa_ffdoc.h index af1f8d79cf..2ea829885c 100644 --- a/xfa/fxfa/include/xfa_ffdoc.h +++ b/xfa/fxfa/include/xfa_ffdoc.h @@ -31,7 +31,7 @@ class CXFA_FFDoc { IXFA_DocProvider* GetDocProvider() { return m_pDocProvider; } uint32_t GetDocType(); int32_t StartLoad(); - int32_t DoLoad(IFX_Pause* pPause = NULL); + int32_t DoLoad(IFX_Pause* pPause = nullptr); void StopLoad(); CXFA_FFDocView* CreateDocView(uint32_t dwView = 0); FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile); diff --git a/xfa/fxfa/include/xfa_ffwidget.h b/xfa/fxfa/include/xfa_ffwidget.h index 9d337d7fbe..23a9a82c85 100644 --- a/xfa/fxfa/include/xfa_ffwidget.h +++ b/xfa/fxfa/include/xfa_ffwidget.h @@ -114,8 +114,8 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { CXFA_FFDoc* GetDoc(); CXFA_FFApp* GetApp(); IXFA_AppProvider* GetAppProvider(); - void InvalidateWidget(const CFX_RectF* pRect = NULL); - void AddInvalidateRect(const CFX_RectF* pRect = NULL); + void InvalidateWidget(const CFX_RectF* pRect = nullptr); + void AddInvalidateRect(const CFX_RectF* pRect = nullptr); FX_BOOL GetCaptionText(CFX_WideString& wsCap); bool IsFocused(); void Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy); diff --git a/xfa/fxfa/include/xfa_ffwidgethandler.h b/xfa/fxfa/include/xfa_ffwidgethandler.h index 4aa86d21f0..1cd28ce2f0 100644 --- a/xfa/fxfa/include/xfa_ffwidgethandler.h +++ b/xfa/fxfa/include/xfa_ffwidgethandler.h @@ -23,7 +23,7 @@ class CXFA_FFWidgetHandler { CXFA_FFWidget* CreateWidget(CXFA_FFWidget* hParent, XFA_WIDGETTYPE eType, - CXFA_FFWidget* hBefore = NULL); + CXFA_FFWidget* hBefore = nullptr); FX_BOOL OnMouseEnter(CXFA_FFWidget* hWidget); FX_BOOL OnMouseExit(CXFA_FFWidget* hWidget); @@ -111,7 +111,7 @@ class CXFA_FFWidgetHandler { CXFA_Node* pBefore) const; CXFA_Node* CreateCopyNode(XFA_Element eElement, CXFA_Node* pParent, - CXFA_Node* pBefore = NULL) const; + CXFA_Node* pBefore = nullptr) const; CXFA_Node* CreateTemplateNode(XFA_Element eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const; diff --git a/xfa/fxfa/include/xfa_rendercontext.h b/xfa/fxfa/include/xfa_rendercontext.h index 7716c7140b..8bd6a287a3 100644 --- a/xfa/fxfa/include/xfa_rendercontext.h +++ b/xfa/fxfa/include/xfa_rendercontext.h @@ -28,7 +28,7 @@ class CXFA_RenderContext { CFX_Graphics* pGS, const CFX_Matrix& matrix, const CXFA_RenderOptions& options); - int32_t DoRender(IFX_Pause* pPause = NULL); + int32_t DoRender(IFX_Pause* pPause = nullptr); void StopRender(); protected: diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp index cb5cf7f6b9..95b247a371 100644 --- a/xfa/fxfa/parser/cxfa_box.cpp +++ b/xfa/fxfa/parser/cxfa_box.cpp @@ -13,7 +13,7 @@ namespace { void GetStrokesInternal(CXFA_Node* pNode, CXFA_StrokeArray& strokes, - FX_BOOL bNULL) { + FX_BOOL bNull) { strokes.RemoveAll(); if (!pNode) return; @@ -25,7 +25,7 @@ void GetStrokesInternal(CXFA_Node* pNode, CXFA_Corner(pNode->GetProperty(i, XFA_Element::Corner, i == 0)); if (corner || i == 0) strokes.SetAt(j, corner); - else if (bNULL) + else if (bNull) strokes.SetAt(j, CXFA_Stroke(nullptr)); else if (i == 1) strokes.SetAt(j, strokes[0]); @@ -39,7 +39,7 @@ void GetStrokesInternal(CXFA_Node* pNode, CXFA_Edge(pNode->GetProperty(i, XFA_Element::Edge, i == 0)); if (edge || i == 0) strokes.SetAt(j, edge); - else if (bNULL) + else if (bNull) strokes.SetAt(j, CXFA_Stroke(nullptr)); else if (i == 1) strokes.SetAt(j, strokes[1]); @@ -159,7 +159,7 @@ int32_t CXFA_Box::Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const { CXFA_StrokeArray strokes; GetStrokesInternal(m_pNode, strokes, TRUE); - CXFA_Stroke stroke(NULL); + CXFA_Stroke stroke(nullptr); int32_t iType = Style3D(strokes, stroke); if (iType) { bVisible = stroke.IsVisible(); diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 07ed3b36c1..d241772fe3 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -76,7 +76,7 @@ CXFA_WidgetData::CXFA_WidgetData(CXFA_Node* pNode) : CXFA_Data(pNode), m_bIsNull(TRUE), m_bPreNull(TRUE), - m_pUiChildNode(NULL), + m_pUiChildNode(nullptr), m_eUIType(XFA_Element::Unknown) {} CXFA_Node* CXFA_WidgetData::GetUIChild() { @@ -441,12 +441,12 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { CXFA_Node* CXFA_WidgetData::GetExclGroupNode() { CXFA_Node* pExcl = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_Parent)); if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup) - return NULL; + return nullptr; return pExcl; } CXFA_Node* CXFA_WidgetData::GetSelectedMember() { - CXFA_Node* pSelectedMember = NULL; + CXFA_Node* pSelectedMember = nullptr; CFX_WideString wsState = GetRawValue(); if (wsState.IsEmpty()) return pSelectedMember; @@ -516,7 +516,7 @@ void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue, CXFA_Node* CXFA_WidgetData::GetExclGroupFirstMember() { CXFA_Node* pExcl = GetNode(); if (!pExcl) - return NULL; + return nullptr; CXFA_Node* pNode = pExcl->GetNodeItem(XFA_NODEITEM_FirstChild); while (pNode) { @@ -525,11 +525,11 @@ CXFA_Node* CXFA_WidgetData::GetExclGroupFirstMember() { pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); } - return NULL; + return nullptr; } CXFA_Node* CXFA_WidgetData::GetExclGroupNextMember(CXFA_Node* pNode) { if (!pNode) - return NULL; + return nullptr; CXFA_Node* pNodeField = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); while (pNodeField) { @@ -538,7 +538,7 @@ CXFA_Node* CXFA_WidgetData::GetExclGroupNextMember(CXFA_Node* pNode) { pNodeField = pNodeField->GetNodeItem(XFA_NODEITEM_NextSibling); } - return NULL; + return nullptr; } int32_t CXFA_WidgetData::GetChoiceListCommitOn() { @@ -573,7 +573,7 @@ FX_BOOL CXFA_WidgetData::IsListBox() { int32_t CXFA_WidgetData::CountChoiceListItems(FX_BOOL bSaveValue) { CXFA_NodeArray pItems; - CXFA_Node* pItem = NULL; + CXFA_Node* pItem = nullptr; int32_t iCount = 0; CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { @@ -639,7 +639,7 @@ FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, void CXFA_WidgetData::GetChoiceListItems(CFX_WideStringArray& wsTextArray, FX_BOOL bSaveValue) { CXFA_NodeArray pItems; - CXFA_Node* pItem = NULL; + CXFA_Node* pItem = nullptr; int32_t iCount = 0; CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { @@ -943,7 +943,7 @@ void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, } else { CXFA_Node* pLabelItems = listitems[0]; FX_BOOL bSave = pLabelItems->GetBoolean(XFA_ATTRIBUTE_Save); - CXFA_Node* pSaveItems = NULL; + CXFA_Node* pSaveItems = nullptr; if (bSave) { pSaveItems = pLabelItems; pLabelItems = listitems[1]; @@ -989,7 +989,7 @@ void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel, } else { CXFA_Node* pLabelItems = listitems[0]; FX_BOOL bSave = pLabelItems->GetBoolean(XFA_ATTRIBUTE_Save); - CXFA_Node* pSaveItems = NULL; + CXFA_Node* pSaveItems = nullptr; if (bSave) { pSaveItems = pLabelItems; pLabelItems = listitems[1]; @@ -1462,22 +1462,15 @@ FX_BOOL CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture, } IFX_Locale* CXFA_WidgetData::GetLocal() { - IFX_Locale* pLocale = NULL; if (!m_pNode) - return pLocale; + return nullptr; - FX_BOOL bLocale = FALSE; CFX_WideString wsLocaleName; - bLocale = m_pNode->GetLocaleName(wsLocaleName); - if (bLocale) { - if (wsLocaleName == FX_WSTRC(L"ambient")) { - pLocale = m_pNode->GetDocument()->GetLocalMgr()->GetDefLocale(); - } else { - pLocale = - m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName); - } - } - return pLocale; + if (!m_pNode->GetLocaleName(wsLocaleName)) + return nullptr; + if (wsLocaleName == FX_WSTRC(L"ambient")) + return m_pNode->GetDocument()->GetLocalMgr()->GetDefLocale(); + return m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName); } FX_BOOL CXFA_WidgetData::GetValue(CFX_WideString& wsValue, diff --git a/xfa/fxfa/parser/xfa_basic_data.cpp b/xfa/fxfa/parser/xfa_basic_data.cpp index 1a9ad1ade3..62972cb995 100644 --- a/xfa/fxfa/parser/xfa_basic_data.cpp +++ b/xfa/fxfa/parser/xfa_basic_data.cpp @@ -321,9 +321,9 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { {0x21aed, L"id", XFA_ATTRIBUTE_Id, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Template | XFA_XDPPACKET_ConnectionSet | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x25363, L"to", XFA_ATTRIBUTE_To, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Config, (void*)NULL}, + XFA_XDPPACKET_Config, nullptr}, {0xcb0ac9, L"lineThrough", XFA_ATTRIBUTE_LineThrough, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, @@ -335,18 +335,18 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)L"Courier"}, {0x3106c3a, L"beforeTarget", XFA_ATTRIBUTE_BeforeTarget, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x31b19c1, L"name", XFA_ATTRIBUTE_Name, XFA_ATTRIBUTETYPE_NOTSURE, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Config | XFA_XDPPACKET_LocaleSet | XFA_XDPPACKET_Template | XFA_XDPPACKET_Datasets | XFA_XDPPACKET_Form | XFA_XDPPACKET_ConnectionSet | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x3848b3f, L"next", XFA_ATTRIBUTE_Next, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_None}, {0x43e349b, L"dataRowCount", XFA_ATTRIBUTE_DataRowCount, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x5518c25, L"break", XFA_ATTRIBUTE_Break, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Close}, @@ -369,21 +369,21 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)XFA_ATTRIBUTEENUM_Square}, {0xb3543a6, L"max", XFA_ATTRIBUTE_Max, XFA_ATTRIBUTETYPE_NOTSURE, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xb356ca4, L"min", XFA_ATTRIBUTE_Min, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)1}, {0xbb8df5d, L"ref", XFA_ATTRIBUTE_Ref, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Config | XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xbb8f3df, L"rid", XFA_ATTRIBUTE_Rid, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xc080cd3, L"url", XFA_ATTRIBUTE_Url, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xc0811ed, L"use", XFA_ATTRIBUTE_Use, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Template | XFA_XDPPACKET_ConnectionSet | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xcfea02e, L"leftInset", XFA_ATTRIBUTE_LeftInset, XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 0)}, @@ -396,7 +396,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)(g_XFAMeasurementData + 0)}, {0x13a08bdb, L"overflowTarget", XFA_ATTRIBUTE_OverflowTarget, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x1414d431, L"allowMacro", XFA_ATTRIBUTE_AllowMacro, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, @@ -405,31 +405,31 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)XFA_ATTRIBUTEENUM_Any}, {0x1517dfa1, L"columnWidths", XFA_ATTRIBUTE_ColumnWidths, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x169134a1, L"overflowLeader", XFA_ATTRIBUTE_OverflowLeader, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x1b8dce3e, L"action", XFA_ATTRIBUTE_Action, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Include}, {0x1e459b8f, L"nonRepudiation", XFA_ATTRIBUTE_NonRepudiation, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x1ec8ab2c, L"rate", XFA_ATTRIBUTE_Rate, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)50}, {0x1ef3a64a, L"allowRichText", XFA_ATTRIBUTE_AllowRichText, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0x2038c9b2, L"role", XFA_ATTRIBUTE_Role, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x20914367, L"overflowTrailer", XFA_ATTRIBUTE_OverflowTrailer, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x226ca8f1, L"operation", XFA_ATTRIBUTE_Operation, XFA_ATTRIBUTETYPE_NOTSURE, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x24d85167, L"timeout", XFA_ATTRIBUTE_Timeout, XFA_ATTRIBUTETYPE_NOTSURE, - XFA_XDPPACKET_SourceSet, (void*)NULL}, + XFA_XDPPACKET_SourceSet, nullptr}, {0x25764436, L"topInset", XFA_ATTRIBUTE_TopInset, XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 0)}, @@ -441,7 +441,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)XFA_ATTRIBUTEENUM_Unknown}, {0x28dee6e9, L"format", XFA_ATTRIBUTE_Format, XFA_ATTRIBUTETYPE_NOTSURE, XFA_XDPPACKET_Config | XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x28e17e91, L"dataPrep", XFA_ATTRIBUTE_DataPrep, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_None}, @@ -453,10 +453,10 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 0)}, {0x2b5df51e, L"dataDescription", XFA_ATTRIBUTE_DataDescription, - XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_ConnectionSet, (void*)NULL}, + XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_ConnectionSet, nullptr}, {0x2bb3f470, L"encipherOnly", XFA_ATTRIBUTE_EncipherOnly, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x2cd79033, L"kerningMode", XFA_ATTRIBUTE_KerningMode, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_None}, @@ -467,7 +467,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)7}, {0x2f16a382, L"type", XFA_ATTRIBUTE_Type, XFA_ATTRIBUTETYPE_NOTSURE, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x34ae103c, L"reserve", XFA_ATTRIBUTE_Reserve, XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 4)}, @@ -490,11 +490,11 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_RefOnly}, {0x4156ee3f, L"delimiter", XFA_ATTRIBUTE_Delimiter, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x42fed1fd, L"contentType", XFA_ATTRIBUTE_ContentType, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Template | XFA_XDPPACKET_Datasets | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x453eaf38, L"startNew", XFA_ATTRIBUTE_StartNew, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0x45a6daf8, L"eofAction", XFA_ATTRIBUTE_EofAction, XFA_ATTRIBUTETYPE_Enum, @@ -504,7 +504,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)0}, {0x47d03490, L"connection", XFA_ATTRIBUTE_Connection, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x4873c601, L"baselineShift", XFA_ATTRIBUTE_BaselineShift, XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 0)}, @@ -518,7 +518,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Portrait}, {0x4fdc3454, L"timeStamp", XFA_ATTRIBUTE_TimeStamp, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_XDP, (void*)NULL}, + XFA_XDPPACKET_XDP, nullptr}, {0x52666f1c, L"printCheckDigit", XFA_ATTRIBUTE_PrintCheckDigit, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, @@ -534,7 +534,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { {0x54fa722c, L"transferEncoding", XFA_ATTRIBUTE_TransferEncoding, XFA_ATTRIBUTETYPE_NOTSURE, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x552d9ad5, L"usage", XFA_ATTRIBUTE_Usage, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_ExportAndImport}, @@ -545,16 +545,16 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 0)}, {0x577682ac, L"preserve", XFA_ATTRIBUTE_Preserve, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x58be2870, L"aliasNode", XFA_ATTRIBUTE_AliasNode, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_UNKNOWN, (void*)0}, {0x5a32e493, L"multiLine", XFA_ATTRIBUTE_MultiLine, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0x5a50e9e6, L"version", XFA_ATTRIBUTE_Version, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x5ab23b6c, L"startChar", XFA_ATTRIBUTE_StartChar, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x5b707a35, L"scriptTest", XFA_ATTRIBUTE_ScriptTest, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Error}, @@ -566,14 +566,14 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)XFA_ATTRIBUTEENUM_ForwardOnly}, {0x5f760b50, L"digitalSignature", XFA_ATTRIBUTE_DigitalSignature, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x60a61edd, L"codeType", XFA_ATTRIBUTE_CodeType, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x60d4c8b1, L"output", XFA_ATTRIBUTE_Output, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_ConnectionSet, (void*)NULL}, + XFA_XDPPACKET_ConnectionSet, nullptr}, {0x64110ab5, L"bookendTrailer", XFA_ATTRIBUTE_BookendTrailer, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x65e30c67, L"imagingBBox", XFA_ATTRIBUTE_ImagingBBox, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)L"none"}, @@ -581,9 +581,9 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0x66642f8f, L"force", XFA_ATTRIBUTE_Force, XFA_ATTRIBUTETYPE_Boolean, - XFA_XDPPACKET_Config, (void*)NULL}, + XFA_XDPPACKET_Config, nullptr}, {0x69aa2292, L"crlSign", XFA_ATTRIBUTE_CrlSign, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x6a3405dd, L"previous", XFA_ATTRIBUTE_Previous, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_None}, @@ -607,7 +607,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)0}, {0x79543055, L"letterSpacing", XFA_ATTRIBUTE_LetterSpacing, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x79975f2b, L"lockType", XFA_ATTRIBUTE_LockType, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_SourceSet, (void*)XFA_ATTRIBUTEENUM_ReadOnly}, {0x7a0cc471, L"passwordChar", XFA_ATTRIBUTE_PasswordChar, @@ -645,14 +645,14 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Position}, {0x7f6fd3d7, L"server", XFA_ATTRIBUTE_Server, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x824f21b7, L"embedPDF", XFA_ATTRIBUTE_EmbedPDF, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0x8340ea66, L"oddOrEven", XFA_ATTRIBUTE_OddOrEven, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Any}, {0x836d4d7c, L"tabDefault", XFA_ATTRIBUTE_TabDefault, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x8855805f, L"contains", XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Datasets, (void*)XFA_ATTRIBUTEENUM_Data}, {0x8a692521, L"rightInset", XFA_ATTRIBUTE_RightInset, @@ -664,12 +664,12 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_UserControl}, {0x8c99377e, L"relation", XFA_ATTRIBUTE_Relation, XFA_ATTRIBUTETYPE_NOTSURE, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x8d181d61, L"wideNarrowRatio", XFA_ATTRIBUTE_WideNarrowRatio, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)L"3:1"}, {0x8e1c2921, L"relevant", XFA_ATTRIBUTE_Relevant, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x8e29d794, L"signatureType", XFA_ATTRIBUTE_SignatureType, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Filter}, @@ -680,7 +680,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Square}, {0x8fa01790, L"tabStops", XFA_ATTRIBUTE_TabStops, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0x8fc36c0a, L"outputBelow", XFA_ATTRIBUTE_OutputBelow, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Config, (void*)XFA_ATTRIBUTEENUM_Warn}, @@ -701,10 +701,10 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)3}, {0x98fd4d81, L"keyAgreement", XFA_ATTRIBUTE_KeyAgreement, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x99800d7a, L"errorCorrectionLevel", XFA_ATTRIBUTE_ErrorCorrectionLevel, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0x9a63da3d, L"upsMode", XFA_ATTRIBUTE_UpsMode, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_UsCarrier}, @@ -714,11 +714,11 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { {0x9d833d75, L"circular", XFA_ATTRIBUTE_Circular, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0x9d8ee204, L"psName", XFA_ATTRIBUTE_PsName, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Config, (void*)NULL}, + XFA_XDPPACKET_Config, nullptr}, {0x9dcc3ab3, L"trailer", XFA_ATTRIBUTE_Trailer, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xa0933954, L"unicodeRange", XFA_ATTRIBUTE_UnicodeRange, - XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Config, (void*)NULL}, + XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Config, nullptr}, {0xa1b0d2f5, L"executeType", XFA_ATTRIBUTE_ExecuteType, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Import}, @@ -739,7 +739,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)XFA_ATTRIBUTEENUM_Auto}, {0xa66404cb, L"keyEncipherment", XFA_ATTRIBUTE_KeyEncipherment, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xa6710262, L"credentialServerPolicy", XFA_ATTRIBUTE_CredentialServerPolicy, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, @@ -758,22 +758,21 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { {0xac06e2b0, L"colSpan", XFA_ATTRIBUTE_ColSpan, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)1}, {0xadc4c77b, L"binding", XFA_ATTRIBUTE_Binding, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xaf754613, L"checksum", XFA_ATTRIBUTE_Checksum, XFA_ATTRIBUTETYPE_NOTSURE, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form | XFA_XDPPACKET_Form, - (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form | XFA_XDPPACKET_Form, nullptr}, {0xb045fbc5, L"charEncoding", XFA_ATTRIBUTE_CharEncoding, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)L"UTF-8"}, {0xb0e5485d, L"bind", XFA_ATTRIBUTE_Bind, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_SourceSet, (void*)NULL}, + XFA_XDPPACKET_SourceSet, nullptr}, {0xb12128b7, L"textEntry", XFA_ATTRIBUTE_TextEntry, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0xb373a862, L"archive", XFA_ATTRIBUTE_Archive, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xb598a1f7, L"uuid", XFA_ATTRIBUTE_Uuid, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_XDP, (void*)NULL}, + XFA_XDPPACKET_XDP, nullptr}, {0xb5e49bf2, L"posture", XFA_ATTRIBUTE_Posture, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Config | XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Normal}, @@ -783,13 +782,13 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { {0xb716467b, L"orphans", XFA_ATTRIBUTE_Orphans, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0xbc0c4695, L"qualifiedName", XFA_ATTRIBUTE_QualifiedName, - XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_UNKNOWN, (void*)NULL}, + XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_UNKNOWN, nullptr}, {0xbc254332, L"usehref", XFA_ATTRIBUTE_Usehref, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Template | XFA_XDPPACKET_ConnectionSet | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xbc8fa350, L"locale", XFA_ATTRIBUTE_Locale, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xbd6e1d88, L"weight", XFA_ATTRIBUTE_Weight, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Config | XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Normal}, @@ -800,49 +799,49 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Link}, {0xbe52dfbf, L"desc", XFA_ATTRIBUTE_Desc, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Config | XFA_XDPPACKET_LocaleSet, (void*)NULL}, + XFA_XDPPACKET_Config | XFA_XDPPACKET_LocaleSet, nullptr}, {0xbe9ba472, L"numbered", XFA_ATTRIBUTE_Numbered, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)1}, {0xc035c6b1, L"dataColumnCount", XFA_ATTRIBUTE_DataColumnCount, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xc0ec9fa4, L"overline", XFA_ATTRIBUTE_Overline, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0xc2ba0923, L"urlPolicy", XFA_ATTRIBUTE_UrlPolicy, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xc2bd40fd, L"anchorType", XFA_ATTRIBUTE_AnchorType, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_TopLeft}, {0xc39a88bd, L"labelRef", XFA_ATTRIBUTE_LabelRef, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xc3c1442f, L"bookendLeader", XFA_ATTRIBUTE_BookendLeader, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xc4547a08, L"maxLength", XFA_ATTRIBUTE_MaxLength, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*) - 1}, + (void*)-1}, {0xc4fed09b, L"accessKey", XFA_ATTRIBUTE_AccessKey, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xc5762157, L"cursorLocation", XFA_ATTRIBUTE_CursorLocation, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_SourceSet, (void*)XFA_ATTRIBUTEENUM_Client}, {0xc860f30a, L"delayedOpen", XFA_ATTRIBUTE_DelayedOpen, - XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_SourceSet, (void*)NULL}, + XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_SourceSet, nullptr}, {0xc8da4da7, L"target", XFA_ATTRIBUTE_Target, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xca5dc27c, L"dataEncipherment", XFA_ATTRIBUTE_DataEncipherment, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xcb150479, L"afterTarget", XFA_ATTRIBUTE_AfterTarget, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xcbcaf66d, L"leader", XFA_ATTRIBUTE_Leader, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xcca7897e, L"picker", XFA_ATTRIBUTE_Picker, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Host}, {0xcd7f7b54, L"from", XFA_ATTRIBUTE_From, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Config, (void*)NULL}, + XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Config, nullptr}, {0xcea5e62c, L"baseProfile", XFA_ATTRIBUTE_BaseProfile, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Full}, @@ -850,7 +849,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Fit}, {0xd3c84d25, L"rowColumnRatio", XFA_ATTRIBUTE_RowColumnRatio, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xd4b01921, L"lineHeight", XFA_ATTRIBUTE_LineHeight, XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 1)}, @@ -858,28 +857,28 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Inverted}, {0xd50f903a, L"valueRef", XFA_ATTRIBUTE_ValueRef, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xd52482e0, L"maxEntries", XFA_ATTRIBUTE_MaxEntries, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Config, (void*)5}, {0xd57c513c, L"dataLength", XFA_ATTRIBUTE_DataLength, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xd6128d8d, L"activity", XFA_ATTRIBUTE_Activity, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Click}, {0xd6a39990, L"input", XFA_ATTRIBUTE_Input, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_ConnectionSet, (void*)NULL}, + XFA_XDPPACKET_ConnectionSet, nullptr}, {0xd6e27f1d, L"value", XFA_ATTRIBUTE_Value, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_SourceSet | XFA_XDPPACKET_Config | XFA_XDPPACKET_LocaleSet | XFA_XDPPACKET_Template | XFA_XDPPACKET_Datasets | XFA_XDPPACKET_ConnectionSet | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xd70798c2, L"blankOrNotBlank", XFA_ATTRIBUTE_BlankOrNotBlank, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Any}, {0xd861f8af, L"addRevocationInfo", XFA_ATTRIBUTE_AddRevocationInfo, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xd8f982bf, L"genericFamily", XFA_ATTRIBUTE_GenericFamily, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Config, (void*)XFA_ATTRIBUTEENUM_Serif}, @@ -887,13 +886,13 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Even}, {0xdb55fec5, L"href", XFA_ATTRIBUTE_Href, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xdc75676c, L"textEncoding", XFA_ATTRIBUTE_TextEncoding, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xde7f92ba, L"leadDigits", XFA_ATTRIBUTE_LeadDigits, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*) - 1}, + (void*)-1}, {0xe11a2cbc, L"permissions", XFA_ATTRIBUTE_Permissions, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)2}, @@ -901,9 +900,9 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 0)}, {0xe1a26b56, L"codeBase", XFA_ATTRIBUTE_CodeBase, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xe349d044, L"stock", XFA_ATTRIBUTE_Stock, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xe372ae97, L"isNull", XFA_ATTRIBUTE_IsNull, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Datasets, (void*)0}, {0xe4c3a5e5, L"restoreState", XFA_ATTRIBUTE_RestoreState, @@ -923,7 +922,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)XFA_ATTRIBUTEENUM_Square}, {0xe8f118a8, L"keyCertSign", XFA_ATTRIBUTE_KeyCertSign, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xe948b9a8, L"radius", XFA_ATTRIBUTE_Radius, XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 0)}, @@ -931,14 +930,14 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Config, (void*)XFA_ATTRIBUTEENUM_Warn}, {0xea7090a0, L"override", XFA_ATTRIBUTE_Override, XFA_ATTRIBUTETYPE_NOTSURE, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xeb091003, L"classId", XFA_ATTRIBUTE_ClassId, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xeb511b54, L"disable", XFA_ATTRIBUTE_Disable, XFA_ATTRIBUTETYPE_Boolean, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)0}, {0xeda9017a, L"scope", XFA_ATTRIBUTE_Scope, XFA_ATTRIBUTETYPE_NOTSURE, XFA_XDPPACKET_Config | XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xf197844d, L"match", XFA_ATTRIBUTE_Match, XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)XFA_ATTRIBUTEENUM_Once}, @@ -952,7 +951,7 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Enum, XFA_XDPPACKET_Config, (void*)XFA_ATTRIBUTEENUM_Asterisk}, {0xf575ca75, L"endChar", XFA_ATTRIBUTE_EndChar, XFA_ATTRIBUTETYPE_Cdata, - XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, + XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, nullptr}, {0xf6b47749, L"lock", XFA_ATTRIBUTE_Lock, XFA_ATTRIBUTETYPE_Integer, XFA_XDPPACKET_Config, (void*)0}, {0xf6b4afb0, L"long", XFA_ATTRIBUTE_Long, XFA_ATTRIBUTETYPE_Measure, @@ -963,10 +962,10 @@ const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { (void*)XFA_ATTRIBUTEENUM_None}, {0xf889e747, L"xdpContent", XFA_ATTRIBUTE_XdpContent, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, {0xfea53ec6, L"decipherOnly", XFA_ATTRIBUTE_DecipherOnly, XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, - (void*)NULL}, + nullptr}, }; const int32_t g_iXFAAttributeCount = sizeof(g_XFAAttributeData) / sizeof(XFA_ATTRIBUTEINFO); @@ -983,7 +982,7 @@ const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[] = { {XFA_Element::CalendarSymbols, XFA_ATTRIBUTE_Name, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_Gregorian}, {XFA_Element::Barcode, XFA_ATTRIBUTE_Type, XFA_ATTRIBUTETYPE_Cdata, - (void*)NULL}, + nullptr}, {XFA_Element::Barcode, XFA_ATTRIBUTE_Checksum, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_None}, {XFA_Element::TimePattern, XFA_ATTRIBUTE_Name, XFA_ATTRIBUTETYPE_Enum, @@ -1016,10 +1015,8 @@ const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[] = { (void*)XFA_ATTRIBUTEENUM_Optional}, {XFA_Element::PageSet, XFA_ATTRIBUTE_Relation, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_OrderedOccurrence}, - {XFA_Element::Equate, XFA_ATTRIBUTE_From, XFA_ATTRIBUTETYPE_Cdata, - (void*)NULL}, - {XFA_Element::Equate, XFA_ATTRIBUTE_To, XFA_ATTRIBUTETYPE_Cdata, - (void*)NULL}, + {XFA_Element::Equate, XFA_ATTRIBUTE_From, XFA_ATTRIBUTETYPE_Cdata, nullptr}, + {XFA_Element::Equate, XFA_ATTRIBUTE_To, XFA_ATTRIBUTETYPE_Cdata, nullptr}, {XFA_Element::Traverse, XFA_ATTRIBUTE_Operation, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_Next}, {XFA_Element::Encodings, XFA_ATTRIBUTE_Type, XFA_ATTRIBUTETYPE_Enum, @@ -1037,9 +1034,9 @@ const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[] = { {XFA_Element::CurrencySymbol, XFA_ATTRIBUTE_Name, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_Symbol}, {XFA_Element::EquateRange, XFA_ATTRIBUTE_From, XFA_ATTRIBUTETYPE_Cdata, - (void*)NULL}, + nullptr}, {XFA_Element::EquateRange, XFA_ATTRIBUTE_To, XFA_ATTRIBUTETYPE_Cdata, - (void*)NULL}, + nullptr}, {XFA_Element::SignData, XFA_ATTRIBUTE_Operation, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_Sign}, {XFA_Element::DatePattern, XFA_ATTRIBUTE_Name, XFA_ATTRIBUTETYPE_Enum, @@ -1051,7 +1048,7 @@ const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[] = { {XFA_Element::AppearanceFilter, XFA_ATTRIBUTE_Type, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_Optional}, {XFA_Element::Form, XFA_ATTRIBUTE_Checksum, XFA_ATTRIBUTETYPE_Cdata, - (void*)NULL}, + nullptr}, {XFA_Element::Value, XFA_ATTRIBUTE_Override, XFA_ATTRIBUTETYPE_Boolean, (void*)0}, {XFA_Element::Calculate, XFA_ATTRIBUTE_Override, XFA_ATTRIBUTETYPE_Enum, @@ -3393,7 +3390,7 @@ const uint8_t g_XFAElementAttributeData[] = { }; const XFA_PACKETINFO g_XFAPacketData[] = { - {0x0, NULL, XFA_XDPPACKET_USER, NULL, + {0x0, nullptr, XFA_XDPPACKET_USER, nullptr, XFA_XDPPACKET_FLAGS_NOMATCH | XFA_XDPPACKET_FLAGS_SUPPORTMANY}, {0x811929d, L"sourceSet", XFA_XDPPACKET_SourceSet, L"http://www.xfa.org/schema/xfa-source-set/", diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index 67a110b4e5..3d630d9247 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -36,7 +36,7 @@ const XFA_PACKETINFO* XFA_GetPacketByName(const CFX_WideStringC& wsName) { iStart = iMid + 1; } } while (iStart <= iEnd); - return NULL; + return nullptr; } const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket) { @@ -52,7 +52,7 @@ const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket) { iStart = iMid + 1; } } while (iStart <= iEnd); - return NULL; + return nullptr; } const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket) { @@ -78,7 +78,7 @@ const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( iStart = iMid + 1; } } while (iStart <= iEnd); - return NULL; + return nullptr; } const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName) { return g_XFAEnumData + eName; @@ -105,7 +105,8 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { return nullptr; } const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { - return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName) : NULL; + return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName) + : nullptr; } FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, XFA_Element eElement, @@ -113,7 +114,7 @@ FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, XFA_ATTRIBUTETYPE eType, uint32_t dwPacket) { const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); - if (pInfo == NULL) { + if (!pInfo) { return FALSE; } if (dwPacket && (dwPacket & pInfo->dwPackets) == 0) { @@ -150,7 +151,7 @@ CFX_WideStringC XFA_GetAttributeDefaultValue_Cdata(XFA_Element eElement, XFA_ATTRIBUTETYPE_Cdata, dwPacket)) { return (const FX_WCHAR*)pValue; } - return NULL; + return nullptr; } FX_BOOL XFA_GetAttributeDefaultValue_Boolean(XFA_Element eElement, XFA_ATTRIBUTE eAttribute, @@ -230,7 +231,7 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeOfElement(XFA_Element eElement, const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement, int32_t& iCount) { if (eElement == XFA_Element::Unknown) - return NULL; + return nullptr; const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementPropertyIndex + static_cast(eElement); @@ -242,8 +243,8 @@ const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, uint32_t dwPacket) { int32_t iCount = 0; const XFA_PROPERTY* pProperty = XFA_GetElementProperties(eElement, iCount); - if (pProperty == NULL || iCount < 1) { - return NULL; + if (!pProperty || iCount < 1) { + return nullptr; } int32_t iStart = 0, iEnd = iCount - 1, iMid; do { @@ -258,13 +259,13 @@ const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, } } while (iStart <= iEnd); if (iStart > iEnd) { - return NULL; + return nullptr; } const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eProperty); ASSERT(pInfo); if (dwPacket == XFA_XDPPACKET_UNKNOWN) return pProperty + iMid; - return (dwPacket & pInfo->dwPackets) ? (pProperty + iMid) : NULL; + return (dwPacket & pInfo->dwPackets) ? (pProperty + iMid) : nullptr; } const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, XFA_ATTRIBUTE eAttribute, @@ -278,7 +279,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { return pAttr; } - return NULL; + return nullptr; } else { int32_t iBefore = iMid - 1; if (iBefore >= 0) { @@ -288,7 +289,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { return pAttr; } - return NULL; + return nullptr; } iBefore--; if (iBefore < 0) { @@ -305,7 +306,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { return pAttr; } - return NULL; + return nullptr; } iAfter++; if (iAfter > g_iXFANotsureCount - 1) { @@ -314,7 +315,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, pAttr = g_XFANotsureAttributes + iAfter; } } - return NULL; + return nullptr; } } else if (eElement < pAttr->eElement) { iEnd = iMid - 1; @@ -322,7 +323,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, iStart = iMid + 1; } } while (iStart <= iEnd); - return NULL; + return nullptr; } const XFA_METHODINFO* XFA_GetMethodByName(XFA_Element eElement, @@ -354,7 +355,7 @@ const XFA_METHODINFO* XFA_GetMethodByName(XFA_Element eElement, } while (iStart <= iEnd); iElementIndex = scriptIndex->wParentIndex; } - return NULL; + return nullptr; } const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( XFA_Element eElement, @@ -385,7 +386,7 @@ const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( } while (iStart <= iEnd); iElementIndex = scriptIndex->wParentIndex; } - return NULL; + return nullptr; } void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) { if (wsMeasure.IsEmpty()) { @@ -588,7 +589,7 @@ uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { IFX_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess, int32_t iOffset, int32_t iLength) { - return NULL; + return nullptr; } void CXFA_WideTextRead::Lock() {} diff --git a/xfa/fxfa/parser/xfa_basic_imp.h b/xfa/fxfa/parser/xfa_basic_imp.h index 1c79f5439e..3badbb463e 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.h +++ b/xfa/fxfa/parser/xfa_basic_imp.h @@ -37,7 +37,7 @@ class CXFA_WideTextRead : public IFX_Stream { int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS, - int32_t const* pByteSize = NULL) override; + int32_t const* pByteSize = nullptr) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; void Flush() override {} diff --git a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp index 97ea8dd54b..bcd6a874b3 100644 --- a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp @@ -66,7 +66,7 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode( XFA_Element eNodeType, const CFX_WideString& wsName) { if (!pDataParent) { - return NULL; + return nullptr; } CXFA_Node* pParentDDNode = pDataParent->GetDataDescriptionNode(); if (!pParentDDNode) { @@ -116,6 +116,6 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode( pDataNode->SetFlag(XFA_NodeFlag_Initialized, false); return pDataNode; } - return NULL; + return nullptr; } } diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index d1aeae92dd..94aa07406b 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -142,7 +142,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, pWidgetData->GetSelectedItemsValue(wsSelTextArray); int32_t iSize = wsSelTextArray.GetSize(); if (iSize >= 1) { - CXFA_Node* pValue = NULL; + CXFA_Node* pValue = nullptr; for (int32_t i = 0; i < iSize; i++) { pValue = pDataNode->CreateSamePacketNode(XFA_Element::DataValue); pValue->SetCData(XFA_ATTRIBUTE_Name, L"value"); @@ -170,7 +170,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, pDataNode->SetAttributeValue(wsValue, wsFormatedValue); break; case XFA_Element::ExclGroup: { - CXFA_Node* pChecked = NULL; + CXFA_Node* pChecked = nullptr; CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pChild->GetElementType() != XFA_Element::Field) { @@ -216,7 +216,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CXFA_Node* pValue = pChild->GetProperty(0, XFA_Element::Value); CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items); CXFA_Node* pText = - pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : NULL; + pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; if (pText) { pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); } @@ -340,7 +340,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, } static CXFA_Node* XFA_DataMerge_GetGlobalBinding(CXFA_Document* pDocument, uint32_t dwNameHash) { - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; pDocument->m_rgGlobalBinding.Lookup(dwNameHash, pNode); return pNode; } @@ -357,7 +357,7 @@ static CXFA_Node* XFA_DataMerge_ScopeMatchGlobalBinding( uint32_t dwNameHash, XFA_Element eMatchDataNodeType, FX_BOOL bUpLevel = TRUE) { - for (CXFA_Node *pCurDataScope = pDataScope, *pLastDataScope = NULL; + for (CXFA_Node *pCurDataScope = pDataScope, *pLastDataScope = nullptr; pCurDataScope && pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets; pLastDataScope = pCurDataScope, pCurDataScope = @@ -387,7 +387,7 @@ static CXFA_Node* XFA_DataMerge_ScopeMatchGlobalBinding( break; } } - return NULL; + return nullptr; } static CXFA_Node* XFA_DataMerge_FindGlobalDataNode(CXFA_Document* pDocument, CFX_WideStringC wsName, @@ -455,14 +455,14 @@ static CXFA_Node* XFA_DataMerge_FindDataRefDataNode(CXFA_Document* pDocument, return pDocument->GetNotBindNode(rs.nodes); } if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) { - CXFA_Object* pObject = (rs.nodes.GetSize() > 0) ? rs.nodes[0] : NULL; + CXFA_Object* pObject = (rs.nodes.GetSize() > 0) ? rs.nodes[0] : nullptr; CXFA_Node* pNode = ToNode(pObject); if (!bForceBind && pNode && pNode->HasBindItem()) { - pNode = NULL; + pNode = nullptr; } return pNode; } - return NULL; + return nullptr; } CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument, XFA_Element eType, @@ -476,7 +476,7 @@ CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument, return pFormChild; } } - return NULL; + return nullptr; } static FX_BOOL XFA_NeedGenerateForm(CXFA_Node* pTemplateChild, FX_BOOL bUseInstanceManager = TRUE) { @@ -498,8 +498,8 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument, CXFA_Node* pTemplateNode, FX_BOOL bRecursive, CXFA_NodeArray* pSubformArray) { - CXFA_Node* pExistingNode = NULL; - if (pSubformArray == NULL) { + CXFA_Node* pExistingNode = nullptr; + if (!pSubformArray) { pExistingNode = XFA_DataMerge_FindFormDOMInstance( pDocument, pTemplateNode->GetElementType(), pTemplateNode->GetNameHash(), pFormParent); @@ -531,7 +531,7 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument, return pExistingNode; } CXFA_Node* pNewNode = pTemplateNode->CloneTemplateToForm(FALSE); - pFormParent->InsertChild(pNewNode, NULL); + pFormParent->InsertChild(pNewNode, nullptr); if (bRecursive) { for (CXFA_Node* pTemplateChild = pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -539,7 +539,7 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument, XFA_NODEITEM_NextSibling)) { if (XFA_NeedGenerateForm(pTemplateChild)) { CXFA_Node* pNewChild = pTemplateChild->CloneTemplateToForm(TRUE); - pNewNode->InsertChild(pNewChild, NULL); + pNewNode->InsertChild(pNewChild, nullptr); } } } @@ -590,7 +590,7 @@ static CXFA_Node* XFA_NodeMerge_CloneOrMergeInstanceManager( wsInstMgrNodeName = FX_WSTRC(L"_") + pTemplateNode->GetCData(XFA_ATTRIBUTE_Name); pNewNode->SetCData(XFA_ATTRIBUTE_Name, wsInstMgrNodeName); - pFormParent->InsertChild(pNewNode, NULL); + pFormParent->InsertChild(pNewNode, nullptr); pNewNode->SetTemplateNode(pTemplateNode); return pNewNode; } @@ -612,7 +612,7 @@ static CXFA_Node* XFA_DataMerge_FindMatchingDataNode( pIterator = new CXFA_NodeIteratorTemplate< CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>(pTemplateNode); } - CXFA_Node* pResult = NULL; + CXFA_Node* pResult = nullptr; for (CXFA_Node* pCurTemplateNode = pIterator->GetCurrent(); pCurTemplateNode;) { XFA_Element eMatchNodeType; @@ -751,20 +751,20 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( FX_BOOL bOneInstance, FX_BOOL bDataMerge) { XFA_Element eType = pTemplateNode->GetElementType(); - CXFA_Node* pOccurNode = NULL; - CXFA_Node* pFirstInstance = NULL; + CXFA_Node* pOccurNode = nullptr; + CXFA_Node* pFirstInstance = nullptr; FX_BOOL bUseInstanceManager = pFormParentNode->GetElementType() != XFA_Element::Area; - CXFA_Node* pInstMgrNode = NULL; + CXFA_Node* pInstMgrNode = nullptr; CXFA_NodeArray subformArray; - CXFA_NodeArray* pSearchArray = NULL; + CXFA_NodeArray* pSearchArray = nullptr; if (!bOneInstance && (eType == XFA_Element::SubformSet || eType == XFA_Element::Subform)) { pInstMgrNode = bUseInstanceManager ? XFA_NodeMerge_CloneOrMergeInstanceManager( pDocument, pFormParentNode, pTemplateNode, subformArray) - : NULL; + : nullptr; if (CXFA_Node* pOccurTemplateNode = pTemplateNode->GetFirstChildByClass(XFA_Element::Occur)) { pOccurNode = pInstMgrNode @@ -783,11 +783,11 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( if (pFormParentNode->GetElementType() == XFA_Element::PageArea) { bOneInstance = TRUE; if (subformArray.GetSize() < 1) { - pSearchArray = NULL; + pSearchArray = nullptr; } } else if ((pTemplateNode->GetNameHash() == 0) && (subformArray.GetSize() < 1)) { - pSearchArray = NULL; + pSearchArray = nullptr; } } } @@ -886,7 +886,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( if (eRelation != XFA_ATTRIBUTEENUM_Ordered && (pDataMatch = XFA_DataMerge_FindMatchingDataNode( pDocument, pTemplateChild, pDataScope, bAccessedDataDOM, - FALSE, NULL, bSelfMatch, eBindMatch)) != nullptr) { + FALSE, nullptr, bSelfMatch, eBindMatch)) != nullptr) { XFA_DataMerge_RecurseRecord sNewRecord = {pTemplateChild, pDataMatch}; if (bSelfMatch) { @@ -960,7 +960,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( if (pTemplateNode->GetNameHash() != 0) { break; } - pSearchArray = NULL; + pSearchArray = nullptr; } } else if (!XFA_DataMerge_FindFormDOMInstance( pDocument, pTemplateNode->GetElementType(), @@ -1036,7 +1036,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_Field(CXFA_Document* pDocument, pTemplateChildNode->IsContainerNode()) { if (pTemplateChildNode->GetElementType() == XFA_Element::Field) { XFA_DataMerge_CopyContainer_Field(pDocument, pTemplateChildNode, - pFieldNode, NULL, FALSE); + pFieldNode, nullptr, FALSE); } } } @@ -1045,7 +1045,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_Field(CXFA_Document* pDocument, FX_BOOL bSelfMatch = FALSE; XFA_ATTRIBUTEENUM eBindMatch; CXFA_Node* pDataNode = XFA_DataMerge_FindMatchingDataNode( - pDocument, pTemplateNode, pDataScope, bAccessedDataDOM, TRUE, NULL, + pDocument, pTemplateNode, pDataScope, bAccessedDataDOM, TRUE, nullptr, bSelfMatch, eBindMatch, bUpLevel); if (pDataNode) { XFA_DataMerge_CreateDataBinding(pFieldNode, pDataNode); @@ -1082,7 +1082,7 @@ CXFA_Node* CXFA_Document::DataMerge_CopyContainer(CXFA_Node* pTemplateNode, ASSERT(FALSE); break; } - return NULL; + return nullptr; } static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, @@ -1098,7 +1098,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, CXFA_Node* pTemplateNode = pFormNode->GetTemplateNode(); CXFA_Node* pTemplateNodeBind = pTemplateNode ? pTemplateNode->GetFirstChildByClass(XFA_Element::Bind) - : NULL; + : nullptr; XFA_ATTRIBUTEENUM eMatch = pTemplateNodeBind ? pTemplateNodeBind->GetEnum(XFA_ATTRIBUTE_Match) : XFA_ATTRIBUTEENUM_Once; @@ -1179,7 +1179,8 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, XFA_RESOLVENODE_RS rs; pDocument->GetScriptContext()->ResolveObjects(pDataScope, wsRef, rs, dFlags, pTemplateNode); - CXFA_Object* pObject = (rs.nodes.GetSize() > 0) ? rs.nodes[0] : NULL; + CXFA_Object* pObject = + (rs.nodes.GetSize() > 0) ? rs.nodes[0] : nullptr; pDataNode = ToNode(pObject); if (pDataNode) { XFA_DataMerge_CreateDataBinding( @@ -1257,7 +1258,7 @@ void CXFA_Document::DoDataMerge() { m_pRootNode->InsertChild(pDatasetsRoot); pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode); } - CXFA_Node *pDataRoot = NULL, *pDDRoot = NULL; + CXFA_Node *pDataRoot = nullptr, *pDDRoot = nullptr; CFX_WideString wsDatasetsURI; pDatasetsRoot->TryNamespace(wsDatasetsURI); for (CXFA_Node* pChildNode = @@ -1304,7 +1305,8 @@ void CXFA_Document::DoDataMerge() { return; } CXFA_Node* pTemplateChosen = - dwNameHash != 0 ? pTemplateRoot->GetFirstChildByName(dwNameHash) : NULL; + dwNameHash != 0 ? pTemplateRoot->GetFirstChildByName(dwNameHash) + : nullptr; if (!pTemplateChosen || pTemplateChosen->GetElementType() != XFA_Element::Subform) { pTemplateChosen = pTemplateRoot->GetFirstChildByClass(XFA_Element::Subform); @@ -1319,7 +1321,7 @@ void CXFA_Document::DoDataMerge() { pFormRoot = CreateNode(XFA_XDPPACKET_Form, XFA_Element::Form); ASSERT(pFormRoot); pFormRoot->SetCData(XFA_ATTRIBUTE_Name, L"form"); - m_pRootNode->InsertChild(pFormRoot, NULL); + m_pRootNode->InsertChild(pFormRoot, nullptr); } else { CXFA_NodeIteratorTemplate sIterator(pFormRoot); @@ -1399,7 +1401,7 @@ void CXFA_Document::DoDataRemerge(FX_BOOL bDoDataMerge) { while (CXFA_Node* pNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) { pFormRoot->RemoveChild(pNode); } - pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); + pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); } XFA_DataMerge_ClearGlobalBinding(this); if (bDoDataMerge) { diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.h b/xfa/fxfa/parser/xfa_document_datamerger_imp.h index f62ff8dace..a31bb3fd15 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.h +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.h @@ -14,7 +14,7 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer( CXFA_Node* pFormParent, CXFA_Node* pTemplateNode, FX_BOOL bRecursive, - CXFA_NodeArray* pSubformArray = NULL); + CXFA_NodeArray* pSubformArray = nullptr); CXFA_Node* XFA_DataMerge_FindDataScope(CXFA_Node* pParentFormNode); CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument, XFA_Element eType, diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index 45102c8fb6..bcc37d9f65 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -83,7 +83,7 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { case XFA_HASHCODE_Data: { CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); if (!pDatasetsNode) { - return NULL; + return nullptr; } for (CXFA_Node* pDatasetsChild = pDatasetsNode->GetFirstChildByClass(XFA_Element::DataGroup); @@ -105,46 +105,41 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { return pDatasetsChild; } } + return nullptr; } - return NULL; case XFA_HASHCODE_Record: { CXFA_Node* pData = ToNode(GetXFAObject(XFA_HASHCODE_Data)); - return pData ? pData->GetFirstChildByClass(XFA_Element::DataGroup) : NULL; + return pData ? pData->GetFirstChildByClass(XFA_Element::DataGroup) + : nullptr; } case XFA_HASHCODE_DataWindow: { - if (m_pScriptDataWindow == NULL) { + if (!m_pScriptDataWindow) m_pScriptDataWindow = new CScript_DataWindow(this); - } return m_pScriptDataWindow; } case XFA_HASHCODE_Event: { - if (m_pScriptEvent == NULL) { + if (!m_pScriptEvent) m_pScriptEvent = new CScript_EventPseudoModel(this); - } return m_pScriptEvent; } case XFA_HASHCODE_Host: { - if (m_pScriptHost == NULL) { + if (!m_pScriptHost) m_pScriptHost = new CScript_HostPseudoModel(this); - } return m_pScriptHost; } case XFA_HASHCODE_Log: { - if (m_pScriptLog == NULL) { + if (!m_pScriptLog) m_pScriptLog = new CScript_LogPseudoModel(this); - } return m_pScriptLog; } case XFA_HASHCODE_Signature: { - if (m_pScriptSignature == NULL) { + if (!m_pScriptSignature) m_pScriptSignature = new CScript_SignaturePseudoModel(this); - } return m_pScriptSignature; } case XFA_HASHCODE_Layout: { - if (m_pScriptLayout == NULL) { + if (!m_pScriptLayout) m_pScriptLayout = new CScript_LayoutPseudoModel(this); - } return m_pScriptLayout; } default: @@ -268,7 +263,7 @@ XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID) { if (!pRoot || wsID.IsEmpty()) { - return NULL; + return nullptr; } CXFA_NodeIterator sIterator(pRoot); for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; @@ -280,12 +275,12 @@ CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot, } } } - return NULL; + return nullptr; } static void XFA_ProtoMerge_MergeNodeRecurse(CXFA_Document* pDocument, CXFA_Node* pDestNodeParent, CXFA_Node* pProtoNode) { - CXFA_Node* pExistingNode = NULL; + CXFA_Node* pExistingNode = nullptr; for (CXFA_Node* pFormChild = pDestNodeParent->GetNodeItem(XFA_NODEITEM_FirstChild); pFormChild; @@ -310,7 +305,7 @@ static void XFA_ProtoMerge_MergeNodeRecurse(CXFA_Document* pDocument, } CXFA_Node* pNewNode = pProtoNode->Clone(TRUE); pNewNode->SetTemplateNode(pProtoNode); - pDestNodeParent->InsertChild(pNewNode, NULL); + pDestNodeParent->InsertChild(pNewNode, nullptr); } static void XFA_ProtoMerge_MergeNode(CXFA_Document* pDocument, CXFA_Node* pDestNode, @@ -392,7 +387,7 @@ void CXFA_Document::DoProtoMerge() { if (!wsURI.IsEmpty() && wsURI != FX_WSTRC(L".")) { continue; } - CXFA_Node* pProtoNode = NULL; + CXFA_Node* pProtoNode = nullptr; if (!wsSOM.IsEmpty()) { uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.cpp b/xfa/fxfa/parser/xfa_document_layout_imp.cpp index 723ae1db69..416982b749 100644 --- a/xfa/fxfa/parser/xfa_document_layout_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_layout_imp.cpp @@ -31,8 +31,8 @@ CXFA_LayoutProcessor* CXFA_Document::GetDocLayout() { } CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) : m_pDocument(pDocument), - m_pRootItemLayoutProcessor(NULL), - m_pLayoutPageMgr(NULL), + m_pRootItemLayoutProcessor(nullptr), + m_pLayoutPageMgr(nullptr), m_nProgressCounter(0), m_bNeeLayout(TRUE) {} CXFA_LayoutProcessor::~CXFA_LayoutProcessor() { @@ -110,7 +110,7 @@ int32_t CXFA_LayoutProcessor::DoLayout(IFX_Pause* pPause) { FX_BOOL CXFA_LayoutProcessor::IncrementLayout() { if (m_bNeeLayout) { StartLayout(TRUE); - return DoLayout(NULL) == 100; + return DoLayout(nullptr) == 100; } for (int32_t i = 0, c = m_rgChangedContainers.GetSize(); i < c; i++) { CXFA_Node* pNode = m_rgChangedContainers[i]; @@ -131,7 +131,7 @@ int32_t CXFA_LayoutProcessor::CountPages() const { return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPageCount() : 0; } CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetPage(int32_t index) const { - return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPage(index) : NULL; + return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPage(index) : nullptr; } CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) { return static_cast( @@ -143,7 +143,7 @@ void CXFA_LayoutProcessor::AddChangedContainer(CXFA_Node* pContainer) { } } CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetRootLayoutItem() const { - return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetRootLayoutItem() : NULL; + return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetRootLayoutItem() : nullptr; } void CXFA_LayoutProcessor::ClearLayoutData() { @@ -159,13 +159,13 @@ FX_BOOL CXFA_LayoutProcessor::IsNeedLayout() { } CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem) : m_pFormNode(pNode), - m_pParent(NULL), - m_pNextSibling(NULL), - m_pFirstChild(NULL), + m_pParent(nullptr), + m_pNextSibling(nullptr), + m_pFirstChild(nullptr), m_bIsContentLayoutItem(bIsContentLayoutItem) {} CXFA_LayoutItem::~CXFA_LayoutItem() {} CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode) - : CXFA_LayoutItem(pNode, FALSE), m_pOldSubform(NULL) {} + : CXFA_LayoutItem(pNode, FALSE), m_pOldSubform(nullptr) {} CXFA_LayoutProcessor* CXFA_ContainerLayoutItem::GetLayout() const { return m_pFormNode->GetDocument()->GetLayoutProcessor(); } @@ -195,11 +195,11 @@ CXFA_Node* CXFA_ContainerLayoutItem::GetMasterPage() const { } CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) : CXFA_LayoutItem(pNode, TRUE), - m_pPrev(NULL), - m_pNext(NULL), + m_pPrev(nullptr), + m_pNext(nullptr), m_dwStatus(0) {} CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() { if (m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY) == this) { - m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, NULL); + m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, nullptr); } } diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.h b/xfa/fxfa/parser/xfa_document_layout_imp.h index 4da405fc6c..87f7ca01af 100644 --- a/xfa/fxfa/parser/xfa_document_layout_imp.h +++ b/xfa/fxfa/parser/xfa_document_layout_imp.h @@ -20,7 +20,7 @@ class CXFA_LayoutProcessor { CXFA_Document* GetDocument() const; int32_t StartLayout(FX_BOOL bForceRestart = FALSE); - int32_t DoLayout(IFX_Pause* pPause = NULL); + int32_t DoLayout(IFX_Pause* pPause = nullptr); FX_BOOL IncrementLayout(); int32_t CountPages() const; CXFA_ContainerLayoutItem* GetPage(int32_t index) const; diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 5db2025f6c..52aa58530e 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -31,7 +31,7 @@ FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { pDataDocumentParser->Release(); return FALSE; } - if (pDataDocumentParser->DoParse(NULL) < XFA_PARSESTATUS_Done) { + if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done) { pDataDocumentParser->Release(); return FALSE; } @@ -477,7 +477,7 @@ FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite, IFX_Stream* pStream = IFX_Stream::CreateStream( pWrite, FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); - if (pStream == NULL) { + if (!pStream) { return FALSE; } pStream->SetCodePage(FX_CODEPAGE_UTF8); diff --git a/xfa/fxfa/parser/xfa_document_serialize.h b/xfa/fxfa/parser/xfa_document_serialize.h index 9136efce90..276a0d3faa 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.h +++ b/xfa/fxfa/parser/xfa_document_serialize.h @@ -33,7 +33,7 @@ class CXFA_DataExporter { FX_BOOL Export(IFX_FileWrite* pWrite, CXFA_Node* pNode, uint32_t dwFlag = 0, - const FX_CHAR* pChecksum = NULL); + const FX_CHAR* pChecksum = nullptr); protected: FX_BOOL Export(IFX_Stream* pStream, diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.h b/xfa/fxfa/parser/xfa_layout_appadapter.h index 685bc4482a..498c023fb8 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.h +++ b/xfa/fxfa/parser/xfa_layout_appadapter.h @@ -16,7 +16,7 @@ class CXFA_TraverseStrategy_PageAreaContainerLayoutItem { if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageSet) { return static_cast(pLayoutItem->m_pFirstChild); } - return NULL; + return nullptr; } static inline CXFA_ContainerLayoutItem* GetNextSibling( CXFA_ContainerLayoutItem* pLayoutItem) { diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 5b33e70c36..f5b0920548 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -83,9 +83,9 @@ CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( CXFA_Node* pFormNode) { if (!pFormNode) { - return NULL; + return nullptr; } - CXFA_ContentLayoutItem* pLayoutItem = NULL; + CXFA_ContentLayoutItem* pLayoutItem = nullptr; if (m_pOldLayoutItem) { pLayoutItem = m_pOldLayoutItem; m_pOldLayoutItem = m_pOldLayoutItem->m_pNext; @@ -207,7 +207,7 @@ static XFA_ATTRIBUTEENUM XFA_ItemLayoutProcessor_GetLayout( return XFA_ATTRIBUTEENUM_Position; } static FX_BOOL XFA_ExistContainerKeep(CXFA_Node* pCurNode, FX_BOOL bPreFind) { - if (pCurNode == NULL || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) { + if (!pCurNode || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) { return FALSE; } XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; @@ -216,7 +216,7 @@ static FX_BOOL XFA_ExistContainerKeep(CXFA_Node* pCurNode, FX_BOOL bPreFind) { } CXFA_Node* pPreContainer = pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode); - if (pPreContainer == NULL) { + if (!pPreContainer) { return FALSE; } CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_Element::Keep); @@ -285,7 +285,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); } - CXFA_ContentLayoutItem* pSecondLayoutItem = NULL; + CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr; if (m_pCurChildPreprocessor && m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) { pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem( @@ -319,14 +319,14 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( } CXFA_ContentLayoutItem* pChildren = (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; - pLayoutItem->m_pFirstChild = NULL; + pLayoutItem->m_pFirstChild = nullptr; FX_FLOAT lHeightForKeep = 0; CFX_ArrayTemplate keepLayoutItems; FX_FLOAT fAddMarginHeight = 0; - for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = NULL; + for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr; pChildItem; pChildItem = pChildNext) { pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; - pChildItem->m_pNextSibling = NULL; + pChildItem->m_pNextSibling = nullptr; if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin + XFA_LAYOUT_FLOAT_PERCISION) { if (!XFA_ExistContainerKeep(pChildItem->m_pFormNode, TRUE)) { @@ -381,7 +381,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( } void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { ASSERT(m_pLayoutItem); - SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos); + SplitLayoutItem(m_pLayoutItem, nullptr, fSplitPos); } CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { @@ -517,7 +517,7 @@ void CXFA_LayoutItem::AddChild(CXFA_LayoutItem* pChildItem) { pChildItem->m_pParent->RemoveChild(pChildItem); } pChildItem->m_pParent = this; - if (m_pFirstChild == NULL) { + if (!m_pFirstChild) { m_pFirstChild = pChildItem; } else { CXFA_LayoutItem* pExistingChildItem = m_pFirstChild; @@ -532,7 +532,7 @@ void CXFA_LayoutItem::AddHeadChild(CXFA_LayoutItem* pChildItem) { pChildItem->m_pParent->RemoveChild(pChildItem); } pChildItem->m_pParent = this; - if (m_pFirstChild == NULL) { + if (!m_pFirstChild) { m_pFirstChild = pChildItem; } else { CXFA_LayoutItem* pExistingChildItem = m_pFirstChild; @@ -546,7 +546,7 @@ void CXFA_LayoutItem::InsertChild(CXFA_LayoutItem* pBeforeItem, return; } if (pChildItem->m_pParent) { - pChildItem->m_pParent = NULL; + pChildItem->m_pParent = nullptr; } pChildItem->m_pParent = this; CXFA_LayoutItem* pExistingChildItem = pBeforeItem->m_pNextSibling; @@ -569,8 +569,8 @@ void CXFA_LayoutItem::RemoveChild(CXFA_LayoutItem* pChildItem) { pExistingChildItem->m_pNextSibling = pChildItem->m_pNextSibling; } } - pChildItem->m_pNextSibling = NULL; - pChildItem->m_pParent = NULL; + pChildItem->m_pNextSibling = nullptr; + pChildItem->m_pParent = nullptr; } CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem; @@ -657,7 +657,7 @@ static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { pNode = sIterator.MoveToNext()) { CXFA_ContentLayoutItem* pCurLayoutItem = (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY); - CXFA_ContentLayoutItem* pNextLayoutItem = NULL; + CXFA_ContentLayoutItem* pNextLayoutItem = nullptr; while (pCurLayoutItem) { pNextLayoutItem = pCurLayoutItem->m_pNext; pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem); @@ -822,7 +822,7 @@ void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( } } default: - pCurActionNode = NULL; + pCurActionNode = nullptr; nCurStage = XFA_ItemLayoutProcessorStages_Done; } } @@ -852,8 +852,8 @@ FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( } else { pNextContainer = m_pKeepHeadNode; m_bKeepBreakFinish = TRUE; - m_pKeepHeadNode = NULL; - m_pKeepTailNode = NULL; + m_pKeepHeadNode = nullptr; + m_pKeepTailNode = nullptr; m_bIsProcessKeep = FALSE; } } else { @@ -872,8 +872,8 @@ FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore( if (m_pKeepTailNode == pContainerNode) { pCurActionNode = m_pKeepHeadNode; m_bKeepBreakFinish = TRUE; - m_pKeepHeadNode = NULL; - m_pKeepTailNode = NULL; + m_pKeepHeadNode = nullptr; + m_pKeepTailNode = nullptr; m_bIsProcessKeep = FALSE; nCurStage = XFA_ItemLayoutProcessorStages_Container; return TRUE; @@ -1050,7 +1050,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE; XFA_ItemLayoutProcessorStages nCurChildNodeStage = XFA_ItemLayoutProcessorStages_None; - CXFA_LayoutItem* pBeforeItem = NULL; + CXFA_LayoutItem* pBeforeItem = nullptr; for (XFA_ItemLayoutProcessor_GotoNextContainerNode( pCurChildNode, nCurChildNodeStage, pFormNode, FALSE); pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( @@ -1062,7 +1062,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( continue; } CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pCurChildNode, NULL); + new CXFA_ItemLayoutProcessor(pCurChildNode, nullptr); pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); if (!pProcessor->HasLayoutItem()) { delete pProcessor; @@ -1075,7 +1075,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( fAbsoluteY); pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); - if (pBeforeItem == NULL) { + if (!pBeforeItem) { pPageAreaLayoutItem->AddHeadChild(pProcessItem); } else { pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); @@ -1083,7 +1083,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( pBeforeItem = pProcessItem; delete pProcessor; } - pBeforeItem = NULL; + pBeforeItem = nullptr; CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; while (pLayoutItem) { if (!pLayoutItem->IsContentLayoutItem() || @@ -1094,7 +1094,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::Draw) { CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; pPageAreaLayoutItem->RemoveChild(pLayoutItem); - if (pBeforeItem == NULL) { + if (!pBeforeItem) { pPageAreaLayoutItem->AddHeadChild(pLayoutItem); } else { pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); @@ -1381,7 +1381,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { if (m_pLayoutItem) return; - if (pLayoutNode == NULL) { + if (!pLayoutNode) { pLayoutNode = m_pFormNode; } ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); @@ -1426,7 +1426,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { CXFA_LayoutContext layoutContext; layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths; CXFA_LayoutContext* pLayoutContext = - iSpecifiedColumnCount > 0 ? &layoutContext : NULL; + iSpecifiedColumnCount > 0 ? &layoutContext : nullptr; if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { XFA_ItemLayoutProcessor_GotoNextContainerNode( m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); @@ -1493,7 +1493,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace( rgRowItems[i]->m_pFormNode)) { - pNewCell = NULL; + pNewCell = nullptr; } rgRowItems[i] = pNewCell; rgRowItemsSpan[i] = @@ -1817,7 +1817,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepForSplite( FX_BOOL& bAddedItemInRow, FX_BOOL& bForceEndPage, XFA_ItemLayoutProcessorResult& result) { - if (pParentProcessor == NULL || pChildProcessor == NULL) { + if (!pParentProcessor || !pChildProcessor) { return FALSE; } if (pParentProcessor->m_pCurChildNode->GetIntact() != @@ -1857,7 +1857,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::JudgePutNextPage( CXFA_ContentLayoutItem* pParentLayoutItem, FX_FLOAT fChildHeight, CFX_ArrayTemplate& pKeepItems) { - if (pParentLayoutItem == NULL) { + if (!pParentLayoutItem) { return FALSE; } FX_FLOAT fItemsHeight = 0; @@ -1892,7 +1892,7 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) { CXFA_Node* pBindNode = pNode->GetBindData(); if (pBindNode) { pBindNode->RemoveBindItem(pNode); - pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); + pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); } } pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); @@ -1905,7 +1905,7 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( CXFA_Node* pFormNode) { ProcessUnUseBinds(pLeaderNode); ProcessUnUseBinds(pTrailerNode); - if (pFormNode == NULL) { + if (!pFormNode) { return; } if (pFormNode->GetElementType() == XFA_Element::Overflow || @@ -1940,7 +1940,7 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( FX_FLOAT& fContentCurRowHeight, FX_BOOL& bAddedItemInRow, FX_BOOL& bForceEndPage, - CXFA_LayoutContext* pLayoutContext = NULL, + CXFA_LayoutContext* pLayoutContext = nullptr, FX_BOOL bNewRow = FALSE) { FX_BOOL bTakeSpace = XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode); @@ -2007,14 +2007,15 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( (fChildWidth <= fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) || (fContentWidthLimit - fContentCurRowAvailWidth <= XFA_LAYOUT_FLOAT_PERCISION)) { - CXFA_Node *pOverflowLeaderNode = NULL, *pOverflowTrailerNode = NULL, - *pFormNode = NULL; - CXFA_ContentLayoutItem* pTrailerLayoutItem = NULL; + CXFA_Node* pOverflowLeaderNode = nullptr; + CXFA_Node* pOverflowTrailerNode = nullptr; + CXFA_Node* pFormNode = nullptr; + CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr; FX_BOOL bIsAddTrailerHeight = FALSE; if (pThis->m_pPageMgr && pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode); - if (pFormNode == NULL && pLayoutContext && + if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) { pFormNode = pLayoutContext->m_pOverflowNode; bUseInherited = TRUE; @@ -2025,12 +2026,12 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) { if (pOverflowTrailerNode) { CXFA_ItemLayoutProcessor* pOverflowLeaderProcessor = - new CXFA_ItemLayoutProcessor(pOverflowTrailerNode, NULL); + new CXFA_ItemLayoutProcessor(pOverflowTrailerNode, nullptr); pOverflowLeaderProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); pTrailerLayoutItem = pOverflowLeaderProcessor->HasLayoutItem() ? pOverflowLeaderProcessor->ExtractLayoutItem() - : NULL; + : nullptr; delete pOverflowLeaderProcessor; } if (bUseInherited) { @@ -2148,7 +2149,8 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( } return XFA_ItemLayoutProcessorResult_PageFullBreak; } - CXFA_Node *pTempLeaderNode = NULL, *pTempTrailerNode = NULL; + CXFA_Node* pTempLeaderNode = nullptr; + CXFA_Node* pTempTrailerNode = nullptr; if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated && eRetValue != XFA_ItemLayoutProcessorResult_PageFullBreak) { pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, @@ -2195,9 +2197,10 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( } else if (fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(fChildHeight)) { - CXFA_Node *pTempLeaderNode = NULL, *pTempTrailerNode = NULL; + CXFA_Node* pTempLeaderNode = nullptr; + CXFA_Node* pTempTrailerNode = nullptr; if (pThis->m_pPageMgr) { - if (pFormNode == NULL && pLayoutContext) { + if (!pFormNode && pLayoutContext) { pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; } pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, @@ -2243,7 +2246,7 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( } } else { if (eRetValue == XFA_ItemLayoutProcessorResult_Done) { - if (pFormNode == NULL && pLayoutContext) { + if (!pFormNode && pLayoutContext) { pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; } if (pThis->m_pPageMgr) { @@ -2334,7 +2337,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } fRealHeight = fRealHeight - fTopInset - fBottomInset; FX_FLOAT fContentCurRowY = 0; - CXFA_ContentLayoutItem* pLayoutChild = NULL; + CXFA_ContentLayoutItem* pLayoutChild = nullptr; if (m_pLayoutItem) { if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done && eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) { @@ -2396,7 +2399,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (pLayoutChild) { for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { - if (pLayoutNext->m_pNextSibling == NULL && m_pCurChildPreprocessor && + if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor && m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) { pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem; m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext; @@ -2421,7 +2424,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } if ((CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild == pLayoutChild) { - m_pLayoutItem->m_pFirstChild = NULL; + m_pLayoutItem->m_pFirstChild = nullptr; } else { CXFA_ContentLayoutItem* pLayoutNext = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; @@ -2430,7 +2433,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { if ((CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling == pLayoutChild) { - pLayoutNext->m_pNextSibling = NULL; + pLayoutNext->m_pNextSibling = nullptr; break; } } @@ -2438,13 +2441,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( CXFA_ContentLayoutItem* pLayoutNextTemp = (CXFA_ContentLayoutItem*)pLayoutChild; while (pLayoutNextTemp) { - pLayoutNextTemp->m_pParent = NULL; + pLayoutNextTemp->m_pParent = nullptr; CXFA_ContentLayoutItem* pSaveLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling; - pLayoutNextTemp->m_pNextSibling = NULL; + pLayoutNextTemp->m_pNextSibling = nullptr; pLayoutNextTemp = pSaveLayoutNext; } - pLayoutChild = NULL; + pLayoutChild = nullptr; } while (m_pCurChildNode) { CXFA_ItemLayoutProcessor* pProcessor = nullptr; @@ -2462,7 +2465,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pLayoutItem->RemoveChild(pItem); fContentCalculatedHeight -= pItem->m_sSize.y; } - CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; + CXFA_Node* pLeaderNode = nullptr; + CXFA_Node* pTrailerNode = nullptr; FX_BOOL bCreatePage = FALSE; if (bUseBreakControl && m_pPageMgr && m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, @@ -2476,7 +2480,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent) ->GetElementType() == XFA_Element::Form && - m_pLayoutItem == NULL) { + !m_pLayoutItem) { XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, TRUE); } else { @@ -2500,7 +2504,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } } break; case XFA_ItemLayoutProcessorStages_BreakAfter: { - CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; + CXFA_Node* pLeaderNode = nullptr; + CXFA_Node* pTrailerNode = nullptr; FX_BOOL bCreatePage = FALSE; if (bUseBreakControl && m_pPageMgr && m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, @@ -2556,10 +2561,10 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } } break; case XFA_ItemLayoutProcessorStages_BookendLeader: { - CXFA_Node* pLeaderNode = NULL; + CXFA_Node* pLeaderNode = nullptr; if (m_pCurChildPreprocessor) { pProcessor = m_pCurChildPreprocessor; - m_pCurChildPreprocessor = NULL; + m_pCurChildPreprocessor = nullptr; } else if (m_pPageMgr && m_pPageMgr->ProcessBookendLeaderOrTrailer( m_pCurChildNode, TRUE, pLeaderNode)) { @@ -2577,15 +2582,15 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( goto SuspendAndCreateNewRow; } else { delete pProcessor; - pProcessor = NULL; + pProcessor = nullptr; } } } break; case XFA_ItemLayoutProcessorStages_BookendTrailer: { - CXFA_Node* pTrailerNode = NULL; + CXFA_Node* pTrailerNode = nullptr; if (m_pCurChildPreprocessor) { pProcessor = m_pCurChildPreprocessor; - m_pCurChildPreprocessor = NULL; + m_pCurChildPreprocessor = nullptr; } else if (m_pPageMgr && m_pPageMgr->ProcessBookendLeaderOrTrailer( m_pCurChildNode, FALSE, pTrailerNode)) { @@ -2603,7 +2608,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( goto SuspendAndCreateNewRow; } else { delete pProcessor; - pProcessor = NULL; + pProcessor = nullptr; } } } break; @@ -2621,7 +2626,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( FX_BOOL bNewRow = FALSE; if (m_pCurChildPreprocessor) { pProcessor = m_pCurChildPreprocessor; - m_pCurChildPreprocessor = NULL; + m_pCurChildPreprocessor = nullptr; bNewRow = TRUE; } else { pProcessor = @@ -2650,7 +2655,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( fContentCurRowY += XFA_ItemLayoutProcessor_InsertPendingItems( pProcessor, m_pCurChildNode); delete pProcessor; - pProcessor = NULL; + pProcessor = nullptr; } } break; @@ -2694,7 +2699,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( fContainerHeight); if (fContainerHeight >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || bRetValue) { - if (m_pLayoutItem == NULL) { + if (!m_pLayoutItem) { m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); } if (fContainerHeight < 0) { @@ -2746,7 +2751,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition( } return FALSE; } - if (m_pLayoutItem == NULL) { + if (!m_pLayoutItem) { m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); } if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) { diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.h b/xfa/fxfa/parser/xfa_layout_itemlayout.h index fc279893c8..f326715339 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.h +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.h @@ -47,12 +47,12 @@ enum XFA_ItemLayoutProcessorStages { class CXFA_LayoutContext { public: CXFA_LayoutContext() - : m_prgSpecifiedColumnWidths(NULL), + : m_prgSpecifiedColumnWidths(nullptr), m_fCurColumnWidth(0), m_bCurColumnWidthAvaiable(FALSE), - m_pOverflowProcessor(NULL), - m_pOverflowNode(NULL) {} - ~CXFA_LayoutContext() { m_pOverflowProcessor = NULL; } + m_pOverflowProcessor(nullptr), + m_pOverflowNode(nullptr) {} + ~CXFA_LayoutContext() { m_pOverflowProcessor = nullptr; } CFX_ArrayTemplate* m_prgSpecifiedColumnWidths; FX_FLOAT m_fCurColumnWidth; FX_BOOL m_bCurColumnWidthAvaiable; @@ -69,7 +69,7 @@ class CXFA_ItemLayoutProcessor { FX_BOOL bUseBreakControl, FX_FLOAT fHeightLimit, FX_FLOAT fRealHeight = XFA_LAYOUT_FLOAT_MAX, - CXFA_LayoutContext* pContext = NULL); + CXFA_LayoutContext* pContext = nullptr); void GetCurrentComponentPos(FX_FLOAT& fAbsoluteX, FX_FLOAT& fAbsoluteY); @@ -78,8 +78,8 @@ class CXFA_ItemLayoutProcessor { void SetCurrentComponentPos(FX_FLOAT fAbsoluteX, FX_FLOAT fAbsoluteY); void SetCurrentComponentSize(FX_FLOAT fWidth, FX_FLOAT fHeight); - inline CXFA_Node* GetFormNode() { return m_pFormNode; } - inline FX_BOOL HasLayoutItem() { return m_pLayoutItem != NULL; } + CXFA_Node* GetFormNode() { return m_pFormNode; } + FX_BOOL HasLayoutItem() { return !!m_pLayoutItem; } CXFA_ContentLayoutItem* ExtractLayoutItem(); static FX_BOOL IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor, @@ -139,14 +139,14 @@ class CXFA_ItemLayoutProcessor { CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode); protected: - void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext = NULL); + void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext = nullptr); void DoLayoutTableContainer(CXFA_Node* pLayoutNode); XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer( FX_BOOL bUseBreakControl, XFA_ATTRIBUTEENUM eFlowStrategy, FX_FLOAT fHeightLimit, FX_FLOAT fRealHeight, - CXFA_LayoutContext* pContext = NULL, + CXFA_LayoutContext* pContext = nullptr, FX_BOOL bRootForceTb = FALSE); void DoLayoutField(); void XFA_ItemLayoutProcessor_GotoNextContainerNode( diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 36e72dbd2d..2ade051a81 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -192,7 +192,7 @@ FX_BOOL CheckContentAreaNotUsed( pLayoutItem; pLayoutItem = (CXFA_ContainerLayoutItem*)pLayoutItem->m_pNextSibling) { if (pLayoutItem->m_pFormNode == pContentArea) { - if (pLayoutItem->m_pFirstChild == NULL) { + if (!pLayoutItem->m_pFirstChild) { pContentAreaLayoutItem = pLayoutItem; return TRUE; } @@ -234,7 +234,7 @@ CXFA_LayoutPageMgr::CXFA_LayoutPageMgr(CXFA_LayoutProcessor* pLayoutProcessor) CXFA_LayoutPageMgr::~CXFA_LayoutPageMgr() { ClearData(); CXFA_LayoutItem* pLayoutItem = GetRootLayoutItem(); - CXFA_LayoutItem* pNextLayout = NULL; + CXFA_LayoutItem* pNextLayout = nullptr; for (; pLayoutItem; pLayoutItem = pNextLayout) { pNextLayout = pLayoutItem->m_pNextSibling; XFA_ReleaseLayoutItem(pLayoutItem); @@ -249,9 +249,9 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { m_pTemplatePageSetRoot = pTemplateNode->GetProperty(0, XFA_Element::PageSet); ASSERT(m_pTemplatePageSetRoot); if (m_pPageSetLayoutItemRoot) { - m_pPageSetLayoutItemRoot->m_pParent = NULL; - m_pPageSetLayoutItemRoot->m_pFirstChild = NULL; - m_pPageSetLayoutItemRoot->m_pNextSibling = NULL; + m_pPageSetLayoutItemRoot->m_pParent = nullptr; + m_pPageSetLayoutItemRoot->m_pFirstChild = nullptr; + m_pPageSetLayoutItemRoot->m_pNextSibling = nullptr; m_pPageSetLayoutItemRoot->m_pFormNode = m_pTemplatePageSetRoot; } else { m_pPageSetLayoutItemRoot = @@ -266,7 +266,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { m_ePageSetMode = eRelation; } InitPageSetMap(); - CXFA_Node* pPageArea = NULL; + CXFA_Node* pPageArea = nullptr; int32_t iCount = 0; for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild); pPageArea; @@ -290,7 +290,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { if (!pPageArea) { return FALSE; } - m_pTemplatePageSetRoot->InsertChild(pPageArea, NULL); + m_pTemplatePageSetRoot->InsertChild(pPageArea, nullptr); pPageArea->SetFlag(XFA_NodeFlag_Initialized, true); } CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_Element::ContentArea); @@ -300,7 +300,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { if (!pContentArea) { return FALSE; } - pPageArea->InsertChild(pContentArea, NULL); + pPageArea->InsertChild(pContentArea, nullptr); pContentArea->SetFlag(XFA_NodeFlag_Initialized, true); pContentArea->SetMeasure(XFA_ATTRIBUTE_X, CXFA_Measurement(0.25f, XFA_UNIT_In)); @@ -318,7 +318,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { if (!pContentArea) { return FALSE; } - pPageArea->InsertChild(pMedium, NULL); + pPageArea->InsertChild(pMedium, nullptr); pMedium->SetFlag(XFA_NodeFlag_Initialized, true); pMedium->SetMeasure(XFA_ATTRIBUTE_Short, CXFA_Measurement(8.5f, XFA_UNIT_In)); @@ -329,7 +329,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { } FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { FX_BOOL bProBreakBefore = FALSE; - CXFA_Node* pBreakBeforeNode = NULL; + CXFA_Node* pBreakBeforeNode = nullptr; while (pRootSubform) { for (CXFA_Node* pBreakNode = pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -369,11 +369,11 @@ FX_BOOL CXFA_LayoutPageMgr::AppendNewPage(FX_BOOL bFirstTemPage) { m_rgProposedContainerRecord.GetTailPosition()) { return TRUE; } - CXFA_Node* pPageNode = GetNextAvailPageArea(NULL); + CXFA_Node* pPageNode = GetNextAvailPageArea(nullptr); if (!pPageNode) { return FALSE; } - if (bFirstTemPage && m_pCurrentContainerRecord == NULL) { + if (bFirstTemPage && !m_pCurrentContainerRecord) { m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); } return !bFirstTemPage || m_pCurrentContainerRecord; @@ -464,7 +464,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( FX_BOOL bCreateNew) { CXFA_ContainerRecord* pNewRecord = new CXFA_ContainerRecord(); if (m_pCurrentContainerRecord) { - if (!IsPageSetRootOrderedOccurrence() || pPageNode == NULL) { + if (!IsPageSetRootOrderedOccurrence() || !pPageNode) { *pNewRecord = *GetCurrentContainerRecord(); m_rgProposedContainerRecord.AddTail(pNewRecord); return pNewRecord; @@ -476,13 +476,13 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( } else { CXFA_ContainerLayoutItem* pParentLayoutItem = (CXFA_ContainerLayoutItem*)pPageSet->GetUserData(XFA_LAYOUTITEMKEY); - if (pParentLayoutItem == NULL) { + if (!pParentLayoutItem) { pParentLayoutItem = m_pPageSetCurRoot; } pNewRecord->pCurPageSet = pParentLayoutItem; } } else { - CXFA_ContainerLayoutItem* pParentPageSetLayout = NULL; + CXFA_ContainerLayoutItem* pParentPageSetLayout = nullptr; if (pPageSet == GetCurrentContainerRecord()->pCurPageSet->m_pFormNode) { pParentPageSetLayout = (CXFA_ContainerLayoutItem*)GetCurrentContainerRecord() @@ -496,7 +496,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( CXFA_ContainerLayoutItem* pPageSetLayoutItem = new CXFA_ContainerLayoutItem(pPageSet); pPageSet->SetUserData(XFA_LAYOUTITEMKEY, (void*)pPageSetLayoutItem); - if (pParentPageSetLayout == NULL) { + if (!pParentPageSetLayout) { CXFA_ContainerLayoutItem* pPrePageSet = m_pPageSetLayoutItemRoot; while (pPrePageSet->m_pNextSibling) { pPrePageSet = (CXFA_ContainerLayoutItem*)pPrePageSet->m_pNextSibling; @@ -529,7 +529,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( } void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, CXFA_Node* pNewPageArea) { - CXFA_ContainerLayoutItem* pNewPageAreaLayoutItem = NULL; + CXFA_ContainerLayoutItem* pNewPageAreaLayoutItem = nullptr; if (m_PageArray.GetSize() > m_nAvailPages) { CXFA_ContainerLayoutItem* pContainerItem = m_PageArray[m_nAvailPages]; pContainerItem->m_pFormNode = pNewPageArea; @@ -547,13 +547,13 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, } pNewRecord->pCurPageSet->AddChild(pNewPageAreaLayoutItem); pNewRecord->pCurPageArea = pNewPageAreaLayoutItem; - pNewRecord->pCurContentArea = NULL; + pNewRecord->pCurContentArea = nullptr; } void CXFA_LayoutPageMgr::AddContentAreaLayoutItem( CXFA_ContainerRecord* pNewRecord, CXFA_Node* pContentArea) { - if (pContentArea == NULL) { - pNewRecord->pCurContentArea = NULL; + if (!pContentArea) { + pNewRecord->pCurContentArea = nullptr; return; } CXFA_ContainerLayoutItem* pNewContentAreaLayoutItem = @@ -580,7 +580,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { default: { ProcessLastPageSet(); } break; case XFA_ATTRIBUTEENUM_SimplexPaginated: case XFA_ATTRIBUTEENUM_DuplexPaginated: { - CXFA_LayoutItem* pLastPageAreaLayoutItem = NULL; + CXFA_LayoutItem* pLastPageAreaLayoutItem = nullptr; int32_t nPageAreaCount = 0; for (CXFA_LayoutItem* pPageAreaLayoutItem = pPageSetLayoutItem->m_pFirstChild; @@ -597,13 +597,13 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { break; } if (!FindPageAreaFromPageSet_SimplexDuplex( - pPageSetLayoutItem->m_pFormNode, NULL, NULL, NULL, TRUE, TRUE, - nPageAreaCount == 1 ? XFA_ATTRIBUTEENUM_Only - : XFA_ATTRIBUTEENUM_Last) && + pPageSetLayoutItem->m_pFormNode, nullptr, nullptr, nullptr, + TRUE, TRUE, nPageAreaCount == 1 ? XFA_ATTRIBUTEENUM_Only + : XFA_ATTRIBUTEENUM_Last) && (nPageAreaCount == 1 && !FindPageAreaFromPageSet_SimplexDuplex( - pPageSetLayoutItem->m_pFormNode, NULL, NULL, NULL, TRUE, - TRUE, XFA_ATTRIBUTEENUM_Last))) { + pPageSetLayoutItem->m_pFormNode, nullptr, nullptr, nullptr, + TRUE, TRUE, XFA_ATTRIBUTEENUM_Last))) { break; } CXFA_Node* pNode = m_pCurPageArea; @@ -719,39 +719,39 @@ FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, switch (eTargetType) { case XFA_ATTRIBUTEENUM_ContentArea: if (pTarget && pTarget->GetElementType() != XFA_Element::ContentArea) { - pTarget = NULL; + pTarget = nullptr; } if (!pTarget || !m_pCurrentContainerRecord || pTarget != GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || bStartNew) { - CXFA_Node* pPageArea = NULL; + CXFA_Node* pPageArea = nullptr; if (pTarget) { pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); } pPageArea = GetNextAvailPageArea(pPageArea, pTarget); - bRet = pPageArea != NULL; + bRet = !!pPageArea; } break; case XFA_ATTRIBUTEENUM_PageArea: if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { - pTarget = NULL; + pTarget = nullptr; } if (!pTarget || !m_pCurrentContainerRecord || pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || bStartNew) { - CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, NULL, TRUE); - bRet = pPageArea != NULL; + CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, nullptr, TRUE); + bRet = !!pPageArea; } break; case XFA_ATTRIBUTEENUM_PageOdd: if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { - pTarget = NULL; + pTarget = nullptr; } break; case XFA_ATTRIBUTEENUM_PageEven: if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { - pTarget = NULL; + pTarget = nullptr; } break; case XFA_ATTRIBUTEENUM_Auto: @@ -837,14 +837,15 @@ FX_BOOL CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter( CXFA_Node*& pBreakLeaderNode, CXFA_Node*& pBreakTrailerNode, FX_BOOL& bCreatePage) { - CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; + CXFA_Node* pLeaderTemplate = nullptr; + CXFA_Node* pTrailerTemplate = nullptr; CXFA_Node* pFormNode = pBreakNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); if (XFA_ItemLayoutProcessor_IsTakingSpace(pFormNode)) { bCreatePage = ExecuteBreakBeforeOrAfter(pBreakNode, bBefore, pLeaderTemplate, pTrailerTemplate); CXFA_Document* pDocument = pBreakNode->GetDocument(); - CXFA_Node* pDataScope = NULL; + CXFA_Node* pDataScope = nullptr; pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); if (pLeaderTemplate) { @@ -873,12 +874,12 @@ FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( CXFA_Node* pBookendNode, FX_BOOL bLeader, CXFA_Node*& pBookendAppendNode) { - CXFA_Node* pLeaderTemplate = NULL; + CXFA_Node* pLeaderTemplate = nullptr; CXFA_Node* pFormNode = pBookendNode->GetNodeItem( XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { CXFA_Document* pDocument = pBookendNode->GetDocument(); - CXFA_Node* pDataScope = NULL; + CXFA_Node* pDataScope = nullptr; if (pLeaderTemplate) { if (!pDataScope) { pDataScope = XFA_DataMerge_FindDataScope(pFormNode); @@ -937,41 +938,42 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, } return pOverflowNode; } - return NULL; - } else if (pOverflowNode->GetElementType() == XFA_Element::Overflow) { - CFX_WideStringC wsOverflowLeader; - CFX_WideStringC wsOverflowTrailer; - CFX_WideStringC wsOverflowTarget; - pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); - pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); - pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); - if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { - CXFA_Node* pTarget = - ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); - if (pTarget) { - m_bCreateOverFlowPage = TRUE; - switch (pTarget->GetElementType()) { - case XFA_Element::PageArea: - RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, pTarget, - TRUE); - break; - case XFA_Element::ContentArea: - RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_ContentArea, - pTarget, TRUE); - break; - default: - break; - } + return nullptr; + } + + if (pOverflowNode->GetElementType() != XFA_Element::Overflow) + return nullptr; + + CFX_WideStringC wsOverflowLeader; + CFX_WideStringC wsOverflowTrailer; + CFX_WideStringC wsOverflowTarget; + pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); + pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); + pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); + if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { + CXFA_Node* pTarget = + ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); + if (pTarget) { + m_bCreateOverFlowPage = TRUE; + switch (pTarget->GetElementType()) { + case XFA_Element::PageArea: + RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, pTarget, + TRUE); + break; + case XFA_Element::ContentArea: + RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_ContentArea, + pTarget, TRUE); + break; + default: + break; } } - if (!bCreatePage) { - pLeaderTemplate = ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); - pTrailerTemplate = - ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); - } - return pOverflowNode; } - return nullptr; + if (!bCreatePage) { + pLeaderTemplate = ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); + pTrailerTemplate = ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); + } + return pOverflowNode; } FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, @@ -979,10 +981,11 @@ FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, CXFA_Node*& pTrailerNode, FX_BOOL bDataMerge, FX_BOOL bCreatePage) { - if (pFormNode == NULL) { + if (!pFormNode) { return FALSE; } - CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; + CXFA_Node* pLeaderTemplate = nullptr; + CXFA_Node* pTrailerTemplate = nullptr; FX_BOOL bIsOverflowNode = FALSE; if (pFormNode->GetElementType() == XFA_Element::Overflow || pFormNode->GetElementType() == XFA_Element::Break) { @@ -998,7 +1001,7 @@ FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); } CXFA_Document* pDocument = pCurNode->GetDocument(); - CXFA_Node* pDataScope = NULL; + CXFA_Node* pDataScope = nullptr; if (pLeaderTemplate) { if (!pDataScope) { pDataScope = XFA_DataMerge_FindDataScope(pFormNode); @@ -1061,7 +1064,7 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( CXFA_Node* pTargetContentArea, FX_BOOL bNewPage, FX_BOOL bQuery) { - if (pPageSet == NULL && pStartChild == NULL) { + if (!pPageSet && !pStartChild) { return FALSE; } if (IsPageSetRootOrderedOccurrence()) { @@ -1102,20 +1105,19 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered( for (; pCurrentNode; pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { - if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { - if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == - NULL) { + if ((pTargetPageArea == pCurrentNode || !pTargetPageArea)) { + if (!pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea)) { if (pTargetPageArea == pCurrentNode) { CreateMinPageRecord(pCurrentNode, TRUE); - pTargetPageArea = NULL; + pTargetPageArea = nullptr; } continue; } if (!bQuery) { CXFA_ContainerRecord* pNewRecord = - CreateContainerRecord(pCurrentNode, pStartChild == NULL); + CreateContainerRecord(pCurrentNode, !pStartChild); AddPageAreaLayoutItem(pNewRecord, pCurrentNode); - if (pTargetContentArea == NULL) { + if (!pTargetContentArea) { pTargetContentArea = pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea); } @@ -1130,9 +1132,9 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered( CreateMinPageRecord(pCurrentNode, FALSE); } } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { - if (FindPageAreaFromPageSet_Ordered(pCurrentNode, NULL, pTargetPageArea, - pTargetContentArea, bNewPage, - bQuery)) { + if (FindPageAreaFromPageSet_Ordered(pCurrentNode, nullptr, + pTargetPageArea, pTargetContentArea, + bNewPage, bQuery)) { bRes = TRUE; break; } @@ -1155,8 +1157,9 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( FX_BOOL bQuery, XFA_ATTRIBUTEENUM ePreferredPosition) { const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; - CXFA_Node *pPreferredPageArea = NULL, *pFallbackPageArea = NULL; - CXFA_Node* pCurrentNode = NULL; + CXFA_Node* pPreferredPageArea = nullptr; + CXFA_Node* pFallbackPageArea = nullptr; + CXFA_Node* pCurrentNode = nullptr; if (!pStartChild || pStartChild->GetElementType() == XFA_Element::PageArea) { pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); } else { @@ -1198,13 +1201,12 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( } return FALSE; } - if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { - if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == - NULL) { + if ((pTargetPageArea == pCurrentNode || !pTargetPageArea)) { + if (!pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea)) { if (pTargetPageArea == pCurrentNode) { CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); AddPageAreaLayoutItem(pNewRecord, pCurrentNode); - pTargetPageArea = NULL; + pTargetPageArea = nullptr; } continue; } @@ -1226,13 +1228,13 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( } } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { if (FindPageAreaFromPageSet_SimplexDuplex( - pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, - bQuery, ePreferredPosition)) { + pCurrentNode, nullptr, pTargetPageArea, pTargetContentArea, + bNewPage, bQuery, ePreferredPosition)) { break; } } } - CXFA_Node* pCurPageArea = NULL; + CXFA_Node* pCurPageArea = nullptr; if (pPreferredPageArea) { pCurPageArea = pPreferredPageArea; } else if (pFallbackPageArea) { @@ -1244,7 +1246,7 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( if (!bQuery) { CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); AddPageAreaLayoutItem(pNewRecord, pCurPageArea); - if (pTargetContentArea == NULL) { + if (!pTargetContentArea) { pTargetContentArea = pCurPageArea->GetFirstChildByClass(XFA_Element::ContentArea); } @@ -1276,13 +1278,13 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( CXFA_Node* pTargetContentArea, FX_BOOL bNewPage, FX_BOOL bQuery) { - if (m_pCurPageArea == NULL) { - FindPageAreaFromPageSet(m_pTemplatePageSetRoot, NULL, pTargetPageArea, + if (!m_pCurPageArea) { + FindPageAreaFromPageSet(m_pTemplatePageSetRoot, nullptr, pTargetPageArea, pTargetContentArea, bNewPage, bQuery); ASSERT(m_pCurPageArea); return m_pCurPageArea; } - if (pTargetPageArea == NULL || pTargetPageArea == m_pCurPageArea) { + if (!pTargetPageArea || pTargetPageArea == m_pCurPageArea) { if (!bNewPage && GetNextContentArea(pTargetContentArea)) { return m_pCurPageArea; } @@ -1298,7 +1300,7 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(m_pCurPageArea); AddPageAreaLayoutItem(pNewRecord, m_pCurPageArea); - if (pTargetContentArea == NULL) { + if (!pTargetContentArea) { pTargetContentArea = m_pCurPageArea->GetFirstChildByClass(XFA_Element::ContentArea); } @@ -1319,14 +1321,14 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( } CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); while (TRUE) { - if (FindPageAreaFromPageSet(pPageSet, NULL, pTargetPageArea, + if (FindPageAreaFromPageSet(pPageSet, nullptr, pTargetPageArea, pTargetContentArea, bNewPage, bQuery)) { return m_pCurPageArea; } if (!bQuery && IsPageSetRootOrderedOccurrence()) { CreateMinPageSetRecord(pPageSet); } - if (FindPageAreaFromPageSet(NULL, pPageSet, pTargetPageArea, + if (FindPageAreaFromPageSet(nullptr, pPageSet, pTargetPageArea, pTargetContentArea, bNewPage, bQuery)) { return m_pCurPageArea; } @@ -1335,23 +1337,23 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( } pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); } - return NULL; + return nullptr; } FX_BOOL CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) { CXFA_Node* pCurContentNode = GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; - if (pContentArea == NULL) { + if (!pContentArea) { pContentArea = pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); - if (pContentArea == NULL) { + if (!pContentArea) { return FALSE; } } else { if (pContentArea->GetNodeItem(XFA_NODEITEM_Parent) != m_pCurPageArea) { return FALSE; } - CXFA_ContainerLayoutItem* pContentAreaLayout = NULL; + CXFA_ContainerLayoutItem* pContentAreaLayout = nullptr; if (!CheckContentAreaNotUsed(GetCurrentContainerRecord()->pCurPageArea, pContentArea, pContentAreaLayout)) { return FALSE; @@ -1389,7 +1391,7 @@ void CXFA_LayoutPageMgr::InitPageSetMap() { int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, FX_BOOL bTargetPageArea, FX_BOOL bCreateLast) { - if (pPageArea == NULL) { + if (!pPageArea) { return 0; } CXFA_Node* pOccurNode = pPageArea->GetFirstChildByClass(XFA_Element::Occur); @@ -1415,7 +1417,7 @@ int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, } void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, FX_BOOL bCreateAll) { - if (pPageSet == NULL) { + if (!pPageSet) { return; } int32_t iCurSetCount = 0; @@ -1447,7 +1449,7 @@ void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, } } void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { - if (pRecordNode == NULL) { + if (!pRecordNode) { return; } for (CXFA_Node* pCurrentNode = @@ -1477,7 +1479,7 @@ void CXFA_LayoutPageMgr::ProcessLastPageSet() { FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { CXFA_Node* pCurContentNode = GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; - if (pCurContentNode == NULL) { + if (!pCurContentNode) { return FALSE; } pCurContentNode = @@ -1495,7 +1497,8 @@ FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { CXFA_Node* pSrcPage = m_pCurPageArea; int32_t nSrcPageCount = m_nCurPageCount; FX_POSITION psSrcRecord = m_rgProposedContainerRecord.GetTailPosition(); - CXFA_Node* pNextPage = GetNextAvailPageArea(NULL, NULL, FALSE, TRUE); + CXFA_Node* pNextPage = + GetNextAvailPageArea(nullptr, nullptr, FALSE, TRUE); m_pCurPageArea = pSrcPage; m_nCurPageCount = nSrcPageCount; CXFA_ContainerRecord* pPrevRecord = @@ -1553,8 +1556,8 @@ void CXFA_LayoutPageMgr::ClearRecordList() { } m_rgProposedContainerRecord.RemoveAll(); } - m_pCurrentContainerRecord = NULL; - m_pCurPageArea = NULL; + m_pCurrentContainerRecord = nullptr; + m_pCurPageArea = nullptr; m_nCurPageCount = 0; m_bCreateOverFlowPage = FALSE; m_pPageSetMap.RemoveAll(); @@ -1596,9 +1599,9 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { if (pCurLayoutItem->m_pFirstChild) { SaveLayoutItem(pCurLayoutItem); } - pCurLayoutItem->m_pParent = NULL; - pCurLayoutItem->m_pNextSibling = NULL; - pCurLayoutItem->m_pFirstChild = NULL; + pCurLayoutItem->m_pParent = nullptr; + pCurLayoutItem->m_pNextSibling = nullptr; + pCurLayoutItem->m_pFirstChild = nullptr; if (!pCurLayoutItem->IsContentLayoutItem() && pCurLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageArea) { @@ -1623,12 +1626,12 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( !wsOverflowTarget.IsEmpty()) { return pCurNode; } - return NULL; + return nullptr; } else if (pCurNode->GetElementType() == XFA_Element::Overflow) { return pCurNode; } } - return NULL; + return nullptr; } void CXFA_LayoutPageMgr::MergePageSetContents() { @@ -1647,7 +1650,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_Node* pBindNode = pNode->GetBindData(); if (pBindNode) { pBindNode->RemoveBindItem(pNode); - pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); + pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); } } pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); @@ -1681,7 +1684,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { if (pRootPageSetContainerItem->m_pFormNode->GetUserData( XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, - NULL); + nullptr); } pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); @@ -1711,7 +1714,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; } } - if (pFormLayout == NULL) { + if (!pFormLayout) { bIsExistForm = FALSE; break; } @@ -1903,7 +1906,7 @@ void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; while (pNode) { pNext = pNode->m_pNextSibling; - pNode->m_pParent = NULL; + pNode->m_pParent = nullptr; XFA_ReleaseLayoutItem_NoPageArea(pNode); pNode = pNext; } @@ -1912,7 +1915,7 @@ void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { } } void CXFA_LayoutPageMgr::PrepareLayout() { - m_pPageSetCurRoot = NULL; + m_pPageSetCurRoot = nullptr; m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; m_nAvailPages = 0; ClearRecordList(); @@ -1926,9 +1929,9 @@ void CXFA_LayoutPageMgr::PrepareLayout() { pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); if (pPageSetFormNode->HasRemovedChildren()) { XFA_ReleaseLayoutItem(pRootLayoutItem); - m_pPageSetLayoutItemRoot = NULL; - pRootLayoutItem = NULL; - pPageSetFormNode = NULL; + m_pPageSetLayoutItemRoot = nullptr; + pRootLayoutItem = nullptr; + pPageSetFormNode = nullptr; m_PageArray.RemoveAll(); } while (pPageSetFormNode) { @@ -1942,11 +1945,11 @@ void CXFA_LayoutPageMgr::PrepareLayout() { } } pRootLayoutItem = m_pPageSetLayoutItemRoot; - CXFA_ContainerLayoutItem* pNextLayout = NULL; + CXFA_ContainerLayoutItem* pNextLayout = nullptr; for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; SaveLayoutItem(pRootLayoutItem); delete pRootLayoutItem; } - m_pPageSetLayoutItemRoot = NULL; + m_pPageSetLayoutItemRoot = nullptr; } diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h index 91dd2bf306..5ffa40e5c8 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h @@ -12,9 +12,9 @@ class CXFA_ContainerRecord { public: - CXFA_ContainerRecord(CXFA_ContainerLayoutItem* pPageSet = NULL, - CXFA_ContainerLayoutItem* pPageArea = NULL, - CXFA_ContainerLayoutItem* pContentArea = NULL) + CXFA_ContainerRecord(CXFA_ContainerLayoutItem* pPageSet = nullptr, + CXFA_ContainerLayoutItem* pPageArea = nullptr, + CXFA_ContainerLayoutItem* pContentArea = nullptr) : pCurPageSet(pPageSet), pCurPageArea(pPageArea), pCurContentArea(pContentArea) {} @@ -53,7 +53,7 @@ class CXFA_LayoutPageMgr { FX_BOOL bDataMerge = FALSE, FX_BOOL bCreatePage = TRUE); CXFA_Node* QueryOverflow(CXFA_Node* pFormNode, - CXFA_LayoutContext* pLayoutContext = NULL); + CXFA_LayoutContext* pLayoutContext = nullptr); FX_BOOL ProcessBookendLeaderOrTrailer(CXFA_Node* pBookendNode, FX_BOOL bLeader, CXFA_Node*& pBookendAppendNode); @@ -72,7 +72,7 @@ class CXFA_LayoutPageMgr { ASSERT(result); return result; } - CXFA_ContainerRecord* CreateContainerRecord(CXFA_Node* pPageNode = NULL, + CXFA_ContainerRecord* CreateContainerRecord(CXFA_Node* pPageNode = nullptr, FX_BOOL bCreateNew = FALSE); void AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, CXFA_Node* pNewPageArea); @@ -101,27 +101,28 @@ class CXFA_LayoutPageMgr { void CreateNextMinRecord(CXFA_Node* pRecordNode); FX_BOOL FindPageAreaFromPageSet(CXFA_Node* pPageSet, CXFA_Node* pStartChild, - CXFA_Node* pTargetPageArea = NULL, - CXFA_Node* pTargetContentArea = NULL, + CXFA_Node* pTargetPageArea = nullptr, + CXFA_Node* pTargetContentArea = nullptr, FX_BOOL bNewPage = FALSE, FX_BOOL bQuery = FALSE); - FX_BOOL FindPageAreaFromPageSet_Ordered(CXFA_Node* pPageSet, - CXFA_Node* pStartChild, - CXFA_Node* pTargetPageArea = NULL, - CXFA_Node* pTargetContentArea = NULL, - FX_BOOL bNewPage = FALSE, - FX_BOOL bQuery = FALSE); + FX_BOOL FindPageAreaFromPageSet_Ordered( + CXFA_Node* pPageSet, + CXFA_Node* pStartChild, + CXFA_Node* pTargetPageArea = nullptr, + CXFA_Node* pTargetContentArea = nullptr, + FX_BOOL bNewPage = FALSE, + FX_BOOL bQuery = FALSE); FX_BOOL FindPageAreaFromPageSet_SimplexDuplex( CXFA_Node* pPageSet, CXFA_Node* pStartChild, - CXFA_Node* pTargetPageArea = NULL, - CXFA_Node* pTargetContentArea = NULL, + CXFA_Node* pTargetPageArea = nullptr, + CXFA_Node* pTargetContentArea = nullptr, FX_BOOL bNewPage = FALSE, FX_BOOL bQuery = FALSE, XFA_ATTRIBUTEENUM ePreferredPosition = XFA_ATTRIBUTEENUM_First); FX_BOOL MatchPageAreaOddOrEven(CXFA_Node* pPageArea, FX_BOOL bLastMatch); CXFA_Node* GetNextAvailPageArea(CXFA_Node* pTargetPageArea, - CXFA_Node* pTargetContentArea = NULL, + CXFA_Node* pTargetContentArea = nullptr, FX_BOOL bNewPage = FALSE, FX_BOOL bQuery = FALSE); FX_BOOL GetNextContentArea(CXFA_Node* pTargetContentArea); diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index 6287547431..507add939c 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -138,7 +138,7 @@ CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, CFX_WideString& wsPattern) const { CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns"); - if (pElement == NULL) { + if (!pElement) { return; } CFX_WideString wsName; @@ -162,7 +162,7 @@ void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, CFX_WideString& wsPattern) const { CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns"); - if (pElement == NULL) { + if (!pElement) { return; } CFX_WideString wsName; @@ -186,7 +186,7 @@ void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, CFX_WideString& wsPattern) const { CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns"); - if (pElement == NULL) { + if (!pElement) { return; } switch (eType) { @@ -340,7 +340,7 @@ void CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, const CFX_WideStringC& wsName) const { CXFA_Node* pChild = - pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : NULL; + pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; while (pChild) { CFX_WideString wsChild; if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) { @@ -350,7 +350,7 @@ CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, } pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); } - return NULL; + return nullptr; } CFX_WideString CXFA_NodeLocale::GetSymbol( XFA_Element eElement, diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index 8911a41b96..570a719279 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -1033,19 +1033,19 @@ const uint8_t g_ruRU_Locale[] = { 0xB3, 0x85, 0xFA, 0x59, 0x2A, 0x7A, 0xFF, 0x3D, 0xC4, 0x3F, 0xDE, 0xCB, 0x8B, 0xC4}; static IFX_Locale* XFA_GetLocaleFromBuffer(const uint8_t* pBuf, int nBufLen) { - if (pBuf == NULL || nBufLen <= 0) { - return NULL; + if (!pBuf || nBufLen <= 0) { + return nullptr; } CFX_GEModule* pGeModule = CFX_GEModule::Get(); if (!pGeModule) { - return NULL; + return nullptr; } CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); if (!pCodecMgr) { - return NULL; + return nullptr; } - CXML_Element* pLocale = NULL; - uint8_t* pOut = NULL; + CXML_Element* pLocale = nullptr; + uint8_t* pOut = nullptr; uint32_t dwSize; pCodecMgr->GetFlateModule()->FlateOrLZWDecode(FALSE, pBuf, nBufLen, TRUE, 0, 0, 0, 0, 0, pOut, dwSize); @@ -1056,7 +1056,7 @@ static IFX_Locale* XFA_GetLocaleFromBuffer(const uint8_t* pBuf, int nBufLen) { if (pLocale) { return new CXFA_XMLLocale(pLocale); } - return NULL; + return nullptr; } static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { uint16_t dwLangueID = XFA_LANGID_en_US; @@ -1163,7 +1163,7 @@ IFX_Locale* CXFA_LocaleMgr::GetDefLocale() { } IFX_Locale* CXFA_LocaleMgr::GetLocale(uint16_t lcid) { - IFX_Locale* pLocal = NULL; + IFX_Locale* pLocal = nullptr; switch (lcid) { case XFA_LANGID_zh_CN: pLocal = XFA_GetLocaleFromBuffer(g_zhCN_Locale, sizeof(g_zhCN_Locale)); @@ -1226,7 +1226,7 @@ IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( } int32_t iLen = wsLocaleName.GetLength(); if (iLen < 2) { - return NULL; + return nullptr; } iCount = m_XMLLocaleArray.GetSize(); for (i = 0; i < iCount; i++) { @@ -1256,9 +1256,10 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { CXFA_Node* pCommon = pChildfConfig ? pChildfConfig->GetFirstChildByClass(XFA_Element::Common) - : NULL; + : nullptr; CXFA_Node* pLocale = - pCommon ? pCommon->GetFirstChildByClass(XFA_Element::Locale) : NULL; + pCommon ? pCommon->GetFirstChildByClass(XFA_Element::Locale) + : nullptr; if (pLocale) { pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, FALSE); } @@ -1267,7 +1268,7 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { } return m_wsConfigLocale.AsStringC(); } -static CXFA_TimeZoneProvider* g_pProvider = NULL; +static CXFA_TimeZoneProvider* g_pProvider = nullptr; // Static. CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Create() { @@ -1287,7 +1288,7 @@ CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Get() { // Static. void CXFA_TimeZoneProvider::Destroy() { delete g_pProvider; - g_pProvider = NULL; + g_pProvider = nullptr; } #include diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index f9c86b0961..0aa646d932 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -34,12 +34,12 @@ static const FX_DOUBLE fraction_scales[] = {0.1, CXFA_LocaleValue::CXFA_LocaleValue() { m_dwType = XFA_VT_NULL; m_bValid = TRUE; - m_pLocaleMgr = NULL; + m_pLocaleMgr = nullptr; } CXFA_LocaleValue::CXFA_LocaleValue(const CXFA_LocaleValue& value) { m_dwType = XFA_VT_NULL; m_bValid = TRUE; - m_pLocaleMgr = NULL; + m_pLocaleMgr = nullptr; *this = value; } CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, diff --git a/xfa/fxfa/parser/xfa_localevalue.h b/xfa/fxfa/parser/xfa_localevalue.h index 912af93eeb..83885bd56d 100644 --- a/xfa/fxfa/parser/xfa_localevalue.h +++ b/xfa/fxfa/parser/xfa_localevalue.h @@ -44,7 +44,7 @@ class CXFA_LocaleValue { FX_BOOL ValidateValue(const CFX_WideString& wsValue, const CFX_WideString& wsPattern, IFX_Locale* pLocale, - CFX_WideString* pMatchFormat = NULL); + CFX_WideString* pMatchFormat = nullptr); FX_BOOL FormatPatterns(CFX_WideString& wsResult, const CFX_WideString& wsFormat, IFX_Locale* pLocale, @@ -65,8 +65,8 @@ class CXFA_LocaleValue { FX_BOOL bSign = TRUE); FX_BOOL ValidateNumericTemp(CFX_WideString& wsNumeric, CFX_WideString& wsFormat, - IFX_Locale* pLocale = NULL, - int32_t* pos = NULL); + IFX_Locale* pLocale = nullptr, + int32_t* pos = nullptr); CFX_WideString GetValue() const; uint32_t GetType() const; diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index 54cacc318a..e402c1826f 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -270,19 +270,19 @@ class CXFA_Node : public CXFA_Object { CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr) const; FX_BOOL SetObject(XFA_ATTRIBUTE eAttr, void* pData, - XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); + XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); FX_BOOL TryObject(XFA_ATTRIBUTE eAttr, void*& pData); void* GetObject(XFA_ATTRIBUTE eAttr) { void* pData; - return TryObject(eAttr, pData) ? pData : NULL; + return TryObject(eAttr, pData) ? pData : nullptr; } FX_BOOL SetUserData(void* pKey, void* pData, - XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); + XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); FX_BOOL TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso = FALSE); void* GetUserData(void* pKey, FX_BOOL bProtoAlso = FALSE) { void* pData; - return TryUserData(pKey, pData, bProtoAlso) ? pData : NULL; + return TryUserData(pKey, pData, bProtoAlso) ? pData : nullptr; } CXFA_Node* GetProperty(int32_t index, XFA_Element eType, @@ -292,7 +292,7 @@ class CXFA_Node : public CXFA_Object { XFA_Element eType, FX_BOOL bOnlyChild = FALSE); int32_t InsertChild(int32_t index, CXFA_Node* pNode); - FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL); + FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = nullptr); FX_BOOL RemoveChild(CXFA_Node* pNode, bool bNotify = true); CXFA_Node* Clone(FX_BOOL bRecursive); CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; @@ -335,7 +335,7 @@ class CXFA_Node : public CXFA_Object { void Script_Som_ResolveNodeList(CFXJSE_Value* pValue, CFX_WideString wsExpression, uint32_t dwFlag, - CXFA_Node* refNode = NULL); + CXFA_Node* refNode = nullptr); void Script_TreeClass_All(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); @@ -646,16 +646,17 @@ class CXFA_Node : public CXFA_Object { FX_BOOL GetMapModuleValue(void* pKey, void*& pValue); void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue); FX_BOOL GetMapModuleString(void* pKey, CFX_WideStringC& wsValue); - void SetMapModuleBuffer(void* pKey, - void* pValue, - int32_t iBytes, - XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); + void SetMapModuleBuffer( + void* pKey, + void* pValue, + int32_t iBytes, + XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); FX_BOOL GetMapModuleBuffer(void* pKey, void*& pValue, int32_t& iBytes, FX_BOOL bProtoAlso = TRUE) const; FX_BOOL HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso = FALSE); - void RemoveMapModuleKey(void* pKey = NULL); + void RemoveMapModuleKey(void* pKey = nullptr); void MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr = TRUE); void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey); void MoveBufferMapData(CXFA_Node* pSrcModule, @@ -746,17 +747,17 @@ class CXFA_AttachNodeList : public CXFA_NodeList { class CXFA_TraverseStrategy_XFAContainerNode { public: static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, - void* pUserData = NULL) { + void* pUserData = nullptr) { return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode); } static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode, - void* pUserData = NULL) { + void* pUserData = nullptr) { return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode); } static CXFA_Node* GetParent(CXFA_Node* pTemplateNode, - void* pUserData = NULL) { + void* pUserData = nullptr) { return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); } diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 47b244fce5..28c56ce0f3 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -3977,7 +3977,7 @@ FX_BOOL CXFA_Node::SetObject(XFA_ATTRIBUTE eAttr, FX_BOOL CXFA_Node::TryObject(XFA_ATTRIBUTE eAttr, void*& pData) { void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); pData = GetUserData(pKey); - return pData != nullptr; + return !!pData; } FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTETYPE eType, @@ -5076,8 +5076,8 @@ CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) : CXFA_Object(pThisNode->GetDocument(), XFA_ObjectType::VariablesThis, XFA_Element::Unknown), - m_pThisNode(NULL), - m_pScriptNode(NULL) { + m_pThisNode(nullptr), + m_pScriptNode(nullptr) { m_pThisNode = pThisNode; m_pScriptNode = pScriptNode; } diff --git a/xfa/fxfa/parser/xfa_parser.h b/xfa/fxfa/parser/xfa_parser.h index b6c81e9f18..90b462541c 100644 --- a/xfa/fxfa/parser/xfa_parser.h +++ b/xfa/fxfa/parser/xfa_parser.h @@ -20,10 +20,10 @@ class IXFA_Parser { virtual void Release() = 0; virtual int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) = 0; - virtual int32_t DoParse(IFX_Pause* pPause = NULL) = 0; + virtual int32_t DoParse(IFX_Pause* pPause = nullptr) = 0; virtual int32_t ParseXMLData(const CFX_WideString& wsXML, CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = NULL) = 0; + IFX_Pause* pPause = nullptr) = 0; virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) = 0; virtual CXFA_Document* GetFactory() const = 0; diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 20964053f5..5e17df8d3a 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -47,7 +47,7 @@ static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( CFDE_XMLDoc* pXMLDoc, FX_BOOL bVerifyWellFormness = FALSE) { if (!pXMLDoc) { - return NULL; + return nullptr; } CFDE_XMLNode* pXMLFakeRoot = pXMLDoc->GetRoot(); for (CFDE_XMLNode* pXMLNode = @@ -67,7 +67,7 @@ static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( return pXMLNode; } } - return NULL; + return nullptr; } int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID) { @@ -75,7 +75,7 @@ int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, m_pFileRead = pStream; m_pStream = IFX_Stream::CreateStream( pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text); - if (m_pStream == NULL) { + if (!m_pStream) { return XFA_PARSESTATUS_StreamErr; } uint16_t wCodePage = m_pStream->GetCodePage(); @@ -92,7 +92,7 @@ int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, return XFA_PARSESTATUS_Ready; } int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) { - if (m_pXMLDoc == NULL || m_ePacketID == XFA_XDPPACKET_UNKNOWN) { + if (!m_pXMLDoc || m_ePacketID == XFA_XDPPACKET_UNKNOWN) { return XFA_PARSESTATUS_StatusErr; } int32_t iRet = m_pXMLDoc->DoLoad(pPause); @@ -107,7 +107,7 @@ int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) { m_pXMLDoc->CloseXML(); if (m_pStream) { m_pStream->Release(); - m_pStream = NULL; + m_pStream = nullptr; } if (!m_pRootNode) { return XFA_PARSESTATUS_StatusErr; @@ -118,7 +118,7 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause) { CloseParser(); - pXMLNode = NULL; + pXMLNode = nullptr; IFX_Stream* pStream = XFA_CreateWideTextRead(wsXML); if (!pStream) { return XFA_PARSESTATUS_StreamErr; @@ -142,7 +142,7 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, } if (m_pStream) { m_pStream->Release(); - m_pStream = NULL; + m_pStream = nullptr; } pXMLNode = XFA_FDEExtension_GetDocumentNode(m_pXMLDoc); return XFA_PARSESTATUS_Done; @@ -356,7 +356,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { switch (ePacketID) { case XFA_XDPPACKET_UNKNOWN: - return NULL; + return nullptr; case XFA_XDPPACKET_XDP: return ParseAsXDPPacket_XDP(pXMLDocumentNode, ePacketID); case XFA_XDPPACKET_Config: @@ -426,7 +426,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( pXMLConfigDOMRoot = pChildItem; pXFAConfigDOMRoot = ParseAsXDPPacket_Config(pXMLConfigDOMRoot, XFA_XDPPACKET_Config); - pXFARootNode->InsertChild(pXFAConfigDOMRoot, NULL); + pXFARootNode->InsertChild(pXFAConfigDOMRoot, nullptr); } } CFDE_XMLNode* pXMLDatasetsDOMRoot = nullptr; @@ -522,17 +522,17 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName, XFA_GetPacketByIndex(XFA_PACKET_Config)->pURI, XFA_GetPacketByIndex(XFA_PACKET_Config)->eFlags)) { - return NULL; + return nullptr; } CXFA_Node* pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Config, XFA_Element::Config); if (!pNode) { - return NULL; + return nullptr; } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName); if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { - return NULL; + return nullptr; } pNode->SetXMLMappingNode(pXMLDocumentNode); return pNode; @@ -540,7 +540,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (ePacketID == XFA_XDPPACKET_Template) { if (XFA_FDEExtension_MatchNodeName( pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Template)->pName, @@ -549,7 +549,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Template, XFA_Element::Template); if (!pNode) { - return NULL; + return nullptr; } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Template)->pName); @@ -564,7 +564,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pNode->GetDocument()->RecognizeXFAVersionNumber(wsNamespaceURI); } if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { - return NULL; + return nullptr; } } } else if (ePacketID == XFA_XDPPACKET_Form) { @@ -578,7 +578,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pXMLDocumentElement->GetString(L"checksum", wsChecksum); if (wsChecksum.GetLength() != 28 || m_pXMLParser->m_dwCheckStatus != 0x03) { - return NULL; + return nullptr; } std::unique_ptr pChecksum(new CXFA_ChecksumContext); pChecksum->StartChecksum(); @@ -603,7 +603,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( CXFA_Node* pTemplateChosen = pTemplateRoot ? pTemplateRoot->GetFirstChildByClass(XFA_Element::Subform) - : NULL; + : nullptr; FX_BOOL bUseAttribute = TRUE; if (pTemplateChosen && pTemplateChosen->GetEnum(XFA_ATTRIBUTE_RestoreState) != @@ -611,7 +611,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( bUseAttribute = FALSE; } if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, bUseAttribute)) { - return NULL; + return nullptr; } } } @@ -631,7 +631,7 @@ static CFDE_XMLNode* XFA_GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) { pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pURI, XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) { - return NULL; + return nullptr; } for (CFDE_XMLNode* pDatasetsNode = pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild); @@ -645,7 +645,7 @@ static CFDE_XMLNode* XFA_GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) { } return pDatasetsNode; } - return NULL; + return nullptr; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( CFDE_XMLNode* pXMLDocumentNode, @@ -655,17 +655,17 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( CXFA_Node* pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataModel); if (!pNode) { - return NULL; + return nullptr; } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName); if (!DataLoader(pNode, pDatasetsXMLNode, FALSE)) { - return NULL; + return nullptr; } pNode->SetXMLMappingNode(pDatasetsXMLNode); return pNode; } - CFDE_XMLNode* pDataXMLNode = NULL; + CFDE_XMLNode* pDataXMLNode = nullptr; if (XFA_FDEExtension_MatchNodeName( pXMLDocumentNode, FX_WSTRC(L"data"), XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, @@ -695,13 +695,13 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( if (pDataXMLNode != pXMLDocumentNode) { pDataXMLNode->Release(); } - return NULL; + return nullptr; } CFX_WideString wsLocalName; static_cast(pDataXMLNode)->GetLocalTagName(wsLocalName); pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName); if (!DataLoader(pNode, pDataXMLNode, TRUE)) { - return NULL; + return nullptr; } pNode->SetXMLMappingNode(pDataXMLNode); if (pDataXMLNode != pXMLDocumentNode) { @@ -709,12 +709,12 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( } return pNode; } - return NULL; + return nullptr; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (ePacketID == XFA_XDPPACKET_LocaleSet) { if (XFA_FDEExtension_MatchNodeName( pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName, @@ -723,12 +723,12 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( pNode = m_pFactory->CreateNode(XFA_XDPPACKET_LocaleSet, XFA_Element::LocaleSet); if (!pNode) { - return NULL; + return nullptr; } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName); if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { - return NULL; + return nullptr; } } } else if (ePacketID == XFA_XDPPACKET_ConnectionSet) { @@ -740,12 +740,12 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( pNode = m_pFactory->CreateNode(XFA_XDPPACKET_ConnectionSet, XFA_Element::ConnectionSet); if (!pNode) { - return NULL; + return nullptr; } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName); if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { - return NULL; + return nullptr; } } } else if (ePacketID == XFA_XDPPACKET_SourceSet) { @@ -756,12 +756,12 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( pNode = m_pFactory->CreateNode(XFA_XDPPACKET_SourceSet, XFA_Element::SourceSet); if (!pNode) { - return NULL; + return nullptr; } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName); if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { - return NULL; + return nullptr; } } } @@ -780,14 +780,14 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( CXFA_Node* pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Xdc, XFA_Element::Xdc); if (!pNode) { - return NULL; + return nullptr; } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName); pNode->SetXMLMappingNode(pXMLDocumentNode); return pNode; } - return NULL; + return nullptr; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( CFDE_XMLNode* pXMLDocumentNode, @@ -795,13 +795,13 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( CXFA_Node* pNode = m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_Element::Packet); if (!pNode) { - return NULL; + return nullptr; } CFX_WideString wsName; static_cast(pXMLDocumentNode)->GetLocalTagName(wsName); pNode->SetCData(XFA_ATTRIBUTE_Name, wsName); if (!UserPacketLoader(pNode, pXMLDocumentNode)) { - return NULL; + return nullptr; } pNode->SetXMLMappingNode(pXMLDocumentNode); return pNode; @@ -848,12 +848,11 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, bOneOfPropertyFound = TRUE; } CXFA_Node* pXFAChild = m_pFactory->CreateNode(ePacketID, eType); - if (pXFAChild == NULL) { - return NULL; - } - if (ePacketID == XFA_XDPPACKET_Config) { + if (!pXFAChild) + return nullptr; + if (ePacketID == XFA_XDPPACKET_Config) pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName.AsStringC()); - } + FX_BOOL IsNeedValue = TRUE; for (int32_t i = 0, count = pXMLElement->CountAttributes(); i < count; i++) { @@ -1102,7 +1101,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, eNodeType); - if (pXFAChild == NULL) { + if (!pXFAChild) { return; } CFX_WideString wsNodeName; @@ -1142,7 +1141,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } CXFA_Node* pXFAMetaData = m_pFactory->CreateNode( XFA_XDPPACKET_Datasets, XFA_Element::DataValue); - if (pXFAMetaData == NULL) { + if (!pXFAMetaData) { return; } pXFAMetaData->SetCData(XFA_ATTRIBUTE_Name, wsAttrName); @@ -1182,7 +1181,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataValue); - if (pXFAChild == NULL) { + if (!pXFAChild) { return; } pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCharData); @@ -1200,7 +1199,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataValue); - if (pXFAChild == NULL) { + if (!pXFAChild) { return; } pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsText); @@ -1346,16 +1345,16 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, void CXFA_SimpleParser::CloseParser() { if (m_pXMLDoc) { m_pXMLDoc->Release(); - m_pXMLDoc = NULL; + m_pXMLDoc = nullptr; } if (m_pStream) { m_pStream->Release(); - m_pStream = NULL; + m_pStream = nullptr; } } CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) - : m_nodeParser(NULL, TRUE), m_pNotify(pNotify), m_pDocument(NULL) {} + : m_nodeParser(nullptr, TRUE), m_pNotify(pNotify), m_pDocument(nullptr) {} CXFA_DocumentParser::~CXFA_DocumentParser() { CloseParser(); } @@ -1385,7 +1384,7 @@ int32_t CXFA_DocumentParser::ParseXMLData(const CFX_WideString& wsXML, CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause) { CloseParser(); - int32_t nRetStatus = m_nodeParser.ParseXMLData(wsXML, pXMLNode, NULL); + int32_t nRetStatus = m_nodeParser.ParseXMLData(wsXML, pXMLNode, nullptr); if (nRetStatus == XFA_PARSESTATUS_Done && pXMLNode) { m_pDocument = new CXFA_Document(this); m_nodeParser.SetFactory(m_pDocument); @@ -1521,7 +1520,7 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { m_pChild = new CFDE_XMLInstruction(m_ws1); m_pParent->InsertChildNode(m_pChild); } else { - m_pChild = NULL; + m_pChild = nullptr; } m_ws1.clear(); break; diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h index 3a56cc0996..df0b31dc69 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.h +++ b/xfa/fxfa/parser/xfa_parser_imp.h @@ -21,10 +21,10 @@ class CXFA_SimpleParser : public IXFA_Parser { void Release() override; int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; - int32_t DoParse(IFX_Pause* pPause = NULL) override; + int32_t DoParse(IFX_Pause* pPause = nullptr) override; int32_t ParseXMLData(const CFX_WideString& wsXML, CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = NULL) override; + IFX_Pause* pPause = nullptr) override; void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; CXFA_Document* GetFactory() const override; CXFA_Node* GetRootNode() const override; @@ -91,10 +91,10 @@ class CXFA_DocumentParser : public IXFA_Parser { void Release() override; int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; - int32_t DoParse(IFX_Pause* pPause = NULL) override; + int32_t DoParse(IFX_Pause* pPause = nullptr) override; int32_t ParseXMLData(const CFX_WideString& wsXML, CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = NULL) override; + IFX_Pause* pPause = nullptr) override; void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; CXFA_Document* GetFactory() const override; CXFA_Node* GetRootNode() const override; diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h index faaaceec78..020e809881 100644 --- a/xfa/fxfa/parser/xfa_script.h +++ b/xfa/fxfa/parser/xfa_script.h @@ -60,7 +60,7 @@ struct XFA_RESOLVENODE_RS { }; inline XFA_RESOLVENODE_RS::XFA_RESOLVENODE_RS() - : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} + : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(nullptr) {} inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index bd4b73247a..84d5fc9223 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -305,7 +305,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( if (!pNotify) { return; } - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (iLength >= 1) { std::unique_ptr pValue(pArguments->GetValue(0)); if (pValue->IsObject()) { @@ -435,7 +435,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( } int32_t iStart = 0; CFX_WideString wsName; - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; int32_t iExpLength = wsExpression.GetLength(); while (iStart < iExpLength) { iStart = XFA_FilterName(wsExpression.AsStringC(), iStart, wsName); @@ -496,7 +496,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( if (!pNotify) { return; } - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (iLength >= 1) { std::unique_ptr pValue(pArguments->GetValue(0)); if (pValue->IsObject()) { @@ -586,7 +586,7 @@ FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( CFXJSE_Arguments* pArguments, int32_t iArgIndex, CFX_WideString& wsValue) { - if (pArguments == NULL || iArgIndex < 0) { + if (!pArguments || iArgIndex < 0) { return FALSE; } FX_BOOL bIsJsType = FALSE; diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 2afa5fcdec..109fc311e6 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -643,7 +643,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, if (nNodes < 1) { if (dwStyles & XFA_RESOLVENODE_CreateNode) { bNextCreate = TRUE; - if (m_ResolveProcessor->GetNodeHelper()->m_pCreateParent == nullptr) { + if (!m_ResolveProcessor->GetNodeHelper()->m_pCreateParent) { m_ResolveProcessor->GetNodeHelper()->m_pCreateParent = ToNode(rndFind.m_CurNode); m_ResolveProcessor->GetNodeHelper()->m_iCreateCount = 1; diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h index 08be85f7c9..c6bb14862e 100644 --- a/xfa/fxfa/parser/xfa_script_imp.h +++ b/xfa/fxfa/parser/xfa_script_imp.h @@ -32,13 +32,13 @@ class CXFA_ScriptContext { FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, const CFX_WideStringC& wsScript, CFXJSE_Value* pRetValue, - CXFA_Object* pThisObject = NULL); + CXFA_Object* pThisObject = nullptr); int32_t ResolveObjects(CXFA_Object* refNode, const CFX_WideStringC& wsExpression, XFA_RESOLVENODE_RS& resolveNodeRS, uint32_t dwStyles = XFA_RESOLVENODE_Children, - CXFA_Node* bindNode = NULL); + CXFA_Node* bindNode = nullptr); CFXJSE_Value* GetJSValueFromMap(CXFA_Object* pObject); void AddToCacheList(std::unique_ptr pList); CXFA_Object* GetThisObject() const { return m_pThisObject; } diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index de47bd2e91..e158132170 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -48,7 +48,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( XFA_LAYOUTMODEL_HWXY layoutModel) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 3) { - const FX_WCHAR* methodName = NULL; + const FX_WCHAR* methodName = nullptr; switch (layoutModel) { case XFA_LAYOUTMODEL_H: methodName = L"h"; @@ -66,7 +66,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); return; } - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; CFX_WideString wsUnit(L"pt"); int32_t iIndex = 0; if (iLength >= 1) { @@ -178,7 +178,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); return; } - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (iLength >= 1) { pNode = static_cast(pArguments->GetObject(0)); } @@ -424,7 +424,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch( ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"absPageInBatch"); return; } - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (iLength >= 1) { pNode = static_cast(pArguments->GetObject(0)); } @@ -457,7 +457,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); return; } - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (iLength >= 1) { pNode = static_cast(pArguments->GetObject(0)); } @@ -511,7 +511,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageImp( ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); return; } - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (iLength >= 1) { pNode = static_cast(pArguments->GetObject(0)); } diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index 42f406e48a..e866a1923d 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -18,11 +18,11 @@ CXFA_NodeHelper::CXFA_NodeHelper() : m_eLastCreateType(XFA_Element::DataValue), - m_pCreateParent(NULL), + m_pCreateParent(nullptr), m_iCreateCount(0), m_iCreateFlag(XFA_RESOLVENODE_RSTYPE_CreateNodeOne), m_iCurAllStart(-1), - m_pAllStartParent(NULL) {} + m_pAllStartParent(nullptr) {} CXFA_NodeHelper::~CXFA_NodeHelper() {} @@ -30,14 +30,14 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetOneChild( CXFA_Node* parent, const FX_WCHAR* pwsName, FX_BOOL bIsClassName) { - if (parent == NULL) { - return NULL; + if (!parent) { + return nullptr; } CXFA_NodeArray siblings; uint32_t uNameHash = FX_HashCode_GetW(CFX_WideStringC(pwsName), false); XFA_NodeAcc_TraverseAnySiblings(parent, uNameHash, &siblings, bIsClassName); if (siblings.GetSize() == 0) { - return NULL; + return nullptr; } return siblings[0]; } @@ -56,7 +56,7 @@ int32_t CXFA_NodeHelper::XFA_CountSiblings(CXFA_Node* pNode, parent->GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); if (!pProperty && eLogicType == XFA_LOGIC_Transparent) { parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); - if (parent == NULL) { + if (!parent) { return 0; } } @@ -74,7 +74,7 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseAnySiblings( uint32_t dNameHash, CXFA_NodeArray* pSiblings, FX_BOOL bIsClassName) { - if (parent == NULL || pSiblings == NULL) { + if (!parent || !pSiblings) { return 0; } int32_t nCount = 0; @@ -136,7 +136,7 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, XFA_LOGIC_TYPE eLogicType, FX_BOOL bIsClassName, FX_BOOL bIsFindProperty) { - if (parent == NULL || pSiblings == NULL) { + if (!parent || !pSiblings) { return 0; } int32_t nCount = 0; @@ -211,7 +211,7 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent( CXFA_Node* pNode, XFA_LOGIC_TYPE eLogicType) { if (!pNode) { - return NULL; + return nullptr; } if (eLogicType == XFA_LOGIC_NoTransparent) { return pNode->GetNodeItem(XFA_NODEITEM_Parent); @@ -220,7 +220,7 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent( CXFA_Node* node = pNode; while (TRUE) { parent = XFA_ResolveNodes_GetParent(node); - if (parent == NULL) { + if (!parent) { break; } XFA_Element parentType = parent->GetElementType(); @@ -239,12 +239,12 @@ int32_t CXFA_NodeHelper::XFA_GetIndex(CXFA_Node* pNode, FX_BOOL bIsClassIndex) { CXFA_Node* parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent); - if (parent == NULL) { + if (!parent) { return 0; } if (!bIsProperty && eLogicType == XFA_LOGIC_Transparent) { parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); - if (parent == NULL) { + if (!parent) { return 0; } } @@ -302,7 +302,7 @@ void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode, } FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { - if (refNode == NULL) { + if (!refNode) { return FALSE; } XFA_Element refNodeType = refNode->GetElementType(); @@ -358,7 +358,7 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( CFX_WideString wsCondition, FX_BOOL bLastNode, CXFA_ScriptContext* pScriptContext) { - if (m_pCreateParent == NULL) { + if (!m_pCreateParent) { return FALSE; } FX_BOOL bIsClassName = FALSE; @@ -409,13 +409,13 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( } } if (!bResult) { - m_pCreateParent = NULL; + m_pCreateParent = nullptr; } return bResult; } void CXFA_NodeHelper::XFA_SetCreateNodeType(CXFA_Node* refNode) { - if (refNode == NULL) { + if (!refNode) { return; } if (refNode->GetElementType() == XFA_Element::Subform) { diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index bcfaa113d4..2ca137e510 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -25,7 +25,7 @@ CXFA_ResolveProcessor::~CXFA_ResolveProcessor() { } int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { - if (rnd.m_CurNode == NULL) { + if (!rnd.m_CurNode) { return -1; } if (!rnd.m_CurNode->IsNode()) { @@ -84,7 +84,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild( CXFA_ResolveNodesData& rnd) { CFX_WideString wsName = rnd.m_wsName; CFX_WideString wsCondition = rnd.m_wsCondition; - CXFA_Node* findNode = NULL; + CXFA_Node* findNode = nullptr; CXFA_NodeArray siblings; FX_BOOL bClassName = FALSE; if (wsName.GetAt(0) == '#') { @@ -93,7 +93,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild( } findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild( ToNode(rnd.m_CurNode), wsName.c_str(), bClassName); - if (findNode == NULL) { + if (!findNode) { return 0; } if (wsCondition.IsEmpty()) { @@ -226,8 +226,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( rndFind.m_uHashName = uNameHash; CXFA_NodeArray children; CXFA_NodeArray properties; - CXFA_Node* pVariablesNode = NULL; - CXFA_Node* pPageSetNode = NULL; + CXFA_Node* pVariablesNode = nullptr; + CXFA_Node* pPageSetNode = nullptr; CXFA_Node* pChild = curNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChild) { if (pChild->GetElementType() == XFA_Element::Variables) { @@ -353,7 +353,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } return 0; } - CXFA_Node* pProp = NULL; + CXFA_Node* pProp = nullptr; if (XFA_Element::Subform == curNode->GetElementType() && XFA_HASHCODE_Occur == uNameHash) { CXFA_Node* pInstanceManager = @@ -650,7 +650,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray( m_pNodeHelper->m_iCreateCount = 1; findNodes.RemoveAll(); m_pNodeHelper->m_iCurAllStart = -1; - m_pNodeHelper->m_pAllStartParent = NULL; + m_pNodeHelper->m_pAllStartParent = nullptr; } else { if (m_pNodeHelper->m_iCurAllStart == -1) { m_pNodeHelper->m_iCurAllStart = m_iCurStart; @@ -826,14 +826,14 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_SetIndexDataBind( CXFA_ResolveNodesData::CXFA_ResolveNodesData(CXFA_ScriptContext* pSC) : m_pSC(pSC), - m_CurNode(NULL), + m_CurNode(nullptr), m_wsName(), m_uHashName(XFA_HASHCODE_None), m_wsCondition(), m_nLevel(0), m_Nodes(), m_dwStyles(XFA_RESOLVENODE_Children), - m_pScriptAttribute(NULL), + m_pScriptAttribute(nullptr), m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {} CXFA_ResolveNodesData::~CXFA_ResolveNodesData() { diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.h b/xfa/fxfa/parser/xfa_script_resolveprocessor.h index ae9add69cb..ffcd9b4475 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.h +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.h @@ -15,7 +15,7 @@ class CXFA_ScriptContext; class CXFA_ResolveNodesData { public: - CXFA_ResolveNodesData(CXFA_ScriptContext* pSC = NULL); + CXFA_ResolveNodesData(CXFA_ScriptContext* pSC = nullptr); ~CXFA_ResolveNodesData(); CXFA_ScriptContext* m_pSC; diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp index face46bed8..2d7e1860cf 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp @@ -36,7 +36,7 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( return; } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; if (iLength >= 1) { pNode = static_cast(pArguments->GetObject(0)); } @@ -57,7 +57,7 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( return; } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CXFA_NodeList* pNodeList = NULL; + CXFA_NodeList* pNodeList = nullptr; CFX_WideString wsExpression; CFX_WideString wsXMLIdent; if (iLength >= 1) { @@ -107,7 +107,7 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( return; } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CXFA_Node* pNode = NULL; + CXFA_Node* pNode = nullptr; FX_BOOL bClear = TRUE; if (iLength >= 1) { pNode = static_cast(pArguments->GetObject(0)); diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index bf050e7a3c..1036d9353f 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -32,7 +32,8 @@ FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( template class CXFA_NodeIteratorTemplate { public: - CXFA_NodeIteratorTemplate(NodeType* pRootNode = NULL) : m_pRoot(pRootNode) { + CXFA_NodeIteratorTemplate(NodeType* pRootNode = nullptr) + : m_pRoot(pRootNode) { if (pRootNode) { m_NodeStack.Push(pRootNode); } @@ -74,13 +75,13 @@ class CXFA_NodeIteratorTemplate { return TRUE; } NodeType* GetCurrent() const { - return m_NodeStack.GetSize() ? *m_NodeStack.GetTopElement() : NULL; + return m_NodeStack.GetSize() ? *m_NodeStack.GetTopElement() : nullptr; } NodeType* GetRoot() const { return m_pRoot; } NodeType* MoveToPrev() { int32_t nStackLength = m_NodeStack.GetSize(); if (nStackLength == 1) { - return NULL; + return nullptr; } else if (nStackLength > 1) { NodeType* pCurItem = *m_NodeStack.GetTopElement(); m_NodeStack.Pop(); @@ -90,7 +91,7 @@ class CXFA_NodeIteratorTemplate { if (pCurItem == pParentFirstChildItem) { return pParentItem; } - NodeType *pPrevItem = pParentFirstChildItem, *pPrevItemNext = NULL; + NodeType *pPrevItem = pParentFirstChildItem, *pPrevItemNext = nullptr; for (; pPrevItem; pPrevItem = pPrevItemNext) { pPrevItemNext = TraverseStrategy::GetNextSibling(pPrevItem); if (!pPrevItemNext || pPrevItemNext == pCurItem) { @@ -107,7 +108,7 @@ class CXFA_NodeIteratorTemplate { if (m_NodeStack.GetSize() > 0) { NodeType* pChildItem = *m_NodeStack.GetTopElement(); while ((pChildItem = TraverseStrategy::GetFirstChild(pChildItem)) != - NULL) { + nullptr) { while (NodeType* pNextItem = TraverseStrategy::GetNextSibling(pChildItem)) { pChildItem = pNextItem; @@ -116,10 +117,10 @@ class CXFA_NodeIteratorTemplate { } return *m_NodeStack.GetTopElement(); } - return NULL; + return nullptr; } NodeType* MoveToNext() { - NodeType** ppNode = NULL; + NodeType** ppNode = nullptr; NodeType* pCurrent = GetCurrent(); while (m_NodeStack.GetSize() > 0) { while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) { @@ -127,7 +128,7 @@ class CXFA_NodeIteratorTemplate { return *ppNode; } NodeType* pChild = TraverseStrategy::GetFirstChild(*ppNode); - if (pChild == NULL) { + if (!pChild) { break; } m_NodeStack.Push(pChild); @@ -144,7 +145,7 @@ class CXFA_NodeIteratorTemplate { } } } - return NULL; + return nullptr; } NodeType* SkipChildrenAndMoveToNext() { NodeType** ppNode = nullptr; @@ -184,7 +185,7 @@ FX_BOOL XFA_IsLayoutElement(XFA_Element eElement, void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode); void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, IFX_Stream* pStream, - const FX_CHAR* pChecksum = NULL, + const FX_CHAR* pChecksum = nullptr, FX_BOOL bSaveXML = FALSE); #endif // XFA_FXFA_PARSER_XFA_UTILS_H_ diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 9220601d50..b1fe7b3524 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -20,7 +20,7 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { XFA_Element eType = pNode->GetElementType(); eWidgetType = eType; if (eType != XFA_Element::Field && eType != XFA_Element::Draw) { - return NULL; + return nullptr; } eWidgetType = XFA_Element::Unknown; XFA_Element eUIType = XFA_Element::Unknown; @@ -58,7 +58,7 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { default: break; } - CXFA_Node* pUIChild = NULL; + CXFA_Node* pUIChild = nullptr; CXFA_Node* pUI = pNode->GetProperty(0, XFA_Element::Ui, TRUE); CXFA_Node* pChild = pUI->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { @@ -188,7 +188,7 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { } void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, CFX_WideString& wsPlainText) { - if (pXMLNode == NULL) { + if (!pXMLNode) { return; } switch (pXMLNode->GetType()) { diff --git a/xfa/fxgraphics/include/cfx_graphics.h b/xfa/fxgraphics/include/cfx_graphics.h index 1c2cb354cc..916fba57c7 100644 --- a/xfa/fxgraphics/include/cfx_graphics.h +++ b/xfa/fxgraphics/include/cfx_graphics.h @@ -142,28 +142,28 @@ class CFX_Graphics { FWL_Error SetCharSpacing(const FX_FLOAT spacing); FWL_Error SetTextDrawingMode(const int32_t mode); - FWL_Error StrokePath(CFX_Path* path, CFX_Matrix* matrix = NULL); + FWL_Error StrokePath(CFX_Path* path, CFX_Matrix* matrix = nullptr); FWL_Error FillPath(CFX_Path* path, FX_FillMode fillMode = FXFILL_WINDING, - CFX_Matrix* matrix = NULL); + CFX_Matrix* matrix = nullptr); FWL_Error ClipPath(CFX_Path* path, FX_FillMode fillMode = FXFILL_WINDING, - CFX_Matrix* matrix = NULL); + CFX_Matrix* matrix = nullptr); FWL_Error DrawImage(CFX_DIBSource* source, const CFX_PointF& point, - CFX_Matrix* matrix = NULL); + CFX_Matrix* matrix = nullptr); FWL_Error StretchImage(CFX_DIBSource* source, const CFX_RectF& rect, - CFX_Matrix* matrix = NULL); + CFX_Matrix* matrix = nullptr); FWL_Error ConcatMatrix(const CFX_Matrix* matrix); FWL_Error ClearClip(); FWL_Error ShowText(const CFX_PointF& point, const CFX_WideString& text, - CFX_Matrix* matrix = NULL); + CFX_Matrix* matrix = nullptr); FWL_Error CalcTextRect(CFX_RectF& rect, const CFX_WideString& text, FX_BOOL isMultiline = FALSE, - CFX_Matrix* matrix = NULL); + CFX_Matrix* matrix = nullptr); FWL_Error Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix); FWL_Error Transfer(CFX_Graphics* graphics, FX_FLOAT srcLeft, -- cgit v1.2.3