diff options
author | Florian Becker <fb@vxapps.com> | 2021-09-19 22:33:50 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2021-10-01 01:55:43 +0800 |
commit | 3836794be3e10b8a65f666f07fa721c7ea205a17 (patch) | |
tree | 1c133941eaa296f48f9231074258e64f27e14b13 | |
parent | 942992e8abbe00aad7d0671671124a046cae2cda (diff) | |
download | cppunit-3836794be3e10b8a65f666f07fa721c7ea205a17.tar.gz |
Replace NULL with nullptr
23 files changed, 60 insertions, 60 deletions
diff --git a/examples/ClockerPlugIn/ClockerPlugIn.cpp b/examples/ClockerPlugIn/ClockerPlugIn.cpp index bfcdbd1..d170024 100644 --- a/examples/ClockerPlugIn/ClockerPlugIn.cpp +++ b/examples/ClockerPlugIn/ClockerPlugIn.cpp @@ -12,9 +12,9 @@ class ClockerPlugIn : public CppUnitTestPlugIn { public: ClockerPlugIn() - : m_dumper( NULL ) - , m_model( NULL ) - , m_xmlHook( NULL ) + : m_dumper( nullptr ) + , m_model( nullptr ) + , m_xmlHook( nullptr ) { } diff --git a/examples/DumperPlugIn/DumperPlugIn.cpp b/examples/DumperPlugIn/DumperPlugIn.cpp index 55ef9f1..f0f16f9 100644 --- a/examples/DumperPlugIn/DumperPlugIn.cpp +++ b/examples/DumperPlugIn/DumperPlugIn.cpp @@ -8,7 +8,7 @@ class DumperPlugIn : public CppUnitTestPlugIn { public: DumperPlugIn() - : m_dumper( NULL ) + : m_dumper( nullptr ) { } diff --git a/examples/cppunittest/MockTestCase.cpp b/examples/cppunittest/MockTestCase.cpp index f8eff46..033bba5 100644 --- a/examples/cppunittest/MockTestCase.cpp +++ b/examples/cppunittest/MockTestCase.cpp @@ -20,7 +20,7 @@ MockTestCase::MockTestCase( std::string name ) , m_setUpThrow( false ) , m_tearDownThrow( false ) , m_runTestThrow( false ) - , m_passingTest( NULL ) + , m_passingTest( nullptr ) { } diff --git a/examples/cppunittest/MockTestListener.cpp b/examples/cppunittest/MockTestListener.cpp index 0cacfd3..f1de8a1 100644 --- a/examples/cppunittest/MockTestListener.cpp +++ b/examples/cppunittest/MockTestListener.cpp @@ -34,8 +34,8 @@ MockTestListener::MockTestListener( std::string name ) , m_hasParametersExpectationForAddFailure( false ) , m_expectedAddFailureCallCount( 0 ) , m_addFailureCall( 0 ) - , m_expectedFailedTest( NULL ) - , m_expectedException( NULL ) + , m_expectedFailedTest( nullptr ) + , m_expectedException( nullptr ) , m_expectedIsError( false ) { } diff --git a/examples/cppunittest/TrackedTestCase.cpp b/examples/cppunittest/TrackedTestCase.cpp index aaea99a..6d8aab2 100644 --- a/examples/cppunittest/TrackedTestCase.cpp +++ b/examples/cppunittest/TrackedTestCase.cpp @@ -1,18 +1,18 @@ #include "TrackedTestCase.h" -Tracker *TrackedTestCase::ms_tracker = NULL; +Tracker *TrackedTestCase::ms_tracker = nullptr; TrackedTestCase::TrackedTestCase() : CPPUNIT_NS::TestCase( "" ) { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onConstructor(); } TrackedTestCase::~TrackedTestCase() { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onDestructor(); } @@ -20,7 +20,7 @@ TrackedTestCase::~TrackedTestCase() void TrackedTestCase::setUp() { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onSetUp(); } @@ -28,7 +28,7 @@ TrackedTestCase::setUp() void TrackedTestCase::tearDown() { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onTearDown(); } @@ -36,7 +36,7 @@ TrackedTestCase::tearDown() void TrackedTestCase::test() { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onTest(); } @@ -51,5 +51,5 @@ TrackedTestCase::setTracker( Tracker *tracker ) void TrackedTestCase::removeTracker() { - ms_tracker = NULL; + ms_tracker = nullptr; } diff --git a/include/cppunit/Test.h b/include/cppunit/Test.h index a56be0f..2a8fada 100644 --- a/include/cppunit/Test.h +++ b/include/cppunit/Test.h @@ -51,7 +51,7 @@ public: * You should override doGetChildTestAt() method. * * \param index Zero based index of the child test to return. - * \return Pointer on the test. Never \c NULL. + * \return Pointer on the test. Never \c nullptr. * \exception std::out_of_range is \a index is < 0 or >= getChildTestCount(). */ virtual Test *getChildTestAt( int index ) const; @@ -83,7 +83,7 @@ public: /*! \brief Finds the test with the specified name in the hierarchy. * \param testName Name of the test to find. - * \return Pointer on the first test found that is named \a testName. Never \c NULL. + * \return Pointer on the first test found that is named \a testName. Never \c nullptr. * \exception std::invalid_argument if no test named \a testName is found. */ virtual Test *findTest( const std::string &testName ) const; @@ -105,7 +105,7 @@ protected: /*! \brief Returns the child test of the specified valid index. * \param index Zero based valid index of the child test to return. - * \return Pointer on the test. Never \c NULL. + * \return Pointer on the test. Never \c nullptr. */ virtual Test *doGetChildTestAt( int index ) const =0; }; diff --git a/include/cppunit/TestPath.h b/include/cppunit/TestPath.h index 8934479..4eb6a26 100644 --- a/include/cppunit/TestPath.h +++ b/include/cppunit/TestPath.h @@ -83,7 +83,7 @@ public: virtual bool isValid() const; /*! \brief Adds a test to the path. - * \param test Pointer on the test to add. Must not be \c NULL. + * \param test Pointer on the test to add. Must not be \c nullptr. */ virtual void add( Test *test ); @@ -93,7 +93,7 @@ public: virtual void add( const TestPath &path ); /*! \brief Inserts a test at the specified index. - * \param test Pointer on the test to insert. Must not be \c NULL. + * \param test Pointer on the test to insert. Must not be \c nullptr. * \param index Zero based index indicating where the test is inserted. * \exception std::out_of_range is \a index < 0 or \a index > getTestCount(). */ @@ -132,13 +132,13 @@ public: /*! \brief Returns the test of the specified index. * \param index Zero based index of the test to return. - * \return Pointer on the test at index \a index. Never \c NULL. + * \return Pointer on the test at index \a index. Never \c nullptr. * \exception std::out_of_range is \a index < 0 or \a index >= getTestCount(). */ virtual Test *getTestAt( int index ) const; /*! \brief Get the last test of the path. - * \return Pointer on the last test (test at the bottom of the hierarchy). Never \c NULL. + * \return Pointer on the last test (test at the bottom of the hierarchy). Never \c nullptr. * \exception std::out_of_range if the path is not valid ( isValid() returns \c false ). */ virtual Test *getChildTest() const; @@ -185,7 +185,7 @@ protected: * the root test if the path string is relative. * \param pathAsString Path string. May be absolute or relative. * \param testNames Test name components are added to that container. - * \return Pointer on the resolved root test. Never \c NULL. + * \return Pointer on the resolved root test. Never \c nullptr. * \exception std::invalid_argument if either the root name can not be resolved or if * pathAsString contains no name components. */ diff --git a/include/cppunit/TestSuite.h b/include/cppunit/TestSuite.h index 63c0a6b..e02d1e2 100644 --- a/include/cppunit/TestSuite.h +++ b/include/cppunit/TestSuite.h @@ -47,7 +47,7 @@ public: ~TestSuite(); /*! Adds the specified test to the suite. - * \param test Test to add. Must not be \c NULL. + * \param test Test to add. Must not be \c nullptr. */ void addTest( Test *test ); diff --git a/include/cppunit/XmlOutputter.h b/include/cppunit/XmlOutputter.h index 2bf9411..36fe954 100644 --- a/include/cppunit/XmlOutputter.h +++ b/include/cppunit/XmlOutputter.h @@ -52,7 +52,7 @@ public: virtual ~XmlOutputter(); /*! \brief Adds the specified hook to the outputter. - * \param hook Hook to add. Must not be \c NULL. + * \param hook Hook to add. Must not be \c nullptr. */ virtual void addHook( XmlOutputterHook *hook ); diff --git a/include/cppunit/extensions/TestSuiteBuilderContext.h b/include/cppunit/extensions/TestSuiteBuilderContext.h index 04f4b9b..f66a203 100644 --- a/include/cppunit/extensions/TestSuiteBuilderContext.h +++ b/include/cppunit/extensions/TestSuiteBuilderContext.h @@ -47,7 +47,7 @@ public: /*! \brief Adds a test to the fixture suite. * - * \param test Test to add to the fixture suite. Must not be \c NULL. + * \param test Test to add to the fixture suite. Must not be \c nullptr. */ void addTest( Test *test ); diff --git a/include/cppunit/plugin/DynamicLibraryManager.h b/include/cppunit/plugin/DynamicLibraryManager.h index d70ccde..4ec9d91 100644 --- a/include/cppunit/plugin/DynamicLibraryManager.h +++ b/include/cppunit/plugin/DynamicLibraryManager.h @@ -49,7 +49,7 @@ public: /*! \brief Returns a pointer on the specified symbol exported by the library. * \param symbol Name of the symbol exported by the library. - * \return Pointer on the symbol. Should be casted to the actual type. Never \c NULL. + * \return Pointer on the symbol. Should be casted to the actual type. Never \c nullptr. * \exception DynamicLibraryManagerException if the symbol is not found. */ Symbol findSymbol( const std::string &symbol ); @@ -72,14 +72,14 @@ private: * * May throw any exceptions (indicates failure). * \param libraryName Name of the library to load. - * \return Handle of the loaded library. \c NULL indicates failure. + * \return Handle of the loaded library. \c nullptr indicates failure. */ LibraryHandle doLoadLibrary( const std::string &libraryName ); /*! Releases the loaded library. * * The handle of the library to free is in \c m_libraryHandle. It is never - * \c NULL. + * \c nullptr. * \warning Must NOT throw any exceptions (called from destructor). */ void doReleaseLibrary(); @@ -88,7 +88,7 @@ private: * * May throw any exceptions (indicates failure). * \param symbol Name of the symbol exported by the library. - * \return Pointer on the symbol. \c NULL indicates failure. + * \return Pointer on the symbol. \c nullptr indicates failure. */ Symbol doFindSymbol( const std::string &symbol ); diff --git a/include/cppunit/plugin/PlugInManager.h b/include/cppunit/plugin/PlugInManager.h index c9d72d8..9b73af5 100644 --- a/include/cppunit/plugin/PlugInManager.h +++ b/include/cppunit/plugin/PlugInManager.h @@ -40,7 +40,7 @@ public: * \param libraryFileName Name of the file that contains the TestPlugIn. * \param parameters List of string passed to the plug-in. * \return Pointer on the DynamicLibraryManager associated to the library. - * Valid until the library is unloaded. Never \c NULL. + * Valid until the library is unloaded. Never \c nullptr. * \exception DynamicLibraryManagerException is thrown if an error occurs during loading. */ void load( const std::string &libraryFileName, diff --git a/include/cppunit/portability/Stream.h b/include/cppunit/portability/Stream.h index e9beb8c..9968fa2 100644 --- a/include/cppunit/portability/Stream.h +++ b/include/cppunit/portability/Stream.h @@ -199,7 +199,7 @@ public: OStream &operator <<( const char *v ) { - return write( v ? v : "NULL" ); + return write( v ? v : "nullptr" ); } OStream &operator <<( char c ) diff --git a/include/cppunit/tools/XmlElement.h b/include/cppunit/tools/XmlElement.h index 70e21f8..3478a35 100644 --- a/include/cppunit/tools/XmlElement.h +++ b/include/cppunit/tools/XmlElement.h @@ -90,7 +90,7 @@ public: int numericValue ); /*! \brief Adds a child element to the element. - * \param element Child element to add. Must not be \c NULL. + * \param element Child element to add. Must not be \c nullptr. */ void addElement( XmlElement *element ); @@ -101,7 +101,7 @@ public: /*! \brief Returns the child element at the specified index. * \param index Zero based index of the element to return. - * \returns Element at the specified index. Never \c NULL. + * \returns Element at the specified index. Never \c nullptr. * \exception std::invalid_argument if \a index < 0 or index >= elementCount(). */ XmlElement *elementAt( int index ) const; diff --git a/include/cppunit/ui/text/TextTestRunner.h b/include/cppunit/ui/text/TextTestRunner.h index 6250166..25fc717 100644 --- a/include/cppunit/ui/text/TextTestRunner.h +++ b/include/cppunit/ui/text/TextTestRunner.h @@ -63,7 +63,7 @@ class TestResultCollector; class CPPUNIT_API TextTestRunner : public CPPUNIT_NS::TestRunner { public: - TextTestRunner( Outputter *outputter =NULL ); + TextTestRunner( Outputter *outputter = nullptr ); virtual ~TextTestRunner(); diff --git a/src/DllPlugInTester/CommandLineParserTest.cpp b/src/DllPlugInTester/CommandLineParserTest.cpp index 2ee2a52..ecdb12f 100644 --- a/src/DllPlugInTester/CommandLineParserTest.cpp +++ b/src/DllPlugInTester/CommandLineParserTest.cpp @@ -17,7 +17,7 @@ CommandLineParserTest::~CommandLineParserTest() void CommandLineParserTest::setUp() { - _parser = NULL; + _parser = nullptr; } @@ -32,7 +32,7 @@ void CommandLineParserTest::parse( const char **lines ) { int count =0; - for ( const char **line = lines; *line != NULL; ++line, ++count ) + for ( const char **line = lines; *line != nullptr; ++line, ++count ) ; delete _parser; @@ -44,7 +44,7 @@ CommandLineParserTest::parse( const char **lines ) void CommandLineParserTest::testEmptyCommandLine() { - static const char *lines[] = { "", NULL }; + static const char *lines[] = { "", nullptr }; parse( lines ); std::string none; @@ -64,7 +64,7 @@ CommandLineParserTest::testEmptyCommandLine() void CommandLineParserTest::testFlagCompiler() { - static const char *lines[] = { "", "-c", NULL }; + static const char *lines[] = { "", "-c", nullptr }; parse( lines ); std::string none; @@ -85,7 +85,7 @@ CommandLineParserTest::testFlagCompiler() void CommandLineParserTest::testLongFlagBriefProgress() { - static const char *lines[] = { "", "--brief-progress", NULL }; + static const char *lines[] = { "", "--brief-progress", nullptr }; parse( lines ); std::string none; @@ -106,7 +106,7 @@ CommandLineParserTest::testLongFlagBriefProgress() void CommandLineParserTest::testFileName() { - static const char *lines[] = { "", "TestPlugIn.dll", NULL }; + static const char *lines[] = { "", "TestPlugIn.dll", nullptr }; parse( lines ); std::string none; @@ -132,7 +132,7 @@ CommandLineParserTest::testFileName() void CommandLineParserTest::testTestPath() { - static const char *lines[] = { "", ":Core", NULL }; + static const char *lines[] = { "", ":Core", nullptr }; parse( lines ); std::string none; @@ -153,7 +153,7 @@ CommandLineParserTest::testTestPath() void CommandLineParserTest::testParameterWithSpace() { - static const char *lines[] = { "", "--xml", "Test Results.xml", NULL }; + static const char *lines[] = { "", "--xml", "Test Results.xml", nullptr }; parse( lines ); std::string none; @@ -175,7 +175,7 @@ CommandLineParserTest::testParameterWithSpace() void CommandLineParserTest::testMissingStyleSheetParameterThrow() { - static const char *lines[] = { "", "--xsl", NULL }; + static const char *lines[] = { "", "--xsl", nullptr }; parse( lines ); } @@ -183,7 +183,7 @@ CommandLineParserTest::testMissingStyleSheetParameterThrow() void CommandLineParserTest::testMissingEncodingParameterThrow() { - static const char *lines[] = { "", "--encoding", NULL }; + static const char *lines[] = { "", "--encoding", nullptr }; parse( lines ); } @@ -191,7 +191,7 @@ CommandLineParserTest::testMissingEncodingParameterThrow() void CommandLineParserTest::testXmlFileNameIsOptional() { - static const char *lines[] = { "", "--xml", NULL }; + static const char *lines[] = { "", "--xml", nullptr }; parse( lines ); std::string none; @@ -203,7 +203,7 @@ void CommandLineParserTest::testPlugInsWithParameters() { static const char *lines[] = { "", "TestPlugIn1.dll=login = lain", - "Clocker.dll", NULL }; + "Clocker.dll", nullptr }; parse( lines ); CPPUNIT_ASSERT_EQUAL( 2, _parser->getPlugInCount() ); diff --git a/src/cppunit/DynamicLibraryManager.cpp b/src/cppunit/DynamicLibraryManager.cpp index e6f6294..9471870 100644 --- a/src/cppunit/DynamicLibraryManager.cpp +++ b/src/cppunit/DynamicLibraryManager.cpp @@ -7,7 +7,7 @@ CPPUNIT_NS_BEGIN DynamicLibraryManager::DynamicLibraryManager( const std::string &libraryFileName ) - : m_libraryHandle( NULL ) + : m_libraryHandle( nullptr ) , m_libraryName( libraryFileName ) { loadLibrary( libraryFileName ); @@ -26,7 +26,7 @@ DynamicLibraryManager::findSymbol( const std::string &symbol ) try { Symbol symbolPointer = doFindSymbol( symbol ); - if ( symbolPointer != NULL ) + if ( symbolPointer != nullptr ) return symbolPointer; } catch ( ... ) @@ -36,7 +36,7 @@ DynamicLibraryManager::findSymbol( const std::string &symbol ) throw DynamicLibraryManagerException( m_libraryName, symbol, DynamicLibraryManagerException::symbolNotFound ); - return NULL; // keep compiler happy + return nullptr; // keep compiler happy } @@ -47,7 +47,7 @@ DynamicLibraryManager::loadLibrary( const std::string &libraryName ) { releaseLibrary(); m_libraryHandle = doLoadLibrary( libraryName ); - if ( m_libraryHandle != NULL ) + if ( m_libraryHandle != nullptr ) return; } catch (...) @@ -63,10 +63,10 @@ DynamicLibraryManager::loadLibrary( const std::string &libraryName ) void DynamicLibraryManager::releaseLibrary() { - if ( m_libraryHandle != NULL ) + if ( m_libraryHandle != nullptr ) { doReleaseLibrary(); - m_libraryHandle = NULL; + m_libraryHandle = nullptr; } } diff --git a/src/cppunit/PlugInManager.cpp b/src/cppunit/PlugInManager.cpp index 4f8b371..80ac89f 100644 --- a/src/cppunit/PlugInManager.cpp +++ b/src/cppunit/PlugInManager.cpp @@ -85,7 +85,7 @@ PlugInManager::unload( PlugInInfo &plugIn ) catch (...) { delete plugIn.m_manager; - plugIn.m_manager = NULL; + plugIn.m_manager = nullptr; throw; } } diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp index f1623cc..35448a6 100644 --- a/src/cppunit/TestFactoryRegistry.cpp +++ b/src/cppunit/TestFactoryRegistry.cpp @@ -70,7 +70,7 @@ public: // validity beforehand using TestFactoryRegistry::isValid() beforehand. assert( isValid() ); if ( !isValid() ) // release mode - return NULL; // => force CRASH + return nullptr; // => force CRASH return getInstance()->getInternalRegistry( name ); } diff --git a/src/cppunit/TestFailure.cpp b/src/cppunit/TestFailure.cpp index e31e138..63b98d7 100644 --- a/src/cppunit/TestFailure.cpp +++ b/src/cppunit/TestFailure.cpp @@ -29,7 +29,7 @@ TestFailure::failedTest() const } -/// Gets the thrown exception. Never \c NULL. +/// Gets the thrown exception. Never \c nullptr. Exception * TestFailure::thrownException() const { diff --git a/src/cppunit/TestLeaf.cpp b/src/cppunit/TestLeaf.cpp index 3d8767c..f4e1a93 100644 --- a/src/cppunit/TestLeaf.cpp +++ b/src/cppunit/TestLeaf.cpp @@ -22,7 +22,7 @@ Test * TestLeaf::doGetChildTestAt( int index ) const { checkIsValidIndex( index ); - return NULL; // never called, checkIsValidIndex() always throw. + return nullptr; // never called, checkIsValidIndex() always throw. } CPPUNIT_NS_END diff --git a/src/cppunit/Win32DynamicLibraryManager.cpp b/src/cppunit/Win32DynamicLibraryManager.cpp index 5dac4fa..81f9ee2 100644 --- a/src/cppunit/Win32DynamicLibraryManager.cpp +++ b/src/cppunit/Win32DynamicLibraryManager.cpp @@ -49,18 +49,18 @@ DynamicLibraryManager::getLastErrorDetail() const FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPSTR) &lpMsgBuf, 0, - NULL + nullptr ); std::string message = (LPCSTR)lpMsgBuf; // Display the string. -// ::MessageBoxA( NULL, (LPCSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); +// ::MessageBoxA( nullptr, (LPCSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); // Free the buffer. ::LocalFree( lpMsgBuf ); diff --git a/src/cppunit/XmlElement.cpp b/src/cppunit/XmlElement.cpp index b16d2fe..691cde1 100644 --- a/src/cppunit/XmlElement.cpp +++ b/src/cppunit/XmlElement.cpp @@ -124,7 +124,7 @@ XmlElement::elementFor( const std::string &name ) const } throw std::invalid_argument( "XmlElement::elementFor(), not matching child element found" ); - return NULL; // make some compilers happy. + return nullptr; // make some compilers happy. } |