|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53665 - in trunk/boost/test: . impl utils utils/basic_cstring utils/iterator utils/runtime/cla
From: gennadiy.rozental_at_[hidden]
Date: 2009-06-06 05:27:19
Author: rogeeff
Date: 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
New Revision: 53665
URL: http://svn.boost.org/trac/boost/changeset/53665
Log:
avoid C style casts
Text files modified:
trunk/boost/test/framework.hpp | 2 +-
trunk/boost/test/impl/exception_safety.ipp | 8 ++++----
trunk/boost/test/impl/framework.ipp | 6 +++---
trunk/boost/test/impl/test_tools.ipp | 6 +++---
trunk/boost/test/impl/unit_test_parameters.ipp | 2 +-
trunk/boost/test/impl/unit_test_suite.ipp | 4 ++--
trunk/boost/test/mock_object.hpp | 2 +-
trunk/boost/test/test_tools.hpp | 22 +++++++++++-----------
trunk/boost/test/unit_test_log.hpp | 4 ++--
trunk/boost/test/utils/basic_cstring/basic_cstring.hpp | 18 +++++++++---------
trunk/boost/test/utils/iterator/token_iterator.hpp | 2 +-
trunk/boost/test/utils/named_params.hpp | 2 +-
trunk/boost/test/utils/runtime/cla/argument_factory.hpp | 10 +++++-----
trunk/boost/test/utils/runtime/cla/parser.ipp | 2 +-
14 files changed, 45 insertions(+), 45 deletions(-)
Modified: trunk/boost/test/framework.hpp
==============================================================================
--- trunk/boost/test/framework.hpp (original)
+++ trunk/boost/test/framework.hpp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -70,7 +70,7 @@
template<typename UnitType>
UnitType& get( test_unit_id id )
{
- return static_cast<UnitType&>( get( id, (test_unit_type)UnitType::type ) );
+ return static_cast<UnitType&>( get( id, static_cast<test_unit_type>(UnitType::type) ) );
}
// test initiation
Modified: trunk/boost/test/impl/exception_safety.ipp
==============================================================================
--- trunk/boost/test/impl/exception_safety.ipp (original)
+++ trunk/boost/test/impl/exception_safety.ipp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -166,7 +166,7 @@
, m_forced_exception_point( 1 )
, m_exec_path_point( 0 )
, m_exec_path_counter( 1 )
-, m_break_exec_path( (unsigned)-1 )
+, m_break_exec_path( static_cast<unsigned>(-1) )
, m_invairant_failed( false )
{
framework::register_observer( *this );
@@ -447,7 +447,7 @@
unsigned i;
for( i = 0; i < std::min<std::size_t>( it->m_alloc.size, 8 ); i++ ) {
- unsigned char c = ((unsigned char*)it->m_alloc.ptr)[i];
+ unsigned char c = static_cast<unsigned char*>(it->m_alloc.ptr)[i];
if( (std::isprint)( c ) )
formatter << c;
else
@@ -457,7 +457,7 @@
formatter << "> ";
for( i = 0; i < std::min<std::size_t>( it->m_alloc.size, 8 ); i++ ) {
- unsigned c = ((unsigned char*)it->m_alloc.ptr)[i];
+ unsigned c = static_cast<unsigned char*>(it->m_alloc.ptr)[i];
formatter << std::hex << std::uppercase << c << ' ';
}
@@ -491,7 +491,7 @@
if( m_invairant_failed )
formatter << " and ";
- formatter << (unsigned int)m_memory_in_use.size() << " memory leak";
+ formatter << static_cast<unsigned int>(m_memory_in_use.size()) << " memory leak";
if( m_memory_in_use.size() > 1 )
formatter << 's';
}
Modified: trunk/boost/test/impl/framework.ipp
==============================================================================
--- trunk/boost/test/impl/framework.ipp (original)
+++ trunk/boost/test/impl/framework.ipp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -128,9 +128,9 @@
// the delete will erase this element from map
if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == tut_suite )
- delete (test_suite const*)tu.second;
+ delete static_cast<test_suite const*>(tu.second);
else
- delete (test_case const*)tu.second;
+ delete static_cast<test_case const*>(tu.second);
}
}
@@ -427,7 +427,7 @@
case 0:
break;
case 1: {
- unsigned int seed = (unsigned int)std::time( 0 );
+ unsigned int seed = static_cast<unsigned int>( std::time( 0 ) );
BOOST_TEST_MESSAGE( "Test cases order is shuffled using seed: " << seed );
std::srand( seed );
break;
Modified: trunk/boost/test/impl/test_tools.ipp
==============================================================================
--- trunk/boost/test/impl/test_tools.ipp (original)
+++ trunk/boost/test/impl/test_tools.ipp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -60,7 +60,7 @@
void
print_log_value<char>::operator()( std::ostream& ostr, char t )
{
- if( (std::isprint)( (unsigned char)t ) )
+ if( (std::isprint)( static_cast<unsigned char>(t) ) )
ostr << '\'' << t << '\'';
else
ostr << std::hex
@@ -69,7 +69,7 @@
#else
<< "0x"
#endif
- << (int)t;
+ << static_cast<int>(t);
}
//____________________________________________________________________________//
@@ -84,7 +84,7 @@
#else
<< "0x"
#endif
- << (int)t;
+ << static_cast<int>(t);
}
//____________________________________________________________________________//
Modified: trunk/boost/test/impl/unit_test_parameters.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_parameters.ipp (original)
+++ trunk/boost/test/impl/unit_test_parameters.ipp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -450,7 +450,7 @@
long
detect_memory_leaks()
{
- return retrieve_parameter( DETECT_MEM_LEAKS, s_cla_parser, (long)1 );
+ return retrieve_parameter( DETECT_MEM_LEAKS, s_cla_parser, static_cast<long>(1) );
}
//____________________________________________________________________________//
Modified: trunk/boost/test/impl/unit_test_suite.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_suite.ipp (original)
+++ trunk/boost/test/impl/unit_test_suite.ipp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -104,7 +104,7 @@
// ************************************************************************** //
test_case::test_case( const_string name, callback0<> const& test_func )
-: test_unit( name, (test_unit_type)type )
+: test_unit( name, static_cast<test_unit_type>(type) )
, m_test_func( test_func )
{
// !! weirdest MSVC BUG; try to remove this statement; looks like it eats first token of next statement
@@ -123,7 +123,7 @@
//____________________________________________________________________________//
test_suite::test_suite( const_string name )
-: test_unit( name, (test_unit_type)type )
+: test_unit( name, static_cast<test_unit_type>(type) )
{
framework::register_test_unit( this );
}
Modified: trunk/boost/test/mock_object.hpp
==============================================================================
--- trunk/boost/test/mock_object.hpp (original)
+++ trunk/boost/test/mock_object.hpp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -146,7 +146,7 @@
public:
static mock_object& prototype()
{
- static mock_object p( (dummy*)0 );
+ static mock_object p( reinterpret_cast<dummy*>(0) );
return p;
}
Modified: trunk/boost/test/test_tools.hpp
==============================================================================
--- trunk/boost/test/test_tools.hpp (original)
+++ trunk/boost/test/test_tools.hpp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -78,7 +78,7 @@
P, \
::boost::unit_test::lazy_ostream::instance() << check_descr, \
BOOST_TEST_L(__FILE__), \
- (std::size_t)__LINE__, \
+ static_cast<std::size_t>(__LINE__), \
::boost::test_tools::tt_detail::TL, \
::boost::test_tools::tt_detail::CT \
/**/
@@ -485,15 +485,15 @@
#define TEMPL_PARAMS( z, m, dummy ) , typename BOOST_JOIN( Arg, m )
#define FUNC_PARAMS( z, m, dummy ) \
- , BOOST_JOIN( Arg, m ) const& BOOST_JOIN( arg, m ) \
- , char const* BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
+ , BOOST_JOIN( Arg, m ) const& BOOST_JOIN( arg, m ) \
+ , char const* BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
/**/
#define PRED_PARAMS( z, m, dummy ) BOOST_PP_COMMA_IF( m ) BOOST_JOIN( arg, m )
#define ARG_INFO( z, m, dummy ) \
- , BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
- , &(const unit_test::lazy_ostream&)(unit_test::lazy_ostream::instance() \
+ , BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
+ , &static_cast<const unit_test::lazy_ostream&>(unit_test::lazy_ostream::instance() \
<< ::boost::test_tools::tt_detail::print_helper( BOOST_JOIN( arg, m ) )) \
/**/
@@ -539,15 +539,15 @@
//____________________________________________________________________________//
predicate_result BOOST_TEST_DECL equal_impl( char const* left, char const* right );
-inline predicate_result equal_impl( char* left, char const* right ) { return equal_impl( (char const*)left, (char const*)right ); }
-inline predicate_result equal_impl( char const* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
-inline predicate_result equal_impl( char* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
+inline predicate_result equal_impl( char* left, char const* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); }
+inline predicate_result equal_impl( char const* left, char* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); }
+inline predicate_result equal_impl( char* left, char* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); }
#if !defined( BOOST_NO_CWCHAR )
predicate_result BOOST_TEST_DECL equal_impl( wchar_t const* left, wchar_t const* right );
-inline predicate_result equal_impl( wchar_t* left, wchar_t const* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
-inline predicate_result equal_impl( wchar_t const* left, wchar_t* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
-inline predicate_result equal_impl( wchar_t* left, wchar_t* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
+inline predicate_result equal_impl( wchar_t* left, wchar_t const* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); }
+inline predicate_result equal_impl( wchar_t const* left, wchar_t* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); }
+inline predicate_result equal_impl( wchar_t* left, wchar_t* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); }
#endif
//____________________________________________________________________________//
Modified: trunk/boost/test/unit_test_log.hpp
==============================================================================
--- trunk/boost/test/unit_test_log.hpp (original)
+++ trunk/boost/test/unit_test_log.hpp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -157,7 +157,7 @@
#define BOOST_TEST_PASSPOINT() \
::boost::unit_test::unit_test_log.set_checkpoint( \
BOOST_TEST_L(__FILE__), \
- (std::size_t)__LINE__ ) \
+ static_cast<std::size_t>(__LINE__) ) \
/**/
//____________________________________________________________________________//
@@ -165,7 +165,7 @@
#define BOOST_TEST_CHECKPOINT( M ) \
::boost::unit_test::unit_test_log.set_checkpoint( \
BOOST_TEST_L(__FILE__), \
- (std::size_t)__LINE__, \
+ static_cast<std::size_t>(__LINE__), \
(::boost::wrap_stringstream().ref() << M).str() ) \
/**/
Modified: trunk/boost/test/utils/basic_cstring/basic_cstring.hpp
==============================================================================
--- trunk/boost/test/utils/basic_cstring/basic_cstring.hpp (original)
+++ trunk/boost/test/utils/basic_cstring/basic_cstring.hpp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -57,7 +57,7 @@
// !! should also present reverse_iterator, const_reverse_iterator
#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
- enum npos_type { npos = (size_type)-1 };
+ enum npos_type { npos = static_cast<size_type>(-1) };
#else
// IBM/VisualAge version 6 is not able to handle enums larger than 4 bytes.
// But size_type is 8 bytes in 64bit mode.
@@ -218,7 +218,7 @@
basic_cstring<CharT>::at( size_type index ) const
{
if( m_begin + index >= m_end )
- return (value_type)0;
+ return reinterpret_cast<value_type>(0);
return m_begin[index];
}
@@ -306,7 +306,7 @@
iterator it;
for( it = begin(); it != end(); ++it ) {
- if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == (pointer)0 )
+ if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
break;
}
@@ -351,7 +351,7 @@
iterator it;
for( it = end()-1; it != begin()-1; --it ) {
- if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == (pointer)0 )
+ if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
break;
}
@@ -514,7 +514,7 @@
basic_cstring<CharT>::find( basic_cstring<CharT> str ) const
{
if( str.is_empty() || str.size() > size() )
- return (size_type)npos;
+ return static_cast<size_type>(npos);
const_iterator it = begin();
const_iterator last = end() - str.size() + 1;
@@ -526,7 +526,7 @@
++it;
}
- return it == last ? (size_type)npos : it - begin();
+ return it == last ? static_cast<size_type>(npos) : it - begin();
}
//____________________________________________________________________________//
@@ -536,7 +536,7 @@
basic_cstring<CharT>::rfind( basic_cstring<CharT> str ) const
{
if( str.is_empty() || str.size() > size() )
- return (size_type)npos;
+ return reinterpret_cast<size_type>(npos);
const_iterator it = end() - str.size();
const_iterator last = begin()-1;
@@ -687,7 +687,7 @@
{
typedef typename basic_cstring<CharT>::value_type string_value_type;
- return source.is_empty() ? (string_value_type)0 : *source.begin();
+ return source.is_empty() ? static_cast<string_value_type>(0) : *source.begin();
}
//____________________________________________________________________________//
@@ -702,7 +702,7 @@
{
typedef typename basic_cstring<CharT>::value_type string_value_type;
- return source.is_empty() ? (string_value_type)0 : *(source.end()-1);
+ return source.is_empty() ? static_cast<string_value_type>(0) : *(source.end()-1);
}
//____________________________________________________________________________//
Modified: trunk/boost/test/utils/iterator/token_iterator.hpp
==============================================================================
--- trunk/boost/test/utils/iterator/token_iterator.hpp (original)
+++ trunk/boost/test/utils/iterator/token_iterator.hpp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -192,7 +192,7 @@
: m_is_dropped( dt_isspace )
, m_is_kept( dt_ispunct )
, m_keep_empty_tokens( false )
- , m_tokens_left( (std::size_t)-1 )
+ , m_tokens_left( static_cast<std::size_t>(-1) )
, m_token_produced( false )
{
}
Modified: trunk/boost/test/utils/named_params.hpp
==============================================================================
--- trunk/boost/test/utils/named_params.hpp (original)
+++ trunk/boost/test/utils/named_params.hpp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -304,7 +304,7 @@
{
using namespace unit_test;
- assign_op( target, src, (int)0 );
+ assign_op( target, src, static_cast<int>(0) );
}
//____________________________________________________________________________//
Modified: trunk/boost/test/utils/runtime/cla/argument_factory.hpp
==============================================================================
--- trunk/boost/test/utils/runtime/cla/argument_factory.hpp (original)
+++ trunk/boost/test/utils/runtime/cla/argument_factory.hpp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -148,15 +148,15 @@
if( !p.p_multiplicable )
arg.reset( p.p_optional_value && (rtti::type_id<T>() != rtti::type_id<bool>())
- ? (argument*)new typed_argument<boost::optional<T> >( p, value )
- : (argument*)new typed_argument<T>( p, *value ) );
+ ? static_cast<argument*>(new typed_argument<boost::optional<T> >( p, value ))
+ : static_cast<argument*>(new typed_argument<T>( p, *value )) );
else {
typedef std::list<boost::optional<T> > optional_list;
if( !arg )
arg.reset( p.p_optional_value
- ? (argument*)new typed_argument<optional_list>( p )
- : (argument*)new typed_argument<std::list<T> >( p ) );
+ ? static_cast<argument*>(new typed_argument<optional_list>( p ))
+ : static_cast<argument*>(new typed_argument<std::list<T> >( p )) );
if( p.p_optional_value ) {
optional_list& values = arg_value<optional_list>( *arg );
@@ -204,7 +204,7 @@
inline void
typed_argument_factory<T>::argument_usage_info( format_stream& fs )
{
- rt_cla_detail::argument_value_usage( fs, 0, (T*)0 );
+ rt_cla_detail::argument_value_usage( fs, 0, reinterpret_cast<T*>(0) );
}
//____________________________________________________________________________//
Modified: trunk/boost/test/utils/runtime/cla/parser.ipp
==============================================================================
--- trunk/boost/test/utils/runtime/cla/parser.ipp (original)
+++ trunk/boost/test/utils/runtime/cla/parser.ipp 2009-06-06 05:27:18 EDT (Sat, 06 Jun 2009)
@@ -102,7 +102,7 @@
m_program_name.assign( argv[0] );
dstring::size_type pos = m_program_name.find_last_of( BOOST_RT_PARAM_LITERAL( "/\\" ) );
- if( pos != (dstring::size_type)cstring::npos )
+ if( pos != static_cast<dstring::size_type>(cstring::npos) )
m_program_name.erase( 0, pos+1 );
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk