mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Address more of PVS studio warnings
This commit is contained in:
		@@ -44,7 +44,7 @@ namespace Catch {
 | 
				
			|||||||
            if( config.verbosity() >= Verbosity::High ) {
 | 
					            if( config.verbosity() >= Verbosity::High ) {
 | 
				
			||||||
                Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;
 | 
					                Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;
 | 
				
			||||||
                std::string description = testCaseInfo.description;
 | 
					                std::string description = testCaseInfo.description;
 | 
				
			||||||
                if( description == "" )
 | 
					                if( description.empty() )
 | 
				
			||||||
                    description = "(NO DESCRIPTION)";
 | 
					                    description = "(NO DESCRIPTION)";
 | 
				
			||||||
                Catch::cout() << Column( description ).indent(4) << std::endl;
 | 
					                Catch::cout() << Column( description ).indent(4) << std::endl;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -129,10 +129,10 @@ namespace Catch {
 | 
				
			|||||||
        Catch::cout() << "Available reporters:\n";
 | 
					        Catch::cout() << "Available reporters:\n";
 | 
				
			||||||
        IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
 | 
					        IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
 | 
				
			||||||
        std::size_t maxNameLen = 0;
 | 
					        std::size_t maxNameLen = 0;
 | 
				
			||||||
        for( auto const& factoryKvp : getRegistryHub().getReporterRegistry().getFactories() )
 | 
					        for( auto const& factoryKvp : factories )
 | 
				
			||||||
            maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
 | 
					            maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for( auto const& factoryKvp : getRegistryHub().getReporterRegistry().getFactories() ) {
 | 
					        for( auto const& factoryKvp : factories ) {
 | 
				
			||||||
            Catch::cout()
 | 
					            Catch::cout()
 | 
				
			||||||
                    << Column( factoryKvp.first + ":" )
 | 
					                    << Column( factoryKvp.first + ":" )
 | 
				
			||||||
                            .indent(2)
 | 
					                            .indent(2)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,7 +91,7 @@ namespace Catch {
 | 
				
			|||||||
        std::string actualMessage = Catch::translateActiveException();
 | 
					        std::string actualMessage = Catch::translateActiveException();
 | 
				
			||||||
        if( !matcher.match( actualMessage ) ) {
 | 
					        if( !matcher.match( actualMessage ) ) {
 | 
				
			||||||
            data.resultType = ResultWas::ExpressionFailed;
 | 
					            data.resultType = ResultWas::ExpressionFailed;
 | 
				
			||||||
            data.reconstructedExpression = actualMessage;
 | 
					            data.reconstructedExpression = std::move(actualMessage);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        AssertionResult result( m_assertionInfo, data );
 | 
					        AssertionResult result( m_assertionInfo, data );
 | 
				
			||||||
        handleResult( result );
 | 
					        handleResult( result );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,12 +30,12 @@ namespace Catch {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        void addRef() const noexcept {
 | 
					        void addRef() const noexcept {
 | 
				
			||||||
            if( m_refs > 0 )
 | 
					            if( m_refs > 0 )
 | 
				
			||||||
                m_refs++;
 | 
					                ++m_refs;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        void release() const noexcept {
 | 
					        void release() const noexcept {
 | 
				
			||||||
            unsigned int refs = m_refs;
 | 
					            unsigned int refs = m_refs;
 | 
				
			||||||
            if( refs > 1 )
 | 
					            if( refs > 1 )
 | 
				
			||||||
                m_refs--;
 | 
					                --m_refs;
 | 
				
			||||||
            else if( refs == 1 )
 | 
					            else if( refs == 1 )
 | 
				
			||||||
                delete[] reinterpret_cast<char const*>( this );
 | 
					                delete[] reinterpret_cast<char const*>( this );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -181,7 +181,7 @@ namespace Catch {
 | 
				
			|||||||
                    node = *it;
 | 
					                    node = *it;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            m_sectionStack.push_back( node );
 | 
					            m_sectionStack.push_back( node );
 | 
				
			||||||
            m_deepestSection = node;
 | 
					            m_deepestSection = std::move(node);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void assertionStarting(AssertionInfo const&) override {}
 | 
					        void assertionStarting(AssertionInfo const&) override {}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user