]> git.pld-linux.org Git - packages/boost.git/blob - boost-archive_iterator_segv.patch
- release 4.1.
[packages/boost.git] / boost-archive_iterator_segv.patch
1 --- boost_1_33_1/boost/archive/iterators/escape.hpp.orig        2006-07-20 16:13:40.880579250 +0200
2 +++ boost_1_33_1/boost/archive/iterators/escape.hpp     2006-07-20 16:13:54.897455250 +0200
3 @@ -37,7 +37,8 @@
4          BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type,
5          single_pass_traversal_tag,
6          BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type
7 -    >{
8 +    >
9 +{
10      typedef BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type base_value_type;
11      typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<Base>::type reference_type;
12      friend class boost::iterator_core_access;
13 @@ -53,16 +54,29 @@
14      typedef escape<Derived, Base> this_t;
15  
16      bool equal(const this_t & rhs) const {
17 -        return 
18 -            NULL == m_bnext
19 -            && NULL == m_bend
20 -            && this->base_reference() == rhs.base_reference()
21 -        ;
22 +        if(m_full && ! rhs.m_full)
23 +            rhs.dereference();
24 +        else
25 +        if(! m_full && rhs.m_full)
26 +            dereference();
27 +        if(m_bnext != rhs.m_bnext)
28 +            return false;
29 +        if(this->base_reference() != rhs.base_reference())
30 +            return false;
31 +        return true;
32 +    }
33 +
34 +    reference_type dereference_impl() {
35 +        if(!m_full){
36 +            m_current_value = static_cast<Derived *>(this)->fill(m_bnext, m_bend);
37 +            m_full = true;
38 +        }
39 +        return m_current_value;
40      }
41  
42      //Access the value referred to 
43      reference_type dereference() const {
44 -        return m_current_value;
45 +        return const_cast<this_t *>(this)->dereference_impl();
46      }
47  
48     void increment(){
49 @@ -73,21 +87,21 @@
50          ++(this->base_reference());
51          m_bnext = NULL;
52          m_bend = NULL;
53 -        m_current_value = (static_cast<Derived *>(this))->fill(m_bnext, m_bend);
54 +        m_full = false;
55      }
56  
57      // buffer to handle pending characters
58      const base_value_type *m_bnext;
59      const base_value_type *m_bend;
60 -    BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type m_current_value;
61      bool m_full;
62 +    BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type m_current_value;
63  public:
64      escape(Base base) : 
65          super_t(base),
66          m_bnext(NULL),
67 -        m_bend(NULL)
68 +        m_bend(NULL),
69 +        m_full(false)
70      {
71 -        m_current_value = static_cast<Derived *>(this)->fill(m_bnext, m_bend);
72      }
73  };
74  
This page took 0.165463 seconds and 3 git commands to generate.