Ticket #5995: old-style-cast.patch

File old-style-cast.patch, 12.7 KB (added by Shuo Chen <giantchen@…>, 11 years ago)
  • boost/circular_buffer/debug.hpp

     
    130130    void invalidate_iterators(const Iterator& it) {
    131131        const debug_iterator_base* previous = 0;
    132132        for (const debug_iterator_base* p = m_iterators; p != 0; p = p->next()) {
    133             if (((Iterator*)p)->m_it == it.m_it) {
     133            if ((static_cast<const Iterator*>(p))->m_it == it.m_it) {
    134134                p->invalidate();
    135135                remove(p, previous);
    136136                continue;
     
    144144    void invalidate_iterators_except(const Iterator& it) {
    145145        const debug_iterator_base* previous = 0;
    146146        for (const debug_iterator_base* p = m_iterators; p != 0; p = p->next()) {
    147             if (((Iterator*)p)->m_it != it.m_it) {
     147            if ((static_cast<Iterator*>(p))->m_it != it.m_it) {
    148148                p->invalidate();
    149149                remove(p, previous);
    150150                continue;
  • boost/function/function_template.hpp

     
    625625        assign_to(const reference_wrapper<FunctionObj>& f,
    626626                  function_buffer& functor, function_obj_ref_tag) const
    627627        {
    628           functor.obj_ref.obj_ptr = (void *)(f.get_pointer());
     628          functor.obj_ref.obj_ptr = static_cast<void *>(f.get_pointer());
    629629          functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
    630630          functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
    631631          return true;
  • boost/ptr_container/ptr_sequence_adapter.hpp

     
    427427                       BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator last,
    428428                       PtrSeqAdapter& from ) // strong
    429429        {
    430             BOOST_ASSERT( (void*)&from != (void*)this );
     430            BOOST_ASSERT( static_cast<void*>(&from) != static_cast<void*>(this) );
    431431            if( from.empty() )
    432432                return;
    433433            this->base().
     
    440440                       BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator object,
    441441                       PtrSeqAdapter& from ) // strong
    442442        {
    443             BOOST_ASSERT( (void*)&from != (void*)this );
     443            BOOST_ASSERT( static_cast<void*>(&from) != static_cast<void*>(this) );
    444444            if( from.empty() )
    445445                return;
    446446            this->base().insert( before.base(), *object.base() ); // strong
     
    462462        template< class PtrSeqAdapter >
    463463        void transfer( iterator before, PtrSeqAdapter& from ) // strong
    464464        {
    465             BOOST_ASSERT( (void*)&from != (void*)this );
     465            BOOST_ASSERT( static_cast<void*>(&from) != static_cast<void*>(this) );
    466466            if( from.empty() )
    467467                return;
    468468            this->base().
  • boost/unordered/detail/buckets.hpp

     
    583583
    584584        void construct(bool which, H const& hf, P const& eq)
    585585        {
    586             new((void*) &funcs_[which]) function_pair(hf, eq);
     586            new(static_cast<void*> (&funcs_[which])) function_pair(hf, eq);
    587587        }
    588588
    589589        void construct(bool which, function_pair const& f)
    590590        {
    591             new((void*) &funcs_[which]) function_pair(f);
     591            new(static_cast<void*> (&funcs_[which])) function_pair(f);
    592592        }
    593593       
    594594        void destroy(bool which)
    595595        {
    596             boost::unordered::detail::destroy((function_pair*)(&funcs_[which]));
     596            boost::unordered::detail::destroy(reinterpret_cast<function_pair*>(&funcs_[which]));
    597597        }
    598598       
    599599    public:
  • boost/unordered/detail/allocator_helpers.hpp

     
    444444                boost::unordered::detail::has_construct<Alloc, T>::value>::type
    445445            construct(Alloc&, T* p, T const& x)
    446446        {
    447             new ((void*) p) T(x);
     447            new (static_cast<void*>(p)) T(x);
    448448        }
    449449
    450450        template <typename T>
  • boost/unordered/detail/emplace_args.hpp

     
    178178    template<typename T>                                                    \
    179179    void construct_from_tuple(T* ptr, namespace_::tuple<>)                  \
    180180    {                                                                       \
    181         new ((void*) ptr) T();                                              \
     181        new (static_cast<void*> (ptr)) T();                                 \
    182182    }                                                                       \
    183183                                                                            \
    184184    BOOST_PP_REPEAT_FROM_TO(1, n,                                           \
     
    189189    void construct_from_tuple(T* ptr,                                       \
    190190            namespace_::tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x)    \
    191191    {                                                                       \
    192         new ((void*) ptr) T(                                                \
     192        new (static_cast<void*> (ptr)) T(                                   \
    193193            BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_) \
    194194        );                                                                  \
    195195    }
     
    332332            BOOST_PP_ENUM_PARAMS_Z(z, num_params, A)                        \
    333333        > const& args)                                                      \
    334334    {                                                                       \
    335         new((void*) address) T(                                             \
     335        new(static_cast<void*> (address)) T(                                \
    336336            BOOST_PP_ENUM_##z(num_params, BOOST_UNORDERED_CALL_FORWARD,     \
    337337                args.a));                                                   \
    338338    }
     
    408408    template <typename T, typename A0>
    409409    inline void construct_impl2(T* address, BOOST_FWD_REF(A0) a0)
    410410    {
    411         new((void*) address) T(
     411        new(static_cast<void*> (address)) T(
    412412            boost::forward<A0>(a0)
    413413        );
    414414    }
  • boost/unordered/detail/table.hpp

     
    285285        }
    286286
    287287        value_type& value() {
    288             return *(ValueType*) this;
     288            return *value_ptr();
    289289        }
    290290
    291291        value_type* value_ptr() {
    292             return (ValueType*) this;
     292            return reinterpret_cast<ValueType*> (this);
    293293        }
    294294
    295295    private:
  • boost/mpl/assert.hpp

     
    219219      std::size_t \
    220220    , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
    221221          boost::mpl::assertion_failed<false>( \
    222               boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
     222              boost::mpl::assert_arg( static_cast<void (*) pred>(0), 1 ) \
    223223            ) \
    224224        ) \
    225225    ) \
     
    243243      std::size_t \
    244244    , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
    245245          boost::mpl::assertion_failed<false>( \
    246               boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
     246              boost::mpl::assert_not_arg( static_cast<void (*) pred>(0), 1 ) \
    247247            ) \
    248248        ) \
    249249   ) \
     
    262262      std::size_t \
    263263    , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
    264264        boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
    265             (boost::mpl::failed ************ ( boost::mpl::assert_relation< \
     265            static_cast<boost::mpl::failed ************ ( boost::mpl::assert_relation< \
    266266                  boost::mpl::assert_::relations( sizeof( \
    267267                      boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
    268268                    ) ) \
    269269                , x \
    270270                , y \
    271                 >::************)) 0 ) \
     271                >::************)> (0) ) \
    272272        ) \
    273273    ) \
    274274/**/
  • boost/functional/hash/detail/hash_float.hpp

     
    6666            case FP_ZERO:
    6767                return 0;
    6868            case FP_INFINITE:
    69                 return (std::size_t)(v > 0 ? -1 : -2);
     69                return static_cast<std::size_t>(v > 0 ? -1 : -2);
    7070            case FP_NAN:
    71                 return (std::size_t)(-3);
     71                return static_cast<std::size_t>(-3);
    7272            case FP_NORMAL:
    7373            case FP_SUBNORMAL:
    7474                return float_hash_impl(v);
  • boost/functional/hash/hash.hpp

     
    113113             // Hopefully, this loop can be unrolled.
    114114             for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
    115115             {
    116                  seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2);
     116                 seed ^= static_cast<std::size_t> (positive >> i) + (seed<<6) + (seed>>2);
    117117             }
    118              seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
     118             seed ^= static_cast<std::size_t> (val) + (seed<<6) + (seed>>2);
    119119
    120120             return seed;
    121121        }
     
    133133             // Hopefully, this loop can be unrolled.
    134134             for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
    135135             {
    136                  seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2);
     136                 seed ^= static_cast<std::size_t> (val >> i) + (seed<<6) + (seed>>2);
    137137             }
    138              seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
     138             seed ^= static_cast<std::size_t> (val) + (seed<<6) + (seed>>2);
    139139
    140140             return seed;
    141141        }
  • boost/concept/detail/general.hpp

     
    2727template <class Model>
    2828struct requirement
    2929{
    30     static void failed() { ((Model*)0)->~Model(); }
     30    static void failed() { (static_cast<Model*>(0))->~Model(); }
    3131};
    3232
    3333struct failed {};
     
    3535template <class Model>
    3636struct requirement<failed ************ Model::************>
    3737{
    38     static void failed() { ((Model*)0)->~Model(); }
     38    static void failed() { (static_cast<Model*>(0))->~Model(); }
    3939};
    4040
    4141# ifdef BOOST_OLD_CONCEPT_SUPPORT
     
    4343template <class Model>
    4444struct constraint
    4545{
    46     static void failed() { ((Model*)0)->constraints(); }
     46    static void failed() { (static_cast<Model*>(0))->constraints(); }
    4747};
    4848 
    4949template <class Model>
  • boost/concept/detail/has_constraints.hpp

     
    4141{
    4242    BOOST_STATIC_CONSTANT(
    4343        bool
    44       , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) );
     44      , value = sizeof( detail::has_constraints_(static_cast<Model*>(0)) ) == sizeof(detail::yes) );
    4545    typedef mpl::bool_<value> type;
    4646};
    4747
  • boost/concept/usage.hpp

     
    1919template <class Model>
    2020struct usage_requirements
    2121{
    22     ~usage_requirements() { ((Model*)0)->~Model(); }
     22    ~usage_requirements() { (static_cast<Model*>(0))->~Model(); }
    2323};
    2424
    2525#  if BOOST_WORKAROUND(__GNUC__, <= 3)