File liborigin-200080225-gcc.patch of Package liborigin

Index: liborigin-20080225/tree.hh
===================================================================
--- liborigin-20080225.orig/tree.hh
+++ liborigin-20080225/tree.hh
@@ -1,4 +1,4 @@
-/* 
+/*
 
    $Id: tree.hh,v 1.147 2007/10/19 11:24:24 peekas Exp $
 
@@ -19,7 +19,7 @@
    nodes. Various types of iterators are provided (post-order,
    pre-order, and others). Where possible the access methods are
    compatible with the STL or alternative algorithms are
-   available. 
+   available.
 */
 
 
@@ -27,18 +27,18 @@
    The tree.hh code is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; version 2 or 3.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
-/** \todo 
+/** \todo
    - New-style move members are not completely finished yet.
    - It would be good to have an iterator which can iterate over all
      nodes below a given node.
@@ -53,7 +53,7 @@
      sit next to each other. Turned up in append_child(iter,iter)
      but has been avoided now.
    - "std::operator<" does not work correctly on our iterators, and for some
-     reason a globally defined template operator< did not get picked up. 
+     reason a globally defined template operator< did not get picked up.
      Using a comparison class now, but this should be investigated.
 */
 
@@ -61,6 +61,7 @@
 #define tree_hh_
 
 #include <cassert>
+#include <cstddef>
 #include <memory>
 #include <stdexcept>
 #include <iterator>
@@ -74,13 +75,13 @@
 namespace kp {
 
 template <class T1, class T2>
-void constructor(T1* p, T2& val) 
+void constructor(T1* p, T2& val)
    {
    new ((void *) p) T1(val);
    }
 
 template <class T1>
-void constructor(T1* p) 
+void constructor(T1* p)
    {
    new ((void *) p) T1;
    }
@@ -158,7 +159,7 @@ class tree {
       };
 
       /// Depth-first iterator, first accessing the node, then its children.
-      class pre_order_iterator : public iterator_base { 
+      class pre_order_iterator : public iterator_base {
          public:
             pre_order_iterator();
             pre_order_iterator(tree_node *);
@@ -325,8 +326,8 @@ class tree {
       void     erase_children(const iterator_base&);
 
       /// Insert empty node as last/first child of node pointed to by position.
-      template<typename iter> iter append_child(iter position); 
-      template<typename iter> iter prepend_child(iter position); 
+      template<typename iter> iter append_child(iter position);
+      template<typename iter> iter prepend_child(iter position);
       /// Insert node as last/first child of node pointed to by position.
       template<typename iter> iter append_child(iter position, const T& x);
       template<typename iter> iter prepend_child(iter position, const T& x);
@@ -355,8 +356,8 @@ class tree {
       /// Replace node at 'position' with subtree starting at 'from' (do not erase subtree at 'from'); see above.
       template<typename iter> iter replace(iter position, const iterator_base& from);
       /// Replace string of siblings (plus their children) with copy of a new string (with children); see above
-      sibling_iterator replace(sibling_iterator orig_begin, sibling_iterator orig_end, 
-                               sibling_iterator new_begin,  sibling_iterator new_end); 
+      sibling_iterator replace(sibling_iterator orig_begin, sibling_iterator orig_end,
+                               sibling_iterator new_begin,  sibling_iterator new_end);
 
       /// Move all children of node at 'position' to be siblings, returns position.
       template<typename iter> iter flatten(iter position);
@@ -377,7 +378,7 @@ class tree {
       template<typename iter> iter move_ontop(iter target, iter source);
 
       /// Merge with other tree, creating new branches and leaves only if they are not already present.
-      void     merge(sibling_iterator, sibling_iterator, sibling_iterator, sibling_iterator, 
+      void     merge(sibling_iterator, sibling_iterator, sibling_iterator, sibling_iterator,
                      bool duplicate_leaves=false);
       /// Sort (std::sort only moves values of nodes, this one moves children as well).
       void     sort(sibling_iterator from, sibling_iterator to, bool deep=false);
@@ -399,7 +400,7 @@ class tree {
       void     swap(sibling_iterator it);
       /// Exchange two nodes (plus subtrees)
       void     swap(iterator, iterator);
-      
+
       /// Count the total number of nodes.
       int      size() const;
       /// Count the total number of nodes below the indicated node (plus one).
@@ -417,7 +418,7 @@ class tree {
       /// Count the number of 'next' siblings of node at iterator.
       unsigned int number_of_siblings(const iterator_base&) const;
       /// Determine whether node at position is in the subtrees with root in the range.
-      bool     is_in_subtree(const iterator_base& position, const iterator_base& begin, 
+      bool     is_in_subtree(const iterator_base& position, const iterator_base& begin,
                              const iterator_base& end) const;
       /// Determine whether the iterator is an 'end' iterator and thus not actually pointing to a node.
       bool     is_valid(const iterator_base&) const;
@@ -426,7 +427,7 @@ class tree {
       unsigned int index(sibling_iterator it) const;
       /// Inverse of 'index': return the n-th child of the node at position.
       sibling_iterator  child(const iterator_base& position, unsigned int) const;
-      
+
       /// Comparator class for iterators (compares pointer values; why doesn't this work automatically?)
       class iterator_base_less {
          public:
@@ -447,8 +448,8 @@ class tree {
       class compare_nodes {
          public:
             compare_nodes(StrictWeakOrdering comp) : comp_(comp) {};
-            
-            bool operator()(const tree_node *a, const tree_node *b) 
+
+            bool operator()(const tree_node *a, const tree_node *b)
                {
                static StrictWeakOrdering comp;
                return comp(a->data, b->data);
@@ -477,7 +478,7 @@ class tree {
 //    if(one.node < two.node) return true;
 //    return false;
 //    }
-// 
+//
 // template <class T, class tree_node_allocator>
 // bool operator==(const typename tree<T, tree_node_allocator>::iterator& one,
 //                const typename tree<T, tree_node_allocator>::iterator& two)
@@ -486,7 +487,7 @@ class tree {
 //    if(one.node == two.node) return true;
 //    return false;
 //    }
-// 
+//
 // template <class T, class tree_node_allocator>
 // bool operator>(const typename tree<T, tree_node_allocator>::iterator_base& one,
 //                const typename tree<T, tree_node_allocator>::iterator_base& two)
@@ -501,13 +502,13 @@ class tree {
 // Tree
 
 template <class T, class tree_node_allocator>
-tree<T, tree_node_allocator>::tree() 
+tree<T, tree_node_allocator>::tree()
    {
    head_initialise_();
    }
 
 template <class T, class tree_node_allocator>
-tree<T, tree_node_allocator>::tree(const T& x) 
+tree<T, tree_node_allocator>::tree(const T& x)
    {
    head_initialise_();
    set_head(x);
@@ -530,9 +531,9 @@ tree<T, tree_node_allocator>::~tree()
    }
 
 template <class T, class tree_node_allocator>
-void tree<T, tree_node_allocator>::head_initialise_() 
-   { 
-   head = alloc_.allocate(1,0); // MSVC does not have default second argument 
+void tree<T, tree_node_allocator>::head_initialise_()
+   {
+   head = alloc_.allocate(1,0); // MSVC does not have default second argument
    feet = alloc_.allocate(1,0);
 
    head->parent=0;
@@ -562,7 +563,7 @@ tree<T, tree_node_allocator>::tree(const
    }
 
 template <class T, class tree_node_allocator>
-void tree<T, tree_node_allocator>::copy_(const tree<T, tree_node_allocator>& other) 
+void tree<T, tree_node_allocator>::copy_(const tree<T, tree_node_allocator>& other)
    {
    clear();
    pre_order_iterator it=other.begin(), to=begin();
@@ -590,7 +591,7 @@ void tree<T, tree_node_allocator>::clear
          erase(pre_order_iterator(head->next_sibling));
    }
 
-template<class T, class tree_node_allocator> 
+template<class T, class tree_node_allocator>
 void tree<T, tree_node_allocator>::erase_children(const iterator_base& it)
    {
 // std::cout << "erase_children " << it.node << std::endl;
@@ -611,7 +612,7 @@ void tree<T, tree_node_allocator>::erase
 // std::cout << "exit" << std::endl;
    }
 
-template<class T, class tree_node_allocator> 
+template<class T, class tree_node_allocator>
 template<class iter>
 iter tree<T, tree_node_allocator>::erase(iter it)
    {
@@ -691,7 +692,7 @@ typename tree<T, tree_node_allocator>::f
             // try to walk up and then right again
             do {
                tmp=tmp->parent;
-               if(tmp==0) 
+               if(tmp==0)
                   throw std::range_error("tree: begin_fixed out of range");
                --curdepth;
                } while(tmp->next_sibling==0);
@@ -707,7 +708,7 @@ typename tree<T, tree_node_allocator>::f
 template <class T, class tree_node_allocator>
 typename tree<T, tree_node_allocator>::fixed_depth_iterator tree<T, tree_node_allocator>::end_fixed(const iterator_base& pos, unsigned int dp) const
    {
-   assert(1==0); // FIXME: not correct yet: use is_valid() as a temporary workaround 
+   assert(1==0); // FIXME: not correct yet: use is_valid() as a temporary workaround
    tree_node *tmp=pos.node;
    unsigned int curdepth=1;
    while(curdepth<dp) { // go down one level
@@ -759,7 +760,7 @@ typename tree<T, tree_node_allocator>::l
 
 template <class T, class tree_node_allocator>
 template <typename iter>
-iter tree<T, tree_node_allocator>::parent(iter position) 
+iter tree<T, tree_node_allocator>::parent(iter position)
    {
    assert(position.node!=0);
    return iter(position.node->parent);
@@ -795,7 +796,7 @@ iter tree<T, tree_node_allocator>::next_
    if(position.node->next_sibling) {
       ret.node=position.node->next_sibling;
       }
-   else { 
+   else {
       int relative_depth=0;
       upper:
       do {
@@ -1118,7 +1119,7 @@ iter tree<T, tree_node_allocator>::repla
 
    // replace the node at position with head of the replacement tree at from
 // std::cout << "warning!" << position.node << std::endl;
-   erase_children(position);  
+   erase_children(position);
 // std::cout << "no warning!" << std::endl;
    tree_node* tmp = alloc_.allocate(1,0);
    kp::constructor(&tmp->data, (*from));
@@ -1144,7 +1145,7 @@ iter tree<T, tree_node_allocator>::repla
    kp::destructor(&current_to->data);
    alloc_.deallocate(current_to,1);
    current_to=tmp;
-   
+
    // only at this stage can we fix 'last'
    tree_node *last=from.node->next_sibling;
 
@@ -1174,9 +1175,9 @@ iter tree<T, tree_node_allocator>::repla
 
 template <class T, class tree_node_allocator>
 typename tree<T, tree_node_allocator>::sibling_iterator tree<T, tree_node_allocator>::replace(
-   sibling_iterator orig_begin, 
-   sibling_iterator orig_end, 
-   sibling_iterator new_begin, 
+   sibling_iterator orig_begin,
+   sibling_iterator orig_end,
+   sibling_iterator new_begin,
    sibling_iterator new_end)
    {
    tree_node *orig_first=orig_begin.node;
@@ -1206,11 +1207,11 @@ typename tree<T, tree_node_allocator>::s
    bool last=false;
    tree_node *next=orig_first;
    while(1==1) {
-      if(next==orig_last) 
+      if(next==orig_last)
          last=true;
       next=next->next_sibling;
       erase((pre_order_iterator)orig_first);
-      if(last) 
+      if(last)
          break;
       orig_first=next;
       }
@@ -1228,7 +1229,7 @@ iter tree<T, tree_node_allocator>::flatt
    while(tmp) {
       tmp->parent=position.node->parent;
       tmp=tmp->next_sibling;
-      } 
+      }
    if(position.node->next_sibling) {
       position.node->last_child->next_sibling=position.node->next_sibling;
       position.node->next_sibling->prev_sibling=position.node->last_child;
@@ -1253,7 +1254,7 @@ iter tree<T, tree_node_allocator>::repar
    tree_node *last=first;
 
    assert(first!=position.node);
-   
+
    if(begin==end) return begin;
    // determine last node
    while((++begin)!=end) {
@@ -1372,7 +1373,7 @@ template <typename iter> iter tree<T, tr
 
 // specialisation for sibling_iterators
 template <class T, class tree_node_allocator>
-typename tree<T, tree_node_allocator>::sibling_iterator tree<T, tree_node_allocator>::move_before(sibling_iterator target, 
+typename tree<T, tree_node_allocator>::sibling_iterator tree<T, tree_node_allocator>::move_before(sibling_iterator target,
                                                                                          sibling_iterator source)
    {
    tree_node *dst=target.node;
@@ -1476,7 +1477,7 @@ void tree<T, tree_node_allocator>::sort(
 
 template <class T, class tree_node_allocator>
 template <class StrictWeakOrdering>
-void tree<T, tree_node_allocator>::sort(sibling_iterator from, sibling_iterator to, 
+void tree<T, tree_node_allocator>::sort(sibling_iterator from, sibling_iterator to,
                                         StrictWeakOrdering comp, bool deep)
    {
    if(from==to) return;
@@ -1561,7 +1562,7 @@ bool tree<T, tree_node_allocator>::equal
    while(one!=two && is_valid(three)) {
       if(!fun(*one,*three))
          return false;
-      if(one.number_of_children()!=three.number_of_children()) 
+      if(one.number_of_children()!=three.number_of_children())
          return false;
       ++one;
       ++three;
@@ -1671,15 +1672,15 @@ int tree<T, tree_node_allocator>::max_de
       tmp=tmp->first_child;
       ++curdepth;
       maxdepth=std::max(curdepth, maxdepth);
-      } 
+      }
    }
 
 template <class T, class tree_node_allocator>
-unsigned int tree<T, tree_node_allocator>::number_of_children(const iterator_base& it) 
+unsigned int tree<T, tree_node_allocator>::number_of_children(const iterator_base& it)
    {
    tree_node *pos=it.node->first_child;
    if(pos==0) return 0;
-   
+
    unsigned int ret=1;
 //   while(pos!=it.node->last_child) {
 //      ++ret;
@@ -1696,7 +1697,7 @@ unsigned int tree<T, tree_node_allocator
    tree_node *pos=it.node;
    unsigned int ret=0;
    // count forward
-   while(pos->next_sibling && 
+   while(pos->next_sibling &&
          pos->next_sibling!=head &&
          pos->next_sibling!=feet) {
       ++ret;
@@ -1704,13 +1705,13 @@ unsigned int tree<T, tree_node_allocator
       }
    // count backward
    pos=it.node;
-   while(pos->prev_sibling && 
+   while(pos->prev_sibling &&
          pos->prev_sibling!=head &&
          pos->prev_sibling!=feet) {
       ++ret;
       pos=pos->prev_sibling;
       }
-   
+
    return ret;
    }
 
@@ -1756,7 +1757,7 @@ void tree<T, tree_node_allocator>::swap(
       else     par2->last_child=one.node;
       one.node->prev_sibling=pre2;
       if(pre2) pre2->next_sibling=one.node;
-      else     par2->first_child=one.node;    
+      else     par2->first_child=one.node;
 
       two.node->parent=par1;
       two.node->next_sibling=nxt1;
@@ -1770,20 +1771,20 @@ void tree<T, tree_node_allocator>::swap(
 
 // template <class BinaryPredicate>
 // tree<T, tree_node_allocator>::iterator tree<T, tree_node_allocator>::find_subtree(
-//    sibling_iterator subfrom, sibling_iterator subto, iterator from, iterator to, 
+//    sibling_iterator subfrom, sibling_iterator subto, iterator from, iterator to,
 //    BinaryPredicate fun) const
 //    {
 //    assert(1==0); // this routine is not finished yet.
 //    while(from!=to) {
 //       if(fun(*subfrom, *from)) {
-//          
+//
 //          }
 //       }
 //    return to;
 //    }
 
 template <class T, class tree_node_allocator>
-bool tree<T, tree_node_allocator>::is_in_subtree(const iterator_base& it, const iterator_base& begin, 
+bool tree<T, tree_node_allocator>::is_in_subtree(const iterator_base& it, const iterator_base& begin,
                                                  const iterator_base& end) const
    {
    // FIXME: this should be optimised.
@@ -1921,7 +1922,7 @@ bool tree<T, tree_node_allocator>::leaf_
 template <class T, class tree_node_allocator>
 typename tree<T, tree_node_allocator>::sibling_iterator tree<T, tree_node_allocator>::iterator_base::begin() const
    {
-   if(node->first_child==0) 
+   if(node->first_child==0)
       return end();
 
    sibling_iterator ret(node->first_child);
@@ -1948,7 +1949,7 @@ unsigned int tree<T, tree_node_allocator
    {
    tree_node *pos=node->first_child;
    if(pos==0) return 0;
-   
+
    unsigned int ret=1;
    while(pos!=node->last_child) {
       ++ret;
@@ -1962,7 +1963,7 @@ unsigned int tree<T, tree_node_allocator
 // Pre-order iterator
 
 template <class T, class tree_node_allocator>
-tree<T, tree_node_allocator>::pre_order_iterator::pre_order_iterator() 
+tree<T, tree_node_allocator>::pre_order_iterator::pre_order_iterator()
    : iterator_base(0)
    {
    }
@@ -1986,7 +1987,7 @@ tree<T, tree_node_allocator>::pre_order_
    if(this->node==0) {
       if(other.range_last()!=0)
          this->node=other.range_last();
-      else 
+      else
          this->node=other.parent_;
       this->skip_children();
       ++(*this);
@@ -2070,7 +2071,7 @@ typename tree<T, tree_node_allocator>::p
 // Post-order iterator
 
 template <class T, class tree_node_allocator>
-tree<T, tree_node_allocator>::post_order_iterator::post_order_iterator() 
+tree<T, tree_node_allocator>::post_order_iterator::post_order_iterator()
    : iterator_base(0)
    {
    }
@@ -2094,7 +2095,7 @@ tree<T, tree_node_allocator>::post_order
    if(this->node==0) {
       if(other.range_last()!=0)
          this->node=other.range_last();
-      else 
+      else
          this->node=other.parent_;
       this->skip_children();
       ++(*this);
@@ -2234,7 +2235,7 @@ typename tree<T, tree_node_allocator>::b
    traversal_queue.pop();
    if(traversal_queue.size()>0)
       this->node=traversal_queue.front();
-   else 
+   else
       this->node=0;
    return (*this);
    }
@@ -2342,7 +2343,7 @@ typename tree<T, tree_node_allocator>::f
    if(this->node->next_sibling) {
       this->node=this->node->next_sibling;
       }
-   else { 
+   else {
       int relative_depth=0;
       upper:
       do {
@@ -2455,7 +2456,7 @@ typename tree<T, tree_node_allocator>::f
 // Sibling iterator
 
 template <class T, class tree_node_allocator>
-tree<T, tree_node_allocator>::sibling_iterator::sibling_iterator() 
+tree<T, tree_node_allocator>::sibling_iterator::sibling_iterator()
    : iterator_base()
    {
    set_parent_();
@@ -2561,7 +2562,7 @@ typename tree<T, tree_node_allocator>::t
 // Leaf iterator
 
 template <class T, class tree_node_allocator>
-tree<T, tree_node_allocator>::leaf_iterator::leaf_iterator() 
+tree<T, tree_node_allocator>::leaf_iterator::leaf_iterator()
    : iterator_base(0)
    {
    }
@@ -2585,7 +2586,7 @@ tree<T, tree_node_allocator>::leaf_itera
    if(this->node==0) {
       if(other.range_last()!=0)
          this->node=other.range_last();
-      else 
+      else
          this->node=other.parent_;
       ++(*this);
       }
openSUSE Build Service is sponsored by