[Cppunit-devel] questionable code @ TypeInfoHelper.cpp
Brought to you by:
blep
From: FUKUDA F. <ff...@nt...> - 2002-04-18 07:06:37
|
Hi all, ----- excerpt from src/cppunit/TypeInfoHelper.cpp ----- std::string TypeInfoHelper::getClassName( const std::type_info &info ) { static std::string classPrefix( "class " ); std::string name( info.name() ); bool has_class_prefix = 0 == #if CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST name.compare( classPrefix, 0, classPrefix.length() ); #else name.compare( 0, classPrefix.length(), classPrefix ); #endif return has_class_prefix ? name.substr( classPrefix.length() ) : name; } ------------------ if info.name().length() < classPrefix.length(), an exception should be thrown. I think this method should return 'name' at this condition (as follows). ... static std::string classPrefix( "class " ); std::string name( info.name() ); if ( name.length() < classPrefix.size() ) return name; // ADD THIS! bool has_class_prefix = 0 == ... -----:-----:-----:-----:-----:-----:-----:-----:-----:----- FUKUDA (episteme) Fumiki -- magical, but never a magic... |