From 34a66ff58a20856fb4388e523becdd5397e08fb0 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 10 Nov 2015 10:27:49 +0100 Subject: loplugin:nullptr (automatic rewrite) Change-Id: Ie7e4b028ee0cd6e0254dda8dfe3c70973865bc03 --- unotest/source/cpp/bootstrapfixturebase.cxx | 4 ++-- unotest/source/cpp/filters-test.cxx | 6 +++--- unotest/source/cpp/getargument.cxx | 2 +- unotest/source/cpp/officeconnection.cxx | 14 +++++++------- unotest/source/cpp/uniquepipename.cxx | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'unotest') diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx index af340d62f02a..74a28026fc3c 100644 --- a/unotest/source/cpp/bootstrapfixturebase.cxx +++ b/unotest/source/cpp/bootstrapfixturebase.cxx @@ -45,9 +45,9 @@ test::BootstrapFixtureBase::BootstrapFixtureBase() { #ifndef ANDROID const char* pSrcRoot = getenv( "SRC_ROOT" ); - CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0); + CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != nullptr && pSrcRoot[0] != 0); const char* pWorkdirRoot = getenv( "WORKDIR_FOR_BUILD" ); - CPPUNIT_ASSERT_MESSAGE("$WORKDIR_FOR_BUILD env variable not set", pWorkdirRoot != NULL && pWorkdirRoot[0] != 0); + CPPUNIT_ASSERT_MESSAGE("$WORKDIR_FOR_BUILD env variable not set", pWorkdirRoot != nullptr && pWorkdirRoot[0] != 0); #else const char* pSrcRoot = "/assets"; const char* pWorkdirRoot = "/assets"; diff --git a/unotest/source/cpp/filters-test.cxx b/unotest/source/cpp/filters-test.cxx index 384302eec0bd..6ed09e6e6a3f 100644 --- a/unotest/source/cpp/filters-test.cxx +++ b/unotest/source/cpp/filters-test.cxx @@ -23,12 +23,12 @@ namespace test { void decode(const OUString& rIn, const OUString &rOut) { rtlCipher cipher = rtl_cipher_create(rtl_Cipher_AlgorithmARCFOUR, rtl_Cipher_ModeStream); - CPPUNIT_ASSERT_MESSAGE("cipher creation failed", cipher != 0); + CPPUNIT_ASSERT_MESSAGE("cipher creation failed", cipher != nullptr); //mcrypt --bare -a arcfour -o hex -k 435645 -s 3 const sal_uInt8 aKey[3] = {'C', 'V', 'E'}; - rtlCipherError result = rtl_cipher_init(cipher, rtl_Cipher_DirectionDecode, aKey, SAL_N_ELEMENTS(aKey), 0, 0); + rtlCipherError result = rtl_cipher_init(cipher, rtl_Cipher_DirectionDecode, aKey, SAL_N_ELEMENTS(aKey), nullptr, 0); CPPUNIT_ASSERT_EQUAL_MESSAGE("cipher init failed", rtl_Cipher_E_None, result); @@ -111,7 +111,7 @@ void FiltersTest::recursiveScan(filterStatus nExpected, OUString realUrl; if (bEncrypted) { - CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, osl::FileBase::createTempFile(NULL, NULL, &sTmpFile)); + CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, osl::FileBase::createTempFile(nullptr, nullptr, &sTmpFile)); decode(sURL, sTmpFile); realUrl = sTmpFile; } diff --git a/unotest/source/cpp/getargument.cxx b/unotest/source/cpp/getargument.cxx index 7a7e765e0eb1..5fca79af6016 100644 --- a/unotest/source/cpp/getargument.cxx +++ b/unotest/source/cpp/getargument.cxx @@ -31,7 +31,7 @@ namespace test { namespace detail { bool getArgument(OUString const & name, OUString * value) { - OSL_ASSERT(value != 0); + OSL_ASSERT(value != nullptr); return rtl::Bootstrap::get("arg-" + name, *value); } diff --git a/unotest/source/cpp/officeconnection.cxx b/unotest/source/cpp/officeconnection.cxx index 63388bc4810a..326b3325868e 100644 --- a/unotest/source/cpp/officeconnection.cxx +++ b/unotest/source/cpp/officeconnection.cxx @@ -38,7 +38,7 @@ namespace test { -OfficeConnection::OfficeConnection(): process_(0) {} +OfficeConnection::OfficeConnection(): process_(nullptr) {} OfficeConnection::~OfficeConnection() {} @@ -72,7 +72,7 @@ void OfficeConnection::setUp() { noquickArg.pData, norestoreArg.pData, nologoArg.pData, headlessArg.pData, acceptArg.pData, userArg.pData, jreArg.pData, classpathArg.pData }; - rtl_uString ** envs = 0; + rtl_uString ** envs = nullptr; OUString argEnv; if (detail::getArgument("env", &argEnv)) { @@ -84,7 +84,7 @@ void OfficeConnection::setUp() { osl_executeProcess( toAbsoluteFileUrl( argSoffice.copy(RTL_CONSTASCII_LENGTH("path:"))).pData, - args, SAL_N_ELEMENTS(args), 0, 0, 0, envs, envs == 0 ? 0 : 1, + args, SAL_N_ELEMENTS(args), 0, nullptr, nullptr, envs, envs == nullptr ? 0 : 1, &process_)); } else if (argSoffice.match("connect:")) { desc = argSoffice.copy(RTL_CONSTASCII_LENGTH("connect:")); @@ -102,7 +102,7 @@ void OfficeConnection::setUp() { css::uno::UNO_QUERY_THROW); break; } catch (css::connection::NoConnectException &) {} - if (process_ != 0) { + if (process_ != nullptr) { TimeValue delay = { 1, 0 }; // 1 sec CPPUNIT_ASSERT_EQUAL( osl_Process_E_TimedOut, @@ -112,7 +112,7 @@ void OfficeConnection::setUp() { } void OfficeConnection::tearDown() { - if (process_ != 0) { + if (process_ != nullptr) { if (context_.is()) { css::uno::Reference< css::frame::XDesktop2 > desktop = css::frame::Desktop::create( context_ ); context_.clear(); @@ -131,13 +131,13 @@ void OfficeConnection::tearDown() { osl_getProcessInfo(process_, osl_Process_EXITCODE, &info)); CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code); osl_freeProcessHandle(process_); - process_ = 0; // guard against subsequent calls to isStillAlive + process_ = nullptr; // guard against subsequent calls to isStillAlive } } bool OfficeConnection::isStillAlive() const { - if (process_ == 0) { + if (process_ == nullptr) { // In case "soffice" argument starts with "connect:" we have no direct // control over the liveness of the soffice.bin process (would need to // directly monitor the bridge) so can only assume the best here: diff --git a/unotest/source/cpp/uniquepipename.cxx b/unotest/source/cpp/uniquepipename.cxx index e75138076ff9..ed6edcb2a46b 100644 --- a/unotest/source/cpp/uniquepipename.cxx +++ b/unotest/source/cpp/uniquepipename.cxx @@ -31,7 +31,7 @@ OUString uniquePipeName(OUString const & name) { info.Size = sizeof info; CPPUNIT_ASSERT_EQUAL( osl_Process_E_None, - osl_getProcessInfo(0, osl_Process_IDENTIFIER, &info)); + osl_getProcessInfo(nullptr, osl_Process_IDENTIFIER, &info)); return name + OUString::number(info.Ident); } -- cgit