diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:26:25 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:54 +0100 |
commit | 1c4f33b5d8ba6a8cebb0235bb2e7e37e33045a5b (patch) | |
tree | 80530f50cf36927a1e4f31ad0192077bfb0ecf39 /tools | |
parent | 175e2adfd1677cb83373b0ba47853493f3b77859 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: Ia5acfb564f913d52cd25b5d64d06b5280b94cb72
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qa/cppunit/test_urlobj.cxx | 22 | ||||
-rw-r--r-- | tools/source/datetime/tdate.cxx | 2 | ||||
-rw-r--r-- | tools/source/datetime/ttime.cxx | 6 | ||||
-rw-r--r-- | tools/source/debug/debug.cxx | 6 | ||||
-rw-r--r-- | tools/source/fsys/urlobj.cxx | 82 | ||||
-rw-r--r-- | tools/source/generic/config.cxx | 52 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 30 | ||||
-rw-r--r-- | tools/source/generic/poly2.cxx | 4 | ||||
-rw-r--r-- | tools/source/inet/inetmime.cxx | 46 | ||||
-rw-r--r-- | tools/source/inet/inetmsg.cxx | 4 | ||||
-rw-r--r-- | tools/source/inet/inetstrm.cxx | 16 | ||||
-rw-r--r-- | tools/source/memtools/mempool.cxx | 4 | ||||
-rw-r--r-- | tools/source/memtools/multisel.cxx | 4 | ||||
-rw-r--r-- | tools/source/memtools/unqidx.cxx | 4 | ||||
-rw-r--r-- | tools/source/misc/appendunixshellword.cxx | 2 | ||||
-rw-r--r-- | tools/source/rc/rc.cxx | 2 | ||||
-rw-r--r-- | tools/source/rc/resmgr.cxx | 86 | ||||
-rw-r--r-- | tools/source/ref/errinf.cxx | 14 | ||||
-rw-r--r-- | tools/source/ref/pstm.cxx | 14 | ||||
-rw-r--r-- | tools/source/reversemap/bestreversemap.cxx | 2 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 36 | ||||
-rw-r--r-- | tools/source/stream/strmunx.cxx | 6 | ||||
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 10 |
23 files changed, 227 insertions, 227 deletions
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx index 4c126c1bbb06..f82b37c6a8f8 100644 --- a/tools/qa/cppunit/test_urlobj.cxx +++ b/tools/qa/cppunit/test_urlobj.cxx @@ -249,19 +249,19 @@ namespace tools_urlobj url = INetURLObject("data:"); //TODO: CPPUNIT_ASSERT(url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm == 0); + CPPUNIT_ASSERT(strm == nullptr); url = INetURLObject("data:,"); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm != 0); + CPPUNIT_ASSERT(strm != nullptr); CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize()); strm.reset(); url = INetURLObject("data:,,%C3%A4%90"); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm != 0); + CPPUNIT_ASSERT(strm != nullptr); CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), strm->GetSize()); buf = static_cast<unsigned char const *>(strm->GetData()); CPPUNIT_ASSERT_EQUAL(0x2C, int(buf[0])); @@ -273,26 +273,26 @@ namespace tools_urlobj url = INetURLObject("data:base64,"); //TODO: CPPUNIT_ASSERT(url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm == 0); + CPPUNIT_ASSERT(strm == nullptr); url = INetURLObject("data:;base64,"); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm != 0); + CPPUNIT_ASSERT(strm != nullptr); CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize()); strm.reset(); url = INetURLObject("data:;bAsE64,"); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm != 0); + CPPUNIT_ASSERT(strm != nullptr); CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize()); strm.reset(); url = INetURLObject("data:;base64,YWJjCg=="); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm != 0); + CPPUNIT_ASSERT(strm != nullptr); CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), strm->GetSize()); buf = static_cast<unsigned char const *>(strm->GetData()); CPPUNIT_ASSERT_EQUAL(0x61, int(buf[0])); @@ -304,17 +304,17 @@ namespace tools_urlobj url = INetURLObject("data:;base64,YWJjCg="); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm == 0); + CPPUNIT_ASSERT(strm == nullptr); url = INetURLObject("data:;base64,YWJ$Cg=="); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm == 0); + CPPUNIT_ASSERT(strm == nullptr); url = INetURLObject("data:text/plain;param=%22;base64,%22,YQ=="); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm != 0); + CPPUNIT_ASSERT(strm != nullptr); CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), strm->GetSize()); buf = static_cast<unsigned char const *>(strm->GetData()); CPPUNIT_ASSERT_EQUAL(0x59, int(buf[0])); @@ -326,7 +326,7 @@ namespace tools_urlobj url = INetURLObject("http://example.com"); CPPUNIT_ASSERT(!url.HasError()); strm = url.getData(); - CPPUNIT_ASSERT(strm == 0); + CPPUNIT_ASSERT(strm == nullptr); } void urlobjTest_isSchemeEqualTo() { diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index b6790b035944..54985ec553c7 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -155,7 +155,7 @@ Date::Date( DateInitSystem ) struct tm aTime; // get current time - nTmpTime = time( 0 ); + nTmpTime = time( nullptr ); // compute date if ( localtime_r( &nTmpTime, &aTime ) ) diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index 3b4a809bb62b..b6bdf040d579 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -119,7 +119,7 @@ Time::Time( TimeInitSystem ) if (clock_gettime(CLOCK_REALTIME, &tsTime) != 0) { struct timeval tvTime; - OSL_VERIFY( gettimeofday(&tvTime, NULL) != 0 ); + OSL_VERIFY( gettimeofday(&tvTime, nullptr) != 0 ); tsTime.tv_sec = tvTime.tv_sec; tsTime.tv_nsec = tvTime.tv_usec * 1000; } @@ -383,7 +383,7 @@ Time tools::Time::GetUTCOffset() ( nTicks < nCacheTicks ) // handle overflow ) { - nTime = time( 0 ); + nTime = time( nullptr ); localtime_r( &nTime, &aTM ); nLocalTime = mktime( &aTM ); #if defined( SOLARIS ) @@ -427,7 +427,7 @@ sal_uInt64 tools::Time::GetSystemTicks() (nPerformanceCount.QuadPart*1000)/nTicksPerSecond.QuadPart); #else timeval tv; - int n = gettimeofday (&tv, 0); + int n = gettimeofday (&tv, nullptr); if (n == -1) { int e = errno; SAL_WARN("tools.datetime", "gettimeofday failed: " << e); diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index ce7e0896ba72..edb4ffe8b7dc 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -49,7 +49,7 @@ struct DebugData DbgTestSolarMutexProc pDbgTestSolarMutex; DebugData() - :pDbgTestSolarMutex( NULL ) + :pDbgTestSolarMutex( nullptr ) { } }; @@ -68,14 +68,14 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam ) case DBG_FUNC_TESTSOLARMUTEX: SAL_WARN_IF( - pDebugData->pDbgTestSolarMutex == 0, "tools.debug", + pDebugData->pDbgTestSolarMutex == nullptr, "tools.debug", "no DbgTestSolarMutex function set"); if ( pDebugData->pDbgTestSolarMutex ) pDebugData->pDbgTestSolarMutex(); break; } - return NULL; + return nullptr; } #endif diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 4263fc38b6e3..874f3219a422 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -586,7 +586,7 @@ std::unique_ptr<SvMemoryStream> INetURLObject::getData() OUString sURLPath = GetURLPath( DECODE_WITH_CHARSET, RTL_TEXTENCODING_ISO_8859_1 ); sal_Unicode const * pSkippedMediatype = INetMIME::scanContentType( sURLPath.getStr(), sURLPath.getStr() + sURLPath.getLength() ); - sal_Int32 nCharactersSkipped = pSkippedMediatype == NULL + sal_Int32 nCharactersSkipped = pSkippedMediatype == nullptr ? 0 : pSkippedMediatype-sURLPath.getStr(); if (sURLPath.match(",", nCharactersSkipped)) { @@ -785,7 +785,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef, if ( parseHostOrNetBiosName( p1, pe, bOctets, ENCODE_ALL, RTL_TEXTENCODING_DONTKNOW, - true, NULL) || + true, nullptr) || (scanDomain(p1, pe) > 0 && p1 == pe) ) { @@ -856,10 +856,10 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef, // //<reg_name> if (getSchemeInfo().m_bAuthority) { - sal_Unicode const * pUserInfoBegin = 0; - sal_Unicode const * pUserInfoEnd = 0; - sal_Unicode const * pHostPortBegin = 0; - sal_Unicode const * pHostPortEnd = 0; + sal_Unicode const * pUserInfoBegin = nullptr; + sal_Unicode const * pUserInfoEnd = nullptr; + sal_Unicode const * pHostPortBegin = nullptr; + sal_Unicode const * pHostPortEnd = nullptr; switch (m_eScheme) { @@ -1028,7 +1028,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef, } if (parseHostOrNetBiosName( pPos + 2, p1, bOctets, ENCODE_ALL, - RTL_TEXTENCODING_DONTKNOW, true, NULL)) + RTL_TEXTENCODING_DONTKNOW, true, nullptr)) { aSynAbsURIRef.append("//"); pHostPortBegin = pPos + 2; @@ -1097,7 +1097,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef, if ( parseHostOrNetBiosName( p1, pe, bOctets, ENCODE_ALL, - RTL_TEXTENCODING_DONTKNOW, true, NULL) || + RTL_TEXTENCODING_DONTKNOW, true, nullptr) || (scanDomain(p1, pe) > 0 && p1 == pe) ) { @@ -1485,7 +1485,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, sal_Unicode const * pPrefixBegin = p; PrefixInfo const * pPrefix = getPrefix(pPrefixBegin, pEnd); - bool hasScheme = pPrefix != 0; + bool hasScheme = pPrefix != nullptr; if (!hasScheme) { pPrefixBegin = p; hasScheme = !parseScheme(&pPrefixBegin, pEnd, '#').isEmpty(); @@ -1535,7 +1535,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, sal_Unicode const * qe = n == -1 ? pEnd : q + n; if (parseHostOrNetBiosName( q, qe, bOctets, ENCODE_ALL, RTL_TEXTENCODING_DONTKNOW, - true, NULL)) + true, nullptr)) { bFSys = true; // 1st } @@ -1926,7 +1926,7 @@ bool INetURLObject::convertAbsToRel(OUString const & rTheAbsURIRef, // Make nMatch point past the last matching slash, or past the end of the // paths, in case they are equal: - sal_Unicode const * pSlash = 0; + sal_Unicode const * pSlash = nullptr; sal_Unicode const * p1 = pBasePathBegin; sal_Unicode const * p2 = pSubjectPathBegin; for (;;) @@ -2080,25 +2080,25 @@ INetURLObject::PrefixInfo const * INetURLObject::getPrefix(sal_Unicode const *& { static PrefixInfo const aMap[] = { // dummy entry at front needed, because pLast may point here: - { 0, 0, INetProtocol::NotValid, PrefixInfo::INTERNAL }, + { nullptr, nullptr, INetProtocol::NotValid, PrefixInfo::INTERNAL }, { ".component:", "staroffice.component:", INetProtocol::Component, PrefixInfo::INTERNAL }, { ".uno:", "staroffice.uno:", INetProtocol::Uno, PrefixInfo::INTERNAL }, - { "cid:", 0, INetProtocol::Cid, PrefixInfo::OFFICIAL }, - { "data:", 0, INetProtocol::Data, PrefixInfo::OFFICIAL }, + { "cid:", nullptr, INetProtocol::Cid, PrefixInfo::OFFICIAL }, + { "data:", nullptr, INetProtocol::Data, PrefixInfo::OFFICIAL }, { "db:", "staroffice.db:", INetProtocol::Db, PrefixInfo::INTERNAL }, - { "file:", 0, INetProtocol::File, PrefixInfo::OFFICIAL }, - { "ftp:", 0, INetProtocol::Ftp, PrefixInfo::OFFICIAL }, + { "file:", nullptr, INetProtocol::File, PrefixInfo::OFFICIAL }, + { "ftp:", nullptr, INetProtocol::Ftp, PrefixInfo::OFFICIAL }, { "hid:", "staroffice.hid:", INetProtocol::Hid, PrefixInfo::INTERNAL }, - { "http:", 0, INetProtocol::Http, PrefixInfo::OFFICIAL }, - { "https:", 0, INetProtocol::Https, PrefixInfo::OFFICIAL }, - { "javascript:", 0, INetProtocol::Javascript, PrefixInfo::OFFICIAL }, - { "ldap:", 0, INetProtocol::Ldap, PrefixInfo::OFFICIAL }, + { "http:", nullptr, INetProtocol::Http, PrefixInfo::OFFICIAL }, + { "https:", nullptr, INetProtocol::Https, PrefixInfo::OFFICIAL }, + { "javascript:", nullptr, INetProtocol::Javascript, PrefixInfo::OFFICIAL }, + { "ldap:", nullptr, INetProtocol::Ldap, PrefixInfo::OFFICIAL }, { "macro:", "staroffice.macro:", INetProtocol::Macro, PrefixInfo::INTERNAL }, - { "mailto:", 0, INetProtocol::Mailto, PrefixInfo::OFFICIAL }, + { "mailto:", nullptr, INetProtocol::Mailto, PrefixInfo::OFFICIAL }, { "private:", "staroffice.private:", INetProtocol::PrivSoffice, PrefixInfo::INTERNAL }, { "private:factory/", "staroffice.factory:", @@ -2111,10 +2111,10 @@ INetURLObject::PrefixInfo const * INetURLObject::getPrefix(sal_Unicode const *& INetProtocol::PrivSoffice, PrefixInfo::INTERNAL }, { "private:trashcan:", "staroffice.trashcan:", INetProtocol::PrivSoffice, PrefixInfo::INTERNAL }, - { "sftp:", 0, INetProtocol::Sftp, PrefixInfo::OFFICIAL }, + { "sftp:", nullptr, INetProtocol::Sftp, PrefixInfo::OFFICIAL }, { "slot:", "staroffice.slot:", INetProtocol::Slot, PrefixInfo::INTERNAL }, - { "smb:", 0, INetProtocol::Smb, PrefixInfo::OFFICIAL }, + { "smb:", nullptr, INetProtocol::Smb, PrefixInfo::OFFICIAL }, { "staroffice.component:", ".component:", INetProtocol::Component, PrefixInfo::EXTERNAL }, { "staroffice.db:", "db:", INetProtocol::Db, PrefixInfo::EXTERNAL }, @@ -2140,27 +2140,27 @@ INetURLObject::PrefixInfo const * INetURLObject::getPrefix(sal_Unicode const *& PrefixInfo::EXTERNAL }, { "staroffice:", "private:", INetProtocol::PrivSoffice, PrefixInfo::EXTERNAL }, - { "telnet:", 0, INetProtocol::Telnet, PrefixInfo::OFFICIAL }, - { "vnd.libreoffice.cmis:", 0, INetProtocol::Cmis, PrefixInfo::INTERNAL }, - { "vnd.sun.star.cmd:", 0, INetProtocol::VndSunStarCmd, + { "telnet:", nullptr, INetProtocol::Telnet, PrefixInfo::OFFICIAL }, + { "vnd.libreoffice.cmis:", nullptr, INetProtocol::Cmis, PrefixInfo::INTERNAL }, + { "vnd.sun.star.cmd:", nullptr, INetProtocol::VndSunStarCmd, PrefixInfo::OFFICIAL }, - { "vnd.sun.star.expand:", 0, INetProtocol::VndSunStarExpand, + { "vnd.sun.star.expand:", nullptr, INetProtocol::VndSunStarExpand, PrefixInfo::OFFICIAL }, - { "vnd.sun.star.help:", 0, INetProtocol::VndSunStarHelp, + { "vnd.sun.star.help:", nullptr, INetProtocol::VndSunStarHelp, PrefixInfo::OFFICIAL }, - { "vnd.sun.star.hier:", 0, INetProtocol::VndSunStarHier, + { "vnd.sun.star.hier:", nullptr, INetProtocol::VndSunStarHier, PrefixInfo::OFFICIAL }, - { "vnd.sun.star.pkg:", 0, INetProtocol::VndSunStarPkg, + { "vnd.sun.star.pkg:", nullptr, INetProtocol::VndSunStarPkg, PrefixInfo::OFFICIAL }, - { "vnd.sun.star.tdoc:", 0, INetProtocol::VndSunStarTdoc, + { "vnd.sun.star.tdoc:", nullptr, INetProtocol::VndSunStarTdoc, PrefixInfo::OFFICIAL }, - { "vnd.sun.star.webdav:", 0, INetProtocol::VndSunStarWebdav, + { "vnd.sun.star.webdav:", nullptr, INetProtocol::VndSunStarWebdav, PrefixInfo::OFFICIAL } }; /* This list needs to be sorted, or you'll introduce serious bugs */ PrefixInfo const * pFirst = aMap + 1; PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1; - PrefixInfo const * pMatch = 0; + PrefixInfo const * pMatch = nullptr; sal_Unicode const * pMatched = rBegin; sal_Unicode const * p = rBegin; sal_Int32 i = 0; @@ -2807,7 +2807,7 @@ bool INetURLObject::parseHostOrNetBiosName( case '|': return false; } - if (pCanonic != NULL) { + if (pCanonic != nullptr) { appendUCS4( buf, nUTF32, eEscapeType, bOctets, PART_URIC, eCharset, true); @@ -2819,7 +2819,7 @@ bool INetURLObject::parseHostOrNetBiosName( return false; } } - if (pCanonic != NULL) { + if (pCanonic != nullptr) { *pCanonic = aTheCanonic; } return true; @@ -4125,7 +4125,7 @@ OUString INetURLObject::getBase(sal_Int32 nIndex, bool bIgnoreFinalSlash, if (pSegBegin < pSegEnd && *pSegBegin == '/') ++pSegBegin; - sal_Unicode const * pExtension = 0; + sal_Unicode const * pExtension = nullptr; sal_Unicode const * p = pSegBegin; for (; p != pSegEnd && *p != ';'; ++p) if (*p == '.' && p != pSegBegin) @@ -4154,7 +4154,7 @@ bool INetURLObject::setBase(OUString const & rTheBase, sal_Int32 nIndex, if (pSegBegin < pSegEnd && *pSegBegin == '/') ++pSegBegin; - sal_Unicode const * pExtension = 0; + sal_Unicode const * pExtension = nullptr; sal_Unicode const * p = pSegBegin; for (; p != pSegEnd && *p != ';'; ++p) if (*p == '.' && p != pSegBegin) @@ -4187,7 +4187,7 @@ OUString INetURLObject::getExtension(sal_Int32 nIndex, if (pSegBegin < pSegEnd && *pSegBegin == '/') ++pSegBegin; - sal_Unicode const * pExtension = 0; + sal_Unicode const * pExtension = nullptr; sal_Unicode const * p = pSegBegin; for (; p != pSegEnd && *p != ';'; ++p) if (*p == '.' && p != pSegBegin) @@ -4217,7 +4217,7 @@ bool INetURLObject::setExtension(OUString const & rTheExtension, if (pSegBegin < pSegEnd && *pSegBegin == '/') ++pSegBegin; - sal_Unicode const * pExtension = 0; + sal_Unicode const * pExtension = nullptr; sal_Unicode const * p = pSegBegin; for (; p != pSegEnd && *p != ';'; ++p) if (*p == '.' && p != pSegBegin) @@ -4251,7 +4251,7 @@ bool INetURLObject::removeExtension(sal_Int32 nIndex, bool bIgnoreFinalSlash) if (pSegBegin < pSegEnd && *pSegBegin == '/') ++pSegBegin; - sal_Unicode const * pExtension = 0; + sal_Unicode const * pExtension = nullptr; sal_Unicode const * p = pSegBegin; for (; p != pSegEnd && *p != ';'; ++p) if (*p == '.' && p != pSegBegin) @@ -4839,7 +4839,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin, enum State { STATE_DOT, STATE_LABEL, STATE_HYPHEN }; State eState = STATE_DOT; sal_Int32 nLabels = 0; - sal_Unicode const * pLastAlphanumeric = 0; + sal_Unicode const * pLastAlphanumeric = nullptr; for (sal_Unicode const * p = rBegin;; ++p) switch (eState) { diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index 4a8ee8f90b80..f7d403b984e3 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -97,7 +97,7 @@ static sal_uIntPtr ImplSysGetConfigTimeStamp( const OUString& rFileName ) static sal_uInt8* ImplSysReadConfig( const OUString& rFileName, sal_uInt64& rRead, bool& rbRead, bool& rbIsUTF8BOM, sal_uIntPtr& rTimeStamp ) { - sal_uInt8* pBuf = NULL; + sal_uInt8* pBuf = nullptr; ::osl::File aFile( rFileName ); if( aFile.open( osl_File_OpenFlag_Read ) == ::osl::FileBase::E_None ) @@ -107,7 +107,7 @@ static sal_uInt8* ImplSysReadConfig( const OUString& rFileName, { if (nPos > SAL_MAX_SIZE) { aFile.close(); - return 0; + return nullptr; } pBuf = new sal_uInt8[static_cast< std::size_t >(nPos)]; sal_uInt64 nRead = 0; @@ -129,7 +129,7 @@ static sal_uInt8* ImplSysReadConfig( const OUString& rFileName, else { delete[] pBuf; - pBuf = NULL; + pBuf = nullptr; } } aFile.close(); @@ -208,10 +208,10 @@ static void ImplMakeConfigList( ImplConfigData* pData, sal_uInt64 nKeyLen; sal_uInt64 i; const sal_uInt8* pLine; - ImplKeyData* pPrevKey = NULL; + ImplKeyData* pPrevKey = nullptr; ImplKeyData* pKey; - ImplGroupData* pPrevGroup = NULL; - ImplGroupData* pGroup = NULL; + ImplGroupData* pPrevGroup = nullptr; + ImplGroupData* pGroup = nullptr; i = 0; while ( i < nLen ) { @@ -245,16 +245,16 @@ static void ImplMakeConfigList( ImplConfigData* pData, if ( *pLine == '[' ) { pGroup = new ImplGroupData; - pGroup->mpNext = NULL; - pGroup->mpFirstKey = NULL; + pGroup->mpNext = nullptr; + pGroup->mpFirstKey = nullptr; pGroup->mnEmptyLines = 0; if ( pPrevGroup ) pPrevGroup->mpNext = pGroup; else pData->mpFirstGroup = pGroup; pPrevGroup = pGroup; - pPrevKey = NULL; - pKey = NULL; + pPrevKey = nullptr; + pKey = nullptr; // filter group names pLine++; @@ -283,12 +283,12 @@ static void ImplMakeConfigList( ImplConfigData* pData, if ( !pGroup ) { pGroup = new ImplGroupData; - pGroup->mpNext = NULL; - pGroup->mpFirstKey = NULL; + pGroup->mpNext = nullptr; + pGroup->mpFirstKey = nullptr; pGroup->mnEmptyLines = 0; pData->mpFirstGroup = pGroup; pPrevGroup = pGroup; - pPrevKey = NULL; + pPrevKey = nullptr; } // if empty line, append it @@ -306,7 +306,7 @@ static void ImplMakeConfigList( ImplConfigData* pData, // Generate new key pKey = new ImplKeyData; - pKey->mpNext = NULL; + pKey->mpNext = nullptr; if ( pPrevKey ) pPrevKey->mpNext = pKey; else @@ -433,13 +433,13 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr& return pWriteBuf; } else - return 0; + return nullptr; } // Allocate new write buffer (caller frees it) pWriteBuf = new sal_uInt8[nBufLen]; if ( !pWriteBuf ) - return 0; + return nullptr; // fill buffer pBuf = pWriteBuf; @@ -576,7 +576,7 @@ static void ImplDeleteConfigData( ImplConfigData* pData ) pGroup = pTempGroup; } - pData->mpFirstGroup = NULL; + pData->mpFirstGroup = nullptr; } static ImplConfigData* ImplGetConfigData( const OUString& rFileName ) @@ -585,7 +585,7 @@ static ImplConfigData* ImplGetConfigData( const OUString& rFileName ) pData = new ImplConfigData; pData->maFileName = rFileName; - pData->mpFirstGroup = NULL; + pData->mpFirstGroup = nullptr; pData->mnDataUpdateId = 0; pData->meLineEnd = LINEEND_CRLF; pData->mnRefCount = 0; @@ -620,7 +620,7 @@ ImplGroupData* Config::ImplGetGroup() const { if ( !mpActGroup || (mnDataUpdateId != mpData->mnDataUpdateId) ) { - ImplGroupData* pPrevGroup = NULL; + ImplGroupData* pPrevGroup = nullptr; ImplGroupData* pGroup = mpData->mpFirstGroup; while ( pGroup ) { @@ -635,8 +635,8 @@ ImplGroupData* Config::ImplGetGroup() const if ( !pGroup ) { pGroup = new ImplGroupData; - pGroup->mpNext = NULL; - pGroup->mpFirstKey = NULL; + pGroup->mpNext = nullptr; + pGroup->mpFirstKey = nullptr; pGroup->mnEmptyLines = 1; if ( pPrevGroup ) pPrevGroup->mpNext = pGroup; @@ -658,7 +658,7 @@ Config::Config( const OUString& rFileName ) // Initialize config data maFileName = toUncPath( rFileName ); mpData = ImplGetConfigData( maFileName ); - mpActGroup = NULL; + mpActGroup = nullptr; mnDataUpdateId = 0; mnLockCount = 1; mbPersistence = true; @@ -700,7 +700,7 @@ void Config::DeleteGroup(const OString& rGroup) mpData->mbRead = true; } - ImplGroupData* pPrevGroup = NULL; + ImplGroupData* pPrevGroup = nullptr; ImplGroupData* pGroup = mpData->mpFirstGroup; while ( pGroup ) { @@ -858,7 +858,7 @@ void Config::WriteKey(const OString& rKey, const OString& rStr) ImplGroupData* pGroup = ImplGetGroup(); if ( pGroup ) { - ImplKeyData* pPrevKey = NULL; + ImplKeyData* pPrevKey = nullptr; ImplKeyData* pKey = pGroup->mpFirstKey; while ( pKey ) { @@ -873,7 +873,7 @@ void Config::WriteKey(const OString& rKey, const OString& rStr) if ( !pKey ) { pKey = new ImplKeyData; - pKey->mpNext = NULL; + pKey->mpNext = nullptr; pKey->maKey = rKey; pKey->mbIsComment = false; if ( pPrevKey ) @@ -912,7 +912,7 @@ void Config::DeleteKey(const OString& rKey) ImplGroupData* pGroup = ImplGetGroup(); if ( pGroup ) { - ImplKeyData* pPrevKey = NULL; + ImplKeyData* pPrevKey = nullptr; ImplKeyData* pKey = pGroup->mpFirstKey; while ( pKey ) { diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 078889438e18..c92895e381be 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -55,7 +55,7 @@ static ImplPolygonData aStaticImplPolygon = { - NULL, NULL, 0, 0 + nullptr, nullptr, 0, 0 }; ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, bool bFlags ) @@ -67,7 +67,7 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, bool bFlags ) memset( mpPointAry, 0, nSz ); } else - mpPointAry = NULL; + mpPointAry = nullptr; if( bFlags ) { @@ -75,7 +75,7 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, bool bFlags ) memset( mpFlagAry, 0, nInitSize ); } else - mpFlagAry = NULL; + mpFlagAry = nullptr; mnRefCount = 1; mnPoints = nInitSize; @@ -95,12 +95,12 @@ ImplPolygon::ImplPolygon( const ImplPolygon& rImpPoly ) memcpy( mpFlagAry, rImpPoly.mpFlagAry, rImpPoly.mnPoints ); } else - mpFlagAry = NULL; + mpFlagAry = nullptr; } else { - mpPointAry = NULL; - mpFlagAry = NULL; + mpPointAry = nullptr; + mpFlagAry = nullptr; } mnRefCount = 1; @@ -121,12 +121,12 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, const Point* pInitAry, const sal memcpy( mpFlagAry, pInitFlags, nInitSize ); } else - mpFlagAry = NULL; + mpFlagAry = nullptr; } else { - mpPointAry = NULL; - mpFlagAry = NULL; + mpPointAry = nullptr; + mpFlagAry = nullptr; } mnRefCount = 1; @@ -175,7 +175,7 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize ) } } else - pNewAry = NULL; + pNewAry = nullptr; if ( mpPointAry ) delete[] reinterpret_cast<char*>(mpPointAry); @@ -203,7 +203,7 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize ) } } else - pNewFlagAry = NULL; + pNewFlagAry = nullptr; delete[] mpFlagAry; mpFlagAry = pNewFlagAry; @@ -845,13 +845,13 @@ PolyFlags Polygon::GetFlags( sal_uInt16 nPos ) const bool Polygon::HasFlags() const { - return mpImplPolygon->mpFlagAry != NULL; + return mpImplPolygon->mpFlagAry != nullptr; } bool Polygon::IsRect() const { bool bIsRect = false; - if ( mpImplPolygon->mpFlagAry == NULL ) + if ( mpImplPolygon->mpFlagAry == nullptr ) { if ( ( ( mpImplPolygon->mnPoints == 5 ) && ( mpImplPolygon->mpPointAry[ 0 ] == mpImplPolygon->mpPointAry[ 4 ] ) ) || ( mpImplPolygon->mnPoints == 4 ) ) @@ -1643,7 +1643,7 @@ void Polygon::Read( SvStream& rIStream ) void Polygon::ImplWrite( SvStream& rOStream ) const { - bool bHasPolyFlags = mpImplPolygon->mpFlagAry != NULL; + bool bHasPolyFlags = mpImplPolygon->mpFlagAry != nullptr; WritePolygon( rOStream, *this ); rOStream.WriteBool(bHasPolyFlags); @@ -1812,7 +1812,7 @@ basegfx::B2DPolygon Polygon::getB2DPolygon() const // and a memcopy at ImplPolygon creation, but contains no zero-controlpoints // for straight edges. Polygon::Polygon(const basegfx::B2DPolygon& rPolygon) -: mpImplPolygon(0) +: mpImplPolygon(nullptr) { const bool bCurve(rPolygon.areControlPointsUsed()); const bool bClosed(rPolygon.isClosed()); diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index eddce4d18068..80ace373bd05 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -53,7 +53,7 @@ ImplPolyPolygon::ImplPolyPolygon( const ImplPolyPolygon& rImplPolyPoly ) mpPolyAry[i] = new tools::Polygon( *rImplPolyPoly.mpPolyAry[i] ); } else - mpPolyAry = NULL; + mpPolyAry = nullptr; } ImplPolyPolygon::~ImplPolyPolygon() @@ -212,7 +212,7 @@ void PolyPolygon::Clear() for ( sal_uInt16 i = 0; i < mpImplPolyPolygon->mnCount; i++ ) delete mpImplPolyPolygon->mpPolyAry[i]; delete[] mpImplPolyPolygon->mpPolyAry; - mpImplPolyPolygon->mpPolyAry = NULL; + mpImplPolyPolygon->mpPolyAry = nullptr; mpImplPolyPolygon->mnCount = 0; mpImplPolyPolygon->mnSize = mpImplPolyPolygon->mnResize; } diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index d4229feb15fb..6a817ee967c1 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -191,7 +191,7 @@ sal_Unicode * convertToUnicode(const sal_Char * pBegin, sal_Size & rSize) { if (eEncoding == RTL_TEXTENCODING_DONTKNOW) - return 0; + return nullptr; rtl_TextToUnicodeConverter hConverter = rtl_createTextToUnicodeConverter(eEncoding); rtl_TextToUnicodeContext hContext @@ -220,7 +220,7 @@ sal_Unicode * convertToUnicode(const sal_Char * pBegin, if (nInfo != 0) { delete[] pBuffer; - pBuffer = 0; + pBuffer = nullptr; } return pBuffer; } @@ -231,7 +231,7 @@ sal_Char * convertFromUnicode(const sal_Unicode * pBegin, sal_Size & rSize) { if (eEncoding == RTL_TEXTENCODING_DONTKNOW) - return 0; + return nullptr; rtl_UnicodeToTextConverter hConverter = rtl_createUnicodeToTextConverter(eEncoding); rtl_UnicodeToTextContext hContext @@ -261,7 +261,7 @@ sal_Char * convertFromUnicode(const sal_Unicode * pBegin, if (nInfo != 0) { delete[] pBuffer; - pBuffer = 0; + pBuffer = nullptr; } return pBuffer; } @@ -437,7 +437,7 @@ class INetMIMECharsetList_Impl Node * m_pFirst; public: - INetMIMECharsetList_Impl(): m_pFirst(0) {} + INetMIMECharsetList_Impl(): m_pFirst(nullptr) {} ~INetMIMECharsetList_Impl(); @@ -497,7 +497,7 @@ struct ParameterList { Parameter * m_pList; - ParameterList(): m_pList(0) {} + ParameterList(): m_pList(nullptr) {} inline ~ParameterList(); @@ -612,7 +612,7 @@ bool parseParameters(ParameterList const & rInput, if (pOutput) pOutput->clear(); - Parameter * pPrev = 0; + Parameter * pPrev = nullptr; for (Parameter * p = rInput.m_pList; p; p = p->m_pNext) { if (p->m_nSection > 0 @@ -1339,7 +1339,7 @@ void INetMIMEEncodedWordOutputSink::finish(bool bWriteTrailer) } else { - sal_Char * pTargetBuffer = NULL; + sal_Char * pTargetBuffer = nullptr; sal_Size nTargetSize = 0; rtl_UnicodeToTextConverter hConverter = rtl_createUnicodeToTextConverter(eCharsetEncoding); @@ -1363,7 +1363,7 @@ void INetMIMEEncodedWordOutputSink::finish(bool bWriteTrailer) & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) break; delete[] pTargetBuffer; - pTargetBuffer = NULL; + pTargetBuffer = nullptr; rtl_resetUnicodeToTextContext(hConverter, hContext); } rtl_destroyUnicodeToTextContext(hConverter, hContext); @@ -2027,7 +2027,7 @@ const sal_Char * getCharsetName(rtl_TextEncoding eEncoding) default: OSL_FAIL("getCharsetName(): Unsupported encoding"); - return 0; + return nullptr; } } @@ -2355,12 +2355,12 @@ sal_Unicode const * INetMIME::scanContentType( ++p; } if (p == pTypeBegin) - return 0; + return nullptr; sal_Unicode const * pTypeEnd = p; p = skipLinearWhiteSpaceComment(p, pEnd); if (p == pEnd || *p++ != '/') - return 0; + return nullptr; p = skipLinearWhiteSpaceComment(p, pEnd); sal_Unicode const * pSubTypeBegin = p; @@ -2369,14 +2369,14 @@ sal_Unicode const * INetMIME::scanContentType( ++p; } if (p == pSubTypeBegin) - return 0; + return nullptr; sal_Unicode const * pSubTypeEnd = p; - if (pType != 0) + if (pType != nullptr) { *pType = OUString(pTypeBegin, pTypeEnd - pTypeBegin).toAsciiLowerCase(); } - if (pSubType != 0) + if (pSubType != nullptr) { *pSubType = OUString(pSubTypeBegin, pSubTypeEnd - pSubTypeBegin) .toAsciiLowerCase(); @@ -2439,7 +2439,7 @@ OUString INetMIME::decodeHeaderFieldBody(const OString& rBody) if (bEncodedWord) { const sal_Char * pCharsetBegin = q; - const sal_Char * pLanguageBegin = 0; + const sal_Char * pLanguageBegin = nullptr; int nAlphaCount = 0; for (bool bDone = false; !bDone;) if (q == pEnd) @@ -2458,10 +2458,10 @@ OUString INetMIME::decodeHeaderFieldBody(const OString& rBody) break; case '-': - if (pLanguageBegin != 0) + if (pLanguageBegin != nullptr) { if (nAlphaCount == 0) - pLanguageBegin = 0; + pLanguageBegin = nullptr; else nAlphaCount = 0; } @@ -2475,7 +2475,7 @@ OUString INetMIME::decodeHeaderFieldBody(const OString& rBody) eCharsetEncoding = getCharsetEncoding( pCharsetBegin, - pLanguageBegin == 0 + pLanguageBegin == nullptr || nAlphaCount == 0 ? q - 1 : pLanguageBegin); bEncodedWord = isMIMECharsetEncoding( @@ -2487,9 +2487,9 @@ OUString INetMIME::decodeHeaderFieldBody(const OString& rBody) break; default: - if (pLanguageBegin != 0 + if (pLanguageBegin != nullptr && (!rtl::isAsciiAlpha(cChar) || ++nAlphaCount > 8)) - pLanguageBegin = 0; + pLanguageBegin = nullptr; break; } } @@ -2656,7 +2656,7 @@ OUString INetMIME::decodeHeaderFieldBody(const OString& rBody) bEncodedWord = bEncodedWord && q != pEnd && *q++ == '='; - sal_Unicode * pUnicodeBuffer = 0; + sal_Unicode * pUnicodeBuffer = nullptr; sal_Size nUnicodeSize = 0; if (bEncodedWord) { @@ -2664,7 +2664,7 @@ OUString INetMIME::decodeHeaderFieldBody(const OString& rBody) = convertToUnicode(sText.getStr(), sText.getStr() + sText.getLength(), eCharsetEncoding, nUnicodeSize); - if (pUnicodeBuffer == 0) + if (pUnicodeBuffer == nullptr) bEncodedWord = false; } diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 79692a5f371d..ab07afc5b1b2 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -213,7 +213,7 @@ static const std::map<InetMessageMime, const char*> ImplINetMIMEMessageHeaderDat }; INetMIMEMessage::INetMIMEMessage() - : pParent(NULL) + : pParent(nullptr) { for (sal_uInt16 i = 0; i < static_cast<int>(InetMessageMime::NUMHDR); i++) m_nMIMEIndex[static_cast<InetMessageMime>(i)] = CONTAINER_ENTRY_NOTFOUND; @@ -260,7 +260,7 @@ void INetMIMEMessage::SetContentTransferEncoding ( OUString INetMIMEMessage::GetDefaultContentType() { - if (pParent != NULL) + if (pParent != nullptr) { OUString aParentCT (pParent->GetContentType()); if (aParentCT.isEmpty()) diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index 1a2da1b9309c..af0e8e494307 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -78,7 +78,7 @@ int INetMIMEMessageStream::GetBodyLine(sal_Char* pData, sal_uIntPtr nSize) if (pSourceMsg->GetDocumentLB()) { - if (pMsgStrm == NULL) + if (pMsgStrm == nullptr) pMsgStrm = new SvStream (pSourceMsg->GetDocumentLB()); sal_uIntPtr nRead = pMsgStrm->Read(pWBuf, (pWEnd - pWBuf)); @@ -147,7 +147,7 @@ int INetMIMEMessageStream::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) // Encapsulated message body. while (!done) { - if (pChildStrm == NULL) + if (pChildStrm == nullptr) { INetMIMEMessage *pChild = pSourceMsg->GetChild(nChildIndex); if (pChild) @@ -201,7 +201,7 @@ int INetMIMEMessageStream::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) { // Cleanup exhausted child stream. delete pChildStrm; - pChildStrm = NULL; + pChildStrm = nullptr; } } } @@ -210,7 +210,7 @@ int INetMIMEMessageStream::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) else { // Single part message body. - if (pSourceMsg->GetDocumentLB() == NULL) + if (pSourceMsg->GetDocumentLB() == nullptr) { // Empty message body. return 0; @@ -227,13 +227,13 @@ INetMIMEMessageStream::INetMIMEMessageStream( pSourceMsg(pMsg), bHeaderGenerated(headerGenerated), nBufSiz(2048), - pMsgStrm(NULL), + pMsgStrm(nullptr), pMsgBuffer(new SvMemoryStream), - pMsgRead(NULL), - pMsgWrite(NULL), + pMsgRead(nullptr), + pMsgWrite(nullptr), done(false), nChildIndex(0), - pChildStrm(NULL) + pChildStrm(nullptr) { assert(pMsg != nullptr); pMsgBuffer->SetStreamCharSet(RTL_TEXTENCODING_ASCII_US); diff --git a/tools/source/memtools/mempool.cxx b/tools/source/memtools/mempool.cxx index 415f188c3c0d..d8e18e3d37b0 100644 --- a/tools/source/memtools/mempool.cxx +++ b/tools/source/memtools/mempool.cxx @@ -28,14 +28,14 @@ FixedMemPool::FixedMemPool(char const * pTypeName, sal_uInt16 nTypeSize) { char name[RTL_CACHE_NAME_LENGTH + 1]; snprintf (name, sizeof(name), "FixedMemPool_%d", (int)nTypeSize); - m_pImpl = reinterpret_cast<FixedMemPool_Impl*>(rtl_cache_create (name, nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0)); + m_pImpl = reinterpret_cast<FixedMemPool_Impl*>(rtl_cache_create (name, nTypeSize, 0, nullptr, nullptr, nullptr, nullptr, nullptr, 0)); SAL_INFO("tools.memtools","FixedMemPool::ctor(\"" << m_pTypeName << "\"): " << m_pImpl); } FixedMemPool::~FixedMemPool() { SAL_INFO("tools.memtools","FixedMemPool::dtor(\"" << m_pTypeName << "\"): " << m_pImpl); - rtl_cache_destroy (reinterpret_cast<rtl_cache_type*>(m_pImpl)), m_pImpl = 0; + rtl_cache_destroy (reinterpret_cast<rtl_cache_type*>(m_pImpl)), m_pImpl = nullptr; } void* FixedMemPool::Alloc() diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index c385bc43fb98..dfa9c4f4000c 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -513,7 +513,7 @@ void MultiSelection::SetTotalRange( const Range& rTotRange ) aTotRange = rTotRange; // adjust lower boundary - Range* pRange = aSels.empty() ? NULL : aSels.front(); + Range* pRange = aSels.empty() ? nullptr : aSels.front(); while( pRange ) { if( pRange->Max() < aTotRange.Min() ) @@ -529,7 +529,7 @@ void MultiSelection::SetTotalRange( const Range& rTotRange ) else break; - pRange = aSels.empty() ? NULL : aSels.front(); + pRange = aSels.empty() ? nullptr : aSels.front(); } // adjust upper boundary diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index 4e4a87344a38..38b9cc96ee00 100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -62,7 +62,7 @@ void* UniqueIndexImpl::Remove( sal_uIntPtr nIndex ) return p; } } - return NULL; + return nullptr; } void* UniqueIndexImpl::Get( sal_uIntPtr nIndex ) const @@ -75,7 +75,7 @@ void* UniqueIndexImpl::Get( sal_uIntPtr nIndex ) const if( it != maMap.end() ) return it->second; } - return NULL; + return nullptr; } sal_uIntPtr UniqueIndexImpl::FirstIndex() const diff --git a/tools/source/misc/appendunixshellword.cxx b/tools/source/misc/appendunixshellword.cxx index 414ad9159c72..bce043c93952 100644 --- a/tools/source/misc/appendunixshellword.cxx +++ b/tools/source/misc/appendunixshellword.cxx @@ -35,7 +35,7 @@ namespace tools { void appendUnixShellWord( OStringBuffer * accumulator, OString const & text) { - OSL_ASSERT(accumulator != NULL); + OSL_ASSERT(accumulator != nullptr); if (text.isEmpty()) { accumulator->append("''"); } else { diff --git a/tools/source/rc/rc.cxx b/tools/source/rc/rc.cxx index ee7470c91d51..22d3dfe01f24 100644 --- a/tools/source/rc/rc.cxx +++ b/tools/source/rc/rc.cxx @@ -25,7 +25,7 @@ #include <tools/rcid.h> Resource::Resource( const ResId& rResId ) - : m_pResMgr(NULL) + : m_pResMgr(nullptr) { GetRes( rResId.SetRT( RSC_RESOURCE ) ); } diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index e00315e881e9..8cccee4c54bd 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -56,7 +56,7 @@ using namespace osl; // for thread safety -static osl::Mutex* pResMgrMutex = NULL; +static osl::Mutex* pResMgrMutex = nullptr; static osl::Mutex& getResMgrMutex() { @@ -116,7 +116,7 @@ class ResMgrContainer int nLoadCount; ContainerElement() : - pResMgr( NULL ), + pResMgr( nullptr ), nRefCount( 0 ), nLoadCount( 0 ) {} @@ -148,7 +148,7 @@ public: { return m_aDefLocale; } }; -ResMgrContainer* ResMgrContainer::pOneInstance = NULL; +ResMgrContainer* ResMgrContainer::pOneInstance = nullptr; ResMgrContainer& ResMgrContainer::get() { @@ -172,7 +172,7 @@ ResMgrContainer::~ResMgrContainer() void ResMgrContainer::release() { delete pOneInstance; - pOneInstance = NULL; + pOneInstance = nullptr; } void ResMgrContainer::init() @@ -306,7 +306,7 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, m_aResFiles[ sURL ].aFileURL = sURL; return getResMgr(rPrefix,rLocale,bForceNewInstance); } // if ( m_aResFiles.find(sURL) == m_aResFiles.end() ) - return NULL; + return nullptr; } rLocale = aLocale; @@ -324,7 +324,7 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, { // shortcut: the match algorithm already created the InternalResMgr // take it instead of creating yet another one - it->second.pResMgr = NULL; + it->second.pResMgr = nullptr; pImp->bSingular = true; } else @@ -334,7 +334,7 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, if( !pImp->Create() ) { delete pImp; - pImp = NULL; + pImp = nullptr; } else it->second.nLoadCount++; @@ -366,7 +366,7 @@ InternalResMgr* ResMgrContainer::getNextFallback( InternalResMgr* pMgr ) { if( pNext->bSingular ) delete pNext; - pNext = NULL; + pNext = nullptr; } return pNext; } @@ -387,7 +387,7 @@ void ResMgrContainer::freeResMgr( InternalResMgr* pResMgr ) if( it->second.nRefCount == 0 ) { delete it->second.pResMgr; - it->second.pResMgr = NULL; + it->second.pResMgr = nullptr; } } } @@ -415,16 +415,16 @@ struct ImpContentLessCompare : public ::std::binary_function< ImpContent, ImpCon } }; -static ResHookProc pImplResHookProc = 0; +static ResHookProc pImplResHookProc = nullptr; InternalResMgr::InternalResMgr( const OUString& rFileURL, const OUString& rPrefix, const OUString& rResName, const LanguageTag& rLocale ) - : pContent( NULL ) + : pContent( nullptr ) , nOffCorrection( 0 ) - , pStringBlock( NULL ) - , pStm( NULL ) + , pStringBlock( nullptr ) + , pStm( nullptr ) , bEqual2Content( true ) , nEntries( 0 ) , aFileName( rFileURL ) @@ -432,7 +432,7 @@ InternalResMgr::InternalResMgr( const OUString& rFileURL, , aResName( rResName ) , bSingular( false ) , aLocale( rLocale ) - , pResUseDump( 0 ) + , pResUseDump( nullptr ) { } @@ -601,7 +601,7 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, } // if( nRT == RSC_STRING && bEqual2Content ) else { - *pResHandle = 0; + *pResHandle = nullptr; RSHEADER_TYPE aHeader; pStm->Seek( pFind->nOffset ); pStm->Read( &aHeader, sizeof( RSHEADER_TYPE ) ); @@ -612,8 +612,8 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, return pRes; } } // if( pFind && (pFind != pEnd) && (pFind->nTypeAndId == nValue) ) - *pResHandle = 0; - return NULL; + *pResHandle = nullptr; + return nullptr; } void InternalResMgr::FreeGlobalRes( void * pResHandle, void * pResource ) @@ -723,10 +723,10 @@ static void RscException_Impl() void ImpRCStack::Init( ResMgr* pMgr, const Resource* pObj, sal_uInt32 Id ) { - pResource = NULL; - pClassRes = NULL; + pResource = nullptr; + pClassRes = nullptr; Flags = RCFlags::NONE; - aResHandle = NULL; + aResHandle = nullptr; pResObj = pObj; nId = Id & ~RSC_DONTRELEASE; //TLX: Besser Init aendern pResMgr = pMgr; @@ -736,13 +736,13 @@ void ImpRCStack::Init( ResMgr* pMgr, const Resource* pObj, sal_uInt32 Id ) void ImpRCStack::Clear() { - pResource = NULL; - pClassRes = NULL; + pResource = nullptr; + pClassRes = nullptr; Flags = RCFlags::NONE; - aResHandle = NULL; - pResObj = NULL; + aResHandle = nullptr; + pResObj = nullptr; nId = 0; - pResMgr = NULL; + pResMgr = nullptr; } static RSHEADER_TYPE* LocalResource( const ImpRCStack* pStack, @@ -767,10 +767,10 @@ static RSHEADER_TYPE* LocalResource( const ImpRCStack* pStack, } } - return NULL; + return nullptr; } -void* ResMgr::pEmptyBuffer = NULL; +void* ResMgr::pEmptyBuffer = nullptr; void* ResMgr::getEmptyBuffer() { @@ -786,12 +786,12 @@ void ResMgr::DestroyAllResMgr() if( pEmptyBuffer ) { rtl_freeMemory( pEmptyBuffer ); - pEmptyBuffer = NULL; + pEmptyBuffer = nullptr; } ResMgrContainer::release(); } delete pResMgrMutex; - pResMgrMutex = NULL; + pResMgrMutex = nullptr; } void ResMgr::Init( const OUString& rFileName ) @@ -811,7 +811,7 @@ void ResMgr::Init( const OUString& rFileName ) #ifdef DBG_UTIL else { - void* aResHandle = 0; // Helper variable for resource handles + void* aResHandle = nullptr; // Helper variable for resource handles void* pVoid; // Pointer on the resource pVoid = pImpRes->LoadGlobalRes( RSC_VERSIONCONTROL, RSCVERSION_ID, @@ -826,7 +826,7 @@ void ResMgr::Init( const OUString& rFileName ) #endif nCurStack = -1; aStack.clear(); - pFallbackResMgr = pOriginalResMgr = NULL; + pFallbackResMgr = pOriginalResMgr = nullptr; incStack(); } @@ -881,7 +881,7 @@ void ResMgr::decStack() OUStringToOString(pFallbackResMgr->GetFileName(), osl_getThreadTextEncoding() ).getStr() ); #endif delete pFallbackResMgr; - pFallbackResMgr = NULL; + pFallbackResMgr = nullptr; } nCurStack--; } @@ -923,7 +923,7 @@ bool ResMgr::IsAvailable( const ResId& rId, const Resource* pResObj ) const if( pMgr->pFallbackResMgr ) { ResId aId( rId ); - aId.SetResMgr( NULL ); + aId.SetResMgr( nullptr ); return pMgr->pFallbackResMgr->IsAvailable( aId, pResObj ); } @@ -961,7 +961,7 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) if( pFallbackResMgr ) { ResId aId( rId ); - aId.SetResMgr( NULL ); + aId.SetResMgr( nullptr ); return pFallbackResMgr->GetResource( aId, pResObj ); } @@ -1094,11 +1094,11 @@ RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId ) if( pFallbackResMgr ) { ResId aId( rId ); - aId.SetResMgr( NULL ); + aId.SetResMgr( nullptr ); return pFallbackResMgr->CreateBlock( aId ); } - RSHEADER_TYPE* pHeader = NULL; + RSHEADER_TYPE* pHeader = nullptr; if ( GetResource( rId ) ) { // Pointer is at the beginning of the resource, thus @@ -1221,7 +1221,7 @@ void* ResMgr::Increment( sal_uInt32 nSize ) ResMgr* ResMgr::CreateFallbackResMgr( const ResId& rId, const Resource* pResource ) { - ResMgr *pFallback = NULL; + ResMgr *pFallback = nullptr; if( nCurStack > 0 ) { // get the next fallback level in resource file scope @@ -1239,7 +1239,7 @@ ResMgr* ResMgr::CreateFallbackResMgr( const ResId& rId, const Resource* pResourc { // found a recursion, no fallback possible ResMgrContainer::get().freeResMgr( pRes ); - return NULL; + return nullptr; } OSL_TRACE( "trying fallback: %s", OUStringToOString( pRes->aFileName, osl_getThreadTextEncoding() ).getStr() ); pFallback = new ResMgr( pRes ); @@ -1273,7 +1273,7 @@ ResMgr* ResMgr::CreateFallbackResMgr( const ResId& rId, const Resource* pResourc if( !bHaveStack ) { delete pFallback; - pFallback = NULL; + pFallback = nullptr; } } } @@ -1292,7 +1292,7 @@ ResMgr* ResMgr::CreateResMgr( const sal_Char* pPrefixName, aLocale = ResMgrContainer::get().getDefLocale(); InternalResMgr* pImp = ResMgrContainer::get().getResMgr( aPrefix, aLocale ); - return pImp ? new ResMgr( pImp ) : NULL; + return pImp ? new ResMgr( pImp ) : nullptr; } ResMgr* ResMgr::SearchCreateResMgr( @@ -1307,7 +1307,7 @@ ResMgr* ResMgr::SearchCreateResMgr( rLocale = ResMgrContainer::get().getDefLocale(); InternalResMgr* pImp = ResMgrContainer::get().getResMgr( aPrefix, rLocale ); - return pImp ? new ResMgr( pImp ) : NULL; + return pImp ? new ResMgr( pImp ) : nullptr; } sal_Int16 ResMgr::ReadShort() @@ -1527,7 +1527,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId ) if ( !m_pResImpl ) return sReturn; - void* pResHandle = NULL; + void* pResHandle = nullptr; InternalResMgr* pFallback = m_pResImpl; RSHEADER_TYPE* pResHeader = static_cast<RSHEADER_TYPE*>(m_pResImpl->LoadGlobalRes( RSC_STRING, nId, &pResHandle )); if ( !pResHeader ) @@ -1551,7 +1551,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId ) else { ResMgrContainer::get().freeResMgr( pFallback ); - pFallback = NULL; + pFallback = nullptr; } } } diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index dc0e8b0506a6..9d9345b16df7 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -59,14 +59,14 @@ friend class ErrorInfo; }; EDcrData::EDcrData() - : pFirstHdl(0) - , pFirstCtx(0) - , pDsp(0) + : pFirstHdl(nullptr) + , pFirstCtx(nullptr) + , pDsp(nullptr) , bIsWindowDsp(false) , nNextDcr(0) { for(sal_uInt16 n=0;n<ERRCODE_DYNAMIC_COUNT;n++) - ppDcr[n]=0; + ppDcr[n]=nullptr; } void EDcr_Impl::RegisterEDcr(DynamicErrorInfo *pDcr) @@ -94,7 +94,7 @@ void EDcr_Impl::UnRegisterEDcr(DynamicErrorInfo *pDcr) ((sal_uIntPtr)(*pDcr) & ERRCODE_DYNAMIC_MASK)>>ERRCODE_DYNAMIC_SHIFT)-1; DBG_ASSERT(ppDcr[lIdx]==pDcr,"ErrHdl: Error nicht gefunden"); if(ppDcr[lIdx]==pDcr) - ppDcr[lIdx]=0; + ppDcr[lIdx]=nullptr; } TYPEINIT0(ErrorInfo); @@ -226,7 +226,7 @@ ErrorHandler::~ErrorHandler() vcl::Window* ErrorContext::GetParent() { - return pImpl ? pImpl->pWin : NULL; + return pImpl ? pImpl->pWin : nullptr; } void ErrorHandler::RegisterDisplay(WindowDisplayErrorFunc *aDsp) @@ -273,7 +273,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl( ErrorContext *pCtx=ErrorContext::GetContext(); if(pCtx) pCtx->GetString(pInfo->GetErrorCode(), aAction); - vcl::Window *pParent=0; + vcl::Window *pParent=nullptr; // Remove parent from context for(;pCtx;pCtx=pCtx->pImpl->pNext) if(pCtx->GetParent()) diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 89a405c13477..fb9dc605ed5f 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -37,7 +37,7 @@ void SvClassManager::Register( sal_Int32 nClassId, SvCreateInstancePersist pFunc SvCreateInstancePersist SvClassManager::Get( sal_Int32 nClassId ) { Map::const_iterator i(aAssocTable.find(nClassId)); - return i == aAssocTable.end() ? 0 : i->second; + return i == aAssocTable.end() ? nullptr : i->second; } // SvRttiBase @@ -59,7 +59,7 @@ SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream, sal , pStm( pStream ) , aPUIdx( nStartIdxP ) , nStartIdx( nStartIdxP ) - , pRefStm( NULL ) + , pRefStm( nullptr ) { DBG_ASSERT( nStartIdx != 0, "zero index not allowed" ); m_isWritable = true; @@ -73,7 +73,7 @@ SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream, sal SvPersistStream::~SvPersistStream() { - SetStream( NULL ); + SetStream( nullptr ); } /** @@ -157,7 +157,7 @@ SvPersistBase * SvPersistStream::GetObject( sal_uIntPtr nIdx ) const return aPUIdx.Get( nIdx ); else if( pRefStm ) return pRefStm->GetObject( nIdx ); - return NULL; + return nullptr; } #define LEN_1 0x80 @@ -474,7 +474,7 @@ sal_uInt32 SvPersistStream::ReadObj sal_uInt32 nId = 0; sal_uInt16 nClassId; - rpObj = NULL; // specification: 0 in case of error + rpObj = nullptr; // specification: 0 in case of error ReadId( *this, nHdr, nId, nClassId ); // get version number through masking @@ -488,7 +488,7 @@ sal_uInt32 SvPersistStream::ReadObj { if( P_OBJ & nHdr ) { // read object, nId only set for P_DBGUTIL - DBG_ASSERT( !(nHdr & P_DBGUTIL) || NULL == aPUIdx.Get( nId ), + DBG_ASSERT( !(nHdr & P_DBGUTIL) || nullptr == aPUIdx.Get( nId ), "object already exist" ); SvCreateInstancePersist pFunc = rClassMgr.Get( nClassId ); @@ -538,7 +538,7 @@ sal_uInt32 SvPersistStream::ReadObj else { rpObj = GetObject( nId ); - DBG_ASSERT( rpObj != NULL, "object does not exist" ); + DBG_ASSERT( rpObj != nullptr, "object does not exist" ); DBG_ASSERT( rpObj->GetClassId() == nClassId, "class mismatch" ); } } diff --git a/tools/source/reversemap/bestreversemap.cxx b/tools/source/reversemap/bestreversemap.cxx index e5112c81983c..97691b3dd0eb 100644 --- a/tools/source/reversemap/bestreversemap.cxx +++ b/tools/source/reversemap/bestreversemap.cxx @@ -36,7 +36,7 @@ struct Encoder sal_uInt32 nCvtInfo; sal_Size nChars = rtl_convertUnicodeToText(m_aConverter, - NULL, &c, 1, aTempArray, sizeof(aTempArray), + nullptr, &c, 1, aTempArray, sizeof(aTempArray), RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR, &nCvtInfo, &nTempSize); m_bCapable = nChars > 0; diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index e1c5b174e007..c42200728e89 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -167,7 +167,7 @@ void SvLockBytes::close() { if (m_bOwner) delete m_pStream; - m_pStream = 0; + m_pStream = nullptr; } TYPEINIT0(SvLockBytes); @@ -1688,7 +1688,7 @@ SvMemoryStream::SvMemoryStream( sal_Size nInitSize, sal_Size nResizeOffset ) nEndOfData = 0L; nResize = nResizeOffset; nPos = 0; - pBuf = 0; + pBuf = nullptr; if( nResize != 0 && nResize < 16 ) nResize = 16; if( nInitSize && !AllocateMemory( nInitSize ) ) @@ -1735,7 +1735,7 @@ void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount, Seek( 0 ); if( bOwnsData ) { - pResult = 0; + pResult = nullptr; if( pNewBuf != pBuf ) FreeMemory(); } @@ -1875,7 +1875,7 @@ void SvMemoryStream::ResetError() bool SvMemoryStream::AllocateMemory( sal_Size nNewSize ) { pBuf = new sal_uInt8[nNewSize]; - return( pBuf != 0 ); + return( pBuf != nullptr ); } // (using Bozo algorithm) @@ -1917,7 +1917,7 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff ) { bRetVal = true; FreeMemory(); - pBuf = 0; + pBuf = nullptr; nSize = 0; nEndOfData = 0; nPos = 0; @@ -1935,11 +1935,11 @@ void* SvMemoryStream::SwitchBuffer( sal_Size nInitSize, sal_Size nResizeOffset) { Flush(); if( !bOwnsData ) - return 0; + return nullptr; Seek( STREAM_SEEK_TO_BEGIN ); void* pRetVal = pBuf; - pBuf = 0; + pBuf = nullptr; nEndOfData = 0L; nResize = nResizeOffset; nPos = 0; @@ -1968,22 +1968,22 @@ void SvMemoryStream::SetSize(sal_uInt64 const nNewSize) } SvScriptStream::SvScriptStream(const OUString& rUrl): - mpProcess(NULL), mpHandle(NULL) + mpProcess(nullptr), mpHandle(nullptr) { oslProcessError rc; rc = osl_executeProcess_WithRedirectedIO( rUrl.pData, - NULL, 0, + nullptr, 0, osl_Process_HIDDEN, - NULL, - NULL, - NULL, 0, + nullptr, + nullptr, + nullptr, 0, &mpProcess, - NULL, &mpHandle, NULL); + nullptr, &mpHandle, nullptr); if (osl_Process_E_None != rc) { - mpProcess = NULL; - mpHandle = NULL; + mpProcess = nullptr; + mpHandle = nullptr; } } @@ -2021,13 +2021,13 @@ bool SvScriptStream::ReadLine(OString &rStr, sal_Int32) bool SvScriptStream::good() const { - return mpHandle != NULL; + return mpHandle != nullptr; } //Create a OString of nLen bytes from rStream OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen) { - rtl_String *pStr = NULL; + rtl_String *pStr = nullptr; if (nLen) { nLen = std::min(nLen, static_cast<sal_Size>(SAL_MAX_INT32)); @@ -2056,7 +2056,7 @@ OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen) //Create a OUString of nLen sal_Unicodes from rStream OUString read_uInt16s_ToOUString(SvStream& rStrm, sal_Size nLen) { - rtl_uString *pStr = NULL; + rtl_uString *pStr = nullptr; if (nLen) { nLen = std::min(nLen, static_cast<sal_Size>(SAL_MAX_INT32)); diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 35c5abd4ef8f..53768eb8e27d 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -174,7 +174,7 @@ class StreamData public: oslFileHandle rHandle; - StreamData() : rHandle( 0 ) { } + StreamData() : rHandle( nullptr ) { } }; static sal_uInt32 GetSvError( int nErrno ) @@ -554,7 +554,7 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nOpenMode ) rc = osl_closeFile( nHandleTmp ); bIsOpen = false; m_isWritable = false; - pInstanceData->rHandle = 0; + pInstanceData->rHandle = nullptr; } } else @@ -576,7 +576,7 @@ void SvFileStream::Close() Flush(); osl_closeFile( pInstanceData->rHandle ); - pInstanceData->rHandle = 0; + pInstanceData->rHandle = nullptr; } bIsOpen = false; diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index c8a8dc25f8a0..7a983aaf9392 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -41,11 +41,11 @@ ZCodec::ZCodec( sal_uIntPtr nInBufSize, sal_uIntPtr nOutBufSize ) : meState(STATE_INIT) , mbStatus(false) , mbFinish(false) - , mpInBuf(NULL) + , mpInBuf(nullptr) , mnInBufSize(nInBufSize) , mnInToRead(0) - , mpOStm(NULL) - , mpOutBuf(NULL) + , mpOStm(nullptr) + , mpOutBuf(nullptr) , mnOutBufSize(nOutBufSize) , mnCRC(0) , mnCompressLevel(0) @@ -65,9 +65,9 @@ void ZCodec::BeginCompression( int nCompressLevel, bool updateCrc, bool gzLib ) assert(meState == STATE_INIT); mbStatus = true; mbFinish = false; - mpOStm = NULL; + mpOStm = nullptr; mnInToRead = 0xffffffff; - mpInBuf = mpOutBuf = NULL; + mpInBuf = mpOutBuf = nullptr; PZSTREAM->total_out = PZSTREAM->total_in = 0; mnCompressLevel = nCompressLevel; mbUpdateCrc = updateCrc; |