Ticket #3032: boost-01.patch

File boost-01.patch, 9.1 KB (added by gerickson@…, 13 years ago)

Patch for Boost::Fusion -Wshadow and -Wunused Errors

  • boost/circular_buffer/base.hpp

    a b  
    10061006        \par Complexity
    10071007             Constant.
    10081008    */
    1009     explicit circular_buffer(capacity_type capacity, const allocator_type& alloc = allocator_type())
     1009    explicit circular_buffer(capacity_type in_capacity, const allocator_type& alloc = allocator_type())
    10101010    : m_size(0), m_alloc(alloc) {
    1011         initialize_buffer(capacity);
     1011        initialize_buffer(in_capacity);
    10121012        m_first = m_last = m_buff;
    10131013    }
    10141014
     
    10461046        \par Complexity
    10471047             Linear (in the <code>n</code>).
    10481048    */
    1049     circular_buffer(capacity_type capacity, size_type n, param_value_type item,
     1049    circular_buffer(capacity_type in_capacity, size_type n, param_value_type item,
    10501050        const allocator_type& alloc = allocator_type())
    10511051    : m_size(n), m_alloc(alloc) {
    1052         BOOST_CB_ASSERT(capacity >= size()); // check for capacity lower than size
    1053         initialize_buffer(capacity, item);
     1052        BOOST_CB_ASSERT(in_capacity >= size()); // check for capacity lower than size
     1053        initialize_buffer(in_capacity, item);
    10541054        m_first = m_buff;
    1055         m_last = capacity == n ? m_buff : m_buff + n;
     1055        m_last = in_capacity == n ? m_buff : m_buff + n;
    10561056    }
    10571057
    10581058    //! The copy constructor.
     
    11451145             <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
    11461146    */
    11471147    template <class InputIterator>
    1148     circular_buffer(capacity_type capacity, InputIterator first, InputIterator last,
     1148    circular_buffer(capacity_type in_capacity, InputIterator first, InputIterator last,
    11491149        const allocator_type& alloc = allocator_type())
    11501150    : m_alloc(alloc) {
    1151         initialize(capacity, first, last, is_integral<InputIterator>());
     1151        initialize(in_capacity, first, last, is_integral<InputIterator>());
    11521152    }
    11531153
    11541154#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
     
    12601260            assign(size_type, const_reference)\endlink</code>, <code>assign(InputIterator, InputIterator)</code>,
    12611261            <code>assign(capacity_type, InputIterator, InputIterator)</code>
    12621262    */
    1263     void assign(capacity_type capacity, size_type n, param_value_type item) {
    1264         BOOST_CB_ASSERT(capacity >= n); // check for new capacity lower than n
    1265         assign_n(capacity, n, cb_details::assign_n<param_value_type, allocator_type>(n, item, m_alloc));
     1263    void assign(capacity_type in_capacity, size_type n, param_value_type item) {
     1264        BOOST_CB_ASSERT(in_capacity >= n); // check for new capacity lower than n
     1265        assign_n(in_capacity, n, cb_details::assign_n<param_value_type, allocator_type>(n, item, m_alloc));
    12661266    }
    12671267
    12681268    //! Assign a copy of the range into the <code>circular_buffer</code>.
     
    13331333            <code>assign(InputIterator, InputIterator)</code>
    13341334    */
    13351335    template <class InputIterator>
    1336     void assign(capacity_type capacity, InputIterator first, InputIterator last) {
    1337         assign(capacity, first, last, is_integral<InputIterator>());
     1336    void assign(capacity_type in_capacity, InputIterator first, InputIterator last) {
     1337        assign(in_capacity, first, last, is_integral<InputIterator>());
    13381338    }
    13391339
    13401340    //! Swap the contents of two <code>circular_buffer</code>s.
     
    20792079    }
    20802080
    20812081    //! Initialize the internal buffer.
    2082     void initialize_buffer(capacity_type capacity) {
    2083         m_buff = allocate(capacity);
    2084         m_end = m_buff + capacity;
     2082    void initialize_buffer(capacity_type in_capacity) {
     2083        m_buff = allocate(in_capacity);
     2084        m_end = m_buff + in_capacity;
    20852085    }
    20862086
    20872087    //! Initialize the internal buffer.
    2088     void initialize_buffer(capacity_type capacity, param_value_type item) {
    2089         initialize_buffer(capacity);
     2088    void initialize_buffer(capacity_type in_capacity, param_value_type item) {
     2089        initialize_buffer(in_capacity);
    20902090        BOOST_TRY {
    20912091            cb_details::uninitialized_fill_n_with_alloc(m_buff, size(), item, m_alloc);
    20922092        } BOOST_CATCH(...) {
     
    21352135
    21362136    //! Specialized initialize method.
    21372137    template <class IntegralType>
    2138     void initialize(capacity_type capacity, IntegralType n, IntegralType item, const true_type&) {
    2139         BOOST_CB_ASSERT(capacity >= static_cast<size_type>(n)); // check for capacity lower than n
     2138    void initialize(capacity_type in_capacity, IntegralType n, IntegralType item, const true_type&) {
     2139        BOOST_CB_ASSERT(in_capacity >= static_cast<size_type>(n)); // check for capacity lower than n
    21402140        m_size = static_cast<size_type>(n);
    2141         initialize_buffer(capacity, item);
     2141        initialize_buffer(in_capacity, item);
    21422142        m_first = m_buff;
    2143         m_last = capacity == size() ? m_buff : m_buff + size();
     2143        m_last = in_capacity == size() ? m_buff : m_buff + size();
    21442144    }
    21452145
    21462146    //! Specialized initialize method.
    21472147    template <class Iterator>
    2148     void initialize(capacity_type capacity, Iterator first, Iterator last, const false_type&) {
     2148    void initialize(capacity_type in_capacity, Iterator first, Iterator last, const false_type&) {
    21492149        BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
    21502150#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
    2151         initialize(capacity, first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
     2151        initialize(in_capacity, first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
    21522152#else
    2153         initialize(capacity, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
     2153        initialize(in_capacity, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
    21542154#endif
    21552155    }
    21562156
    21572157    //! Specialized initialize method.
    21582158    template <class InputIterator>
    2159     void initialize(capacity_type capacity,
     2159    void initialize(capacity_type in_capacity,
    21602160        InputIterator first,
    21612161        InputIterator last,
    21622162        const std::input_iterator_tag&) {
    2163         initialize_buffer(capacity);
     2163        initialize_buffer(in_capacity);
    21642164        m_first = m_last = m_buff;
    21652165        m_size = 0;
    2166         if (capacity == 0)
     2166        if (in_capacity == 0)
    21672167            return;
    21682168        while (first != last && !full()) {
    21692169            m_alloc.construct(m_last, *first++);
     
    21792179
    21802180    //! Specialized initialize method.
    21812181    template <class ForwardIterator>
    2182     void initialize(capacity_type capacity,
     2182    void initialize(capacity_type in_capacity,
    21832183        ForwardIterator first,
    21842184        ForwardIterator last,
    21852185        const std::forward_iterator_tag&) {
    21862186        BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range
    2187         initialize(capacity, first, last, std::distance(first, last));
     2187        initialize(in_capacity, first, last, std::distance(first, last));
    21882188    }
    21892189
    21902190    //! Initialize the circular buffer.
    21912191    template <class ForwardIterator>
    2192     void initialize(capacity_type capacity,
     2192    void initialize(capacity_type in_capacity,
    21932193        ForwardIterator first,
    21942194        ForwardIterator last,
    21952195        size_type distance) {
    2196         initialize_buffer(capacity);
     2196        initialize_buffer(in_capacity);
    21972197        m_first = m_buff;
    2198         if (distance > capacity) {
    2199             std::advance(first, distance - capacity);
    2200             m_size = capacity;
     2198        if (distance > in_capacity) {
     2199            std::advance(first, distance - in_capacity);
     2200            m_size = in_capacity;
    22012201        } else {
    22022202            m_size = distance;
    22032203        }
    22042204        BOOST_TRY {
    22052205            m_last = cb_details::uninitialized_copy_with_alloc(first, last, m_buff, m_alloc);
    22062206        } BOOST_CATCH(...) {
    2207             deallocate(m_buff, capacity);
     2207            deallocate(m_buff, in_capacity);
    22082208            BOOST_RETHROW
    22092209        }
    22102210        BOOST_CATCH_END
  • boost/circular_buffer/details.hpp

    a b  
    146146public:
    147147
    148148    //! Constructor.
    149     capacity_control(Size capacity, Size min_capacity = 0)
    150     : m_capacity(capacity), m_min_capacity(min_capacity) {
    151         BOOST_CB_ASSERT(capacity >= min_capacity); // check for capacity lower than min_capacity
     149    capacity_control(Size in_capacity, Size in_min_capacity = 0)
     150    : m_capacity(in_capacity), m_min_capacity(in_min_capacity) {
     151        BOOST_CB_ASSERT(in_capacity >= in_min_capacity); // check for capacity lower than min_capacity
    152152    }
    153153
    154154    // Default copy constructor.
  • boost/circular_buffer/space_optimized.hpp

    a b  
    12291229    }
    12301230
    12311231    //! Ensure the reserve for possible growth up.
    1232     size_type ensure_reserve(size_type new_capacity, size_type size) const {
    1233         if (size + new_capacity / 5 >= new_capacity)
     1232    size_type ensure_reserve(size_type new_capacity, size_type in_size) const {
     1233        if (in_size + new_capacity / 5 >= new_capacity)
    12341234            new_capacity *= 2; // ensure at least 20% reserve
    12351235        if (new_capacity > m_capacity_ctrl)
    12361236            return m_capacity_ctrl;