diff --git a/src/TNL/Algorithms/detail/Reduction.hpp b/src/TNL/Algorithms/detail/Reduction.hpp index 1c0510dbe4662a293aaefcec46f962e056896cca..dc7d59f4a13aa394aafd610d5acdb210f51426ea 100644 --- a/src/TNL/Algorithms/detail/Reduction.hpp +++ b/src/TNL/Algorithms/detail/Reduction.hpp @@ -290,7 +290,7 @@ Reduction< Devices::Cuda >::reduce( const Index begin, const Index end, Fetch&& detail::CudaReductionKernelLauncher< Index, Result > reductionLauncher( begin, end ); // start the reduce on the GPU - Result* deviceAux1( 0 ); + Result* deviceAux1 = nullptr; const int reducedSize = reductionLauncher.start( reduce, fetch, identity, deviceAux1 ); #ifdef CUDA_REDUCTION_PROFILING @@ -379,8 +379,8 @@ Reduction< Devices::Cuda >::reduceWithArgument( const Index begin, detail::CudaReductionKernelLauncher< Index, Result > reductionLauncher( begin, end ); // start the reduce on the GPU - Result* deviceAux1( nullptr ); - Index* deviceIndexes( nullptr ); + Result* deviceAux1 = nullptr; + Index* deviceIndexes = nullptr; const int reducedSize = reductionLauncher.startWithArgument( reduce, fetch, identity, deviceAux1, deviceIndexes ); #ifdef CUDA_REDUCTION_PROFILING diff --git a/src/TNL/Config/parseCommandLine.h b/src/TNL/Config/parseCommandLine.h index 0603f10ec4e34c02710d615a7ff389f79186aa36..a26d23cdb159c924e731d364f5b59f71d3342e8b 100644 --- a/src/TNL/Config/parseCommandLine.h +++ b/src/TNL/Config/parseCommandLine.h @@ -247,7 +247,7 @@ parseCommandLine( int argc, } const std::string option = _option.substr( 2 ); const ConfigEntryBase* entryBase = config_description.getEntry( option ); - if( entryBase == NULL ) + if( entryBase == nullptr ) throw Exceptions::ConfigError( "Unknown parameter " + _option + "." ); const String entryType = entryBase->getUIEntryType(); if( i == argc - 1 ) diff --git a/src/TNL/Functions/TestFunction_impl.h b/src/TNL/Functions/TestFunction_impl.h index 4efe45a2aec8990f222dfa164c01cb9f39e8e7e2..c646c8a65307383c4e17373678fbb03e78724013 100644 --- a/src/TNL/Functions/TestFunction_impl.h +++ b/src/TNL/Functions/TestFunction_impl.h @@ -45,7 +45,7 @@ namespace Functions { template< int FunctionDimension, typename Real, typename Device > TestFunction< FunctionDimension, Real, Device >::TestFunction() -: function( 0 ), operator_( 0 ), timeDependence( none ), timeScale( 1.0 ) +: function( nullptr ), operator_( nullptr ), timeDependence( none ), timeScale( 1.0 ) {} template< int FunctionDimension, typename Real, typename Device > diff --git a/src/TNL/Images/DicomSeries_impl.h b/src/TNL/Images/DicomSeries_impl.h index 82d7c55ddbfc17bd340cd8905c1f242756802460..91a0a2f0f7b61fc76ac8b3bfd14d859b9e108c9b 100644 --- a/src/TNL/Images/DicomSeries_impl.h +++ b/src/TNL/Images/DicomSeries_impl.h @@ -38,8 +38,8 @@ filter( const struct dirent* dire ) inline DicomSeries::DicomSeries( const String& filePath ) { #ifdef HAVE_DCMTK_H - dicomImage = 0; - pixelData = 0; + dicomImage = nullptr; + pixelData = nullptr; #endif imagesInfo.imagesCount = 0; imagesInfo.maxColorValue = 0; @@ -57,7 +57,7 @@ inline DicomSeries::~DicomSeries() for( int i = 0; i < length; i++ ) { DicomHeader* header = dicomSeriesHeaders[ i ]; delete header; - header = 0; + header = nullptr; } #ifdef HAVE_DCMTK_H @@ -178,7 +178,7 @@ DicomSeries::loadImage( const String& filePath, int number ) // load image if( dicomImage ) delete dicomImage; - dicomImage = NULL; + dicomImage = nullptr; dicomImage = new DicomImage( filePath.getString() ); @@ -192,7 +192,7 @@ DicomSeries::loadImage( const String& filePath, int number ) return false; } - if( dicomImage != NULL ) { + if( dicomImage != nullptr ) { EI_Status imageStatus = dicomImage->getStatus(); if( imageStatus == EIS_Normal ) { // ok - image loaded @@ -203,12 +203,12 @@ DicomSeries::loadImage( const String& filePath, int number ) << std::endl; delete dicomImage; - dicomImage = NULL; + dicomImage = nullptr; return false; } else { delete dicomImage; - dicomImage = NULL; + dicomImage = nullptr; std::cerr << "Error: cannot load DICOM image (" << DicomImage::getString( dicomImage->getStatus() ) << ")" << std::endl; return false; @@ -276,7 +276,7 @@ DicomSeries::loadImage( const String& filePath, int number ) // delete image object - data are stored separately delete dicomImage; - dicomImage = NULL; + dicomImage = nullptr; return true; #else std::cerr << "DICOM format is not supported in this build of TNL." << std::endl; @@ -356,7 +356,7 @@ DicomSeries::freeData() #ifdef HAVE_DCMTK_H if( pixelData ) delete pixelData; - pixelData = NULL; + pixelData = nullptr; #endif } diff --git a/src/TNL/Images/PNGImage_impl.h b/src/TNL/Images/PNGImage_impl.h index 8e812a1c26727a01ba4878fbe8bb76a1652dbf40..3b946ff8276f5ea798f92dad5039adedd7417a73 100644 --- a/src/TNL/Images/PNGImage_impl.h +++ b/src/TNL/Images/PNGImage_impl.h @@ -36,19 +36,19 @@ PNGImage< Index >::readHeader() /**** * Allocate necessary memory */ - this->png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING, NULL, NULL, NULL ); + this->png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr ); if( ! this->png_ptr ) return false; this->info_ptr = png_create_info_struct( this->png_ptr ); if( ! this->info_ptr ) { - png_destroy_read_struct( &this->png_ptr, (png_infopp) NULL, (png_infopp) NULL ); + png_destroy_read_struct( &this->png_ptr, nullptr, nullptr ); return false; } this->end_info = png_create_info_struct( this->png_ptr ); if( ! this->end_info ) { - png_destroy_read_struct( &this->png_ptr, &this->info_ptr, (png_infopp) NULL ); + png_destroy_read_struct( &this->png_ptr, &this->info_ptr, nullptr ); return false; } @@ -65,7 +65,7 @@ PNGImage< Index >::readHeader() /**** * Read the header */ - png_read_png( this->png_ptr, this->info_ptr, PNG_TRANSFORM_IDENTITY, NULL ); + png_read_png( this->png_ptr, this->info_ptr, PNG_TRANSFORM_IDENTITY, nullptr ); this->height = (Index) png_get_image_height( this->png_ptr, this->info_ptr ); this->width = (Index) png_get_image_width( this->png_ptr, this->info_ptr ); this->bit_depth = png_get_bit_depth( this->png_ptr, this->info_ptr ); @@ -184,13 +184,13 @@ bool PNGImage< Index >::writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid ) { #ifdef HAVE_PNG_H - this->png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, NULL, NULL, NULL ); + this->png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr ); if( ! png_ptr ) return false; this->info_ptr = png_create_info_struct( this->png_ptr ); if( ! this->info_ptr ) { - png_destroy_write_struct( &this->png_ptr, NULL ); + png_destroy_write_struct( &this->png_ptr, nullptr ); return false; } diff --git a/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp b/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp index 5a831cb783f3655e87dec7b6a005c8dad69278a6..579ca421afca051e2e4c19622648dd2a6e1f2a09 100644 --- a/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp +++ b/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp @@ -72,7 +72,7 @@ SubdomainOverlapsGetter< Grid< 1, Real, Device, Index > >::getOverlaps( if( MPI::GetSize() == 1 ) return; - TNL_ASSERT_TRUE( distributedMesh != NULL, "" ); + TNL_ASSERT_TRUE( distributedMesh != nullptr, "" ); const CoordinatesType& subdomainCoordinates = distributedMesh->getSubdomainCoordinates(); int rank = MPI::GetRank(); @@ -103,7 +103,7 @@ SubdomainOverlapsGetter< Grid< 2, Real, Device, Index > >::getOverlaps( if( MPI::GetSize() == 1 ) return; - TNL_ASSERT_TRUE( distributedMesh != NULL, "" ); + TNL_ASSERT_TRUE( distributedMesh != nullptr, "" ); const CoordinatesType& subdomainCoordinates = distributedMesh->getSubdomainCoordinates(); int rank = MPI::GetRank(); @@ -146,7 +146,7 @@ SubdomainOverlapsGetter< Grid< 3, Real, Device, Index > >::getOverlaps( if( MPI::GetSize() == 1 ) return; - TNL_ASSERT_TRUE( distributedMesh != NULL, "" ); + TNL_ASSERT_TRUE( distributedMesh != nullptr, "" ); const CoordinatesType& subdomainCoordinates = distributedMesh->getSubdomainCoordinates(); int rank = MPI::GetRank(); diff --git a/src/TNL/SystemInfo.h b/src/TNL/SystemInfo.h index ba6069d2818ad3009d987b5374d7bc0dad56f653..a8e2daede09e8f602b9b0bfe1252a5e213d63d56 100644 --- a/src/TNL/SystemInfo.h +++ b/src/TNL/SystemInfo.h @@ -70,7 +70,7 @@ protected: std::ifstream file( fileName.getString() ); if( ! file ) { std::cerr << "Unable to read information from " << fileName << "." << std::endl; - return 0; + return 0; // NOLINT(modernize-use-nullptr) } ResultType result; file >> result; diff --git a/src/TNL/TypeInfo.h b/src/TNL/TypeInfo.h index 070f353d26692303066739163fe4c70021ed746e..3f1d3a8e88387411f89b92ec437b7b4cc2cb7975 100644 --- a/src/TNL/TypeInfo.h +++ b/src/TNL/TypeInfo.h @@ -33,7 +33,7 @@ demangle( const char* name ) #if defined( TNL_HAS_CXXABI_H ) int status = 0; std::size_t size = 0; - std::unique_ptr< char[], void ( * )( void* ) > result( abi::__cxa_demangle( name, NULL, &size, &status ), std::free ); + std::unique_ptr< char[], void ( * )( void* ) > result( abi::__cxa_demangle( name, nullptr, &size, &status ), std::free ); if( result.get() ) return result.get(); #endif @@ -56,7 +56,7 @@ private: static constexpr std::false_type check( ... ); - using type = decltype( check< std::decay_t< T > >( 0 ) ); + using type = decltype( check< std::decay_t< T > >( nullptr ) ); public: static constexpr bool value = type::value; diff --git a/src/TNL/TypeTraits.h b/src/TNL/TypeTraits.h index 4d3972af27859800caf9c7044692202b5bc4897c..962546fe6220aaa0d6ddf15d4e4cdf38d6257614 100644 --- a/src/TNL/TypeTraits.h +++ b/src/TNL/TypeTraits.h @@ -33,7 +33,7 @@ private: template< typename C > static NoType& test(...); public: - static constexpr bool value = ( sizeof( test< std::decay_t<T> >(0) ) == sizeof( YesType ) ); + static constexpr bool value = ( sizeof( test< std::decay_t< T > >( nullptr ) ) == sizeof( YesType ) ); }; /** @@ -74,7 +74,7 @@ private: template< typename > static constexpr std::false_type check(...); - using type = decltype(check<std::decay_t<T> >(0)); + using type = decltype( check< std::decay_t< T > >( nullptr ) ); public: static constexpr bool value = type::value; @@ -101,7 +101,7 @@ private: template< typename > static constexpr std::false_type check(...); - using type = decltype(check<std::decay_t<T> >(0)); + using type = decltype( check< std::decay_t< T > >( nullptr ) ); public: static constexpr bool value = type::value; @@ -128,7 +128,7 @@ private: template< typename > static constexpr std::false_type check(...); - using type = decltype(check<std::decay_t<T> >(0)); + using type = decltype( check< std::decay_t< T > >( nullptr ) ); public: static constexpr bool value = type::value;