[ooo-build-commit] Branch 'ooo-build-3-1-1' - patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Nov 19 22:45:11 PST 2009
patches/dev300/calc-perf-flat-segment-tree.diff | 104 ++++++++++++------------
1 file changed, 52 insertions(+), 52 deletions(-)
New commits:
commit c89ee90243a7fc3c797073e0094f32b970db389c
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 20 01:44:00 2009 -0500
Fixed compiler errors and warnings with gcc 4.3.2.
* patches/dev300/calc-perf-flat-segment-tree.diff:
diff --git a/patches/dev300/calc-perf-flat-segment-tree.diff b/patches/dev300/calc-perf-flat-segment-tree.diff
index cef05c7..ed61fe6 100644
--- a/patches/dev300/calc-perf-flat-segment-tree.diff
+++ b/patches/dev300/calc-perf-flat-segment-tree.diff
@@ -1,6 +1,6 @@
diff --git sc/inc/mdds/flatsegmenttree.hxx sc/inc/mdds/flatsegmenttree.hxx
new file mode 100644
-index 0000000..34fbc44
+index 0000000..40a912a
--- /dev/null
+++ sc/inc/mdds/flatsegmenttree.hxx
@@ -0,0 +1,956 @@
@@ -163,7 +163,7 @@ index 0000000..34fbc44
+ {
+ m_db = r.m_db;
+ m_pos = r.m_pos;
-+
++ return *this;
+ }
+
+ void operator++()
@@ -221,8 +221,8 @@ index 0000000..34fbc44
+ return m_current_pair;
+ }
+
-+ const fst_type* m_db;
-+ const fst_type::node* m_pos;
++ const fst_type* m_db;
++ const typename fst_type::node* m_pos;
+ ::std::pair<key_type, value_type> m_current_pair;
+ bool m_end_pos:1;
+ bool m_forward:1;
@@ -320,38 +320,38 @@ index 0000000..34fbc44
+ /**
+ * Insert a new segment into the tree.
+ *
-+ * @param start start value of the segment being inserted. The value is
-+ * inclusive.
-+ * @param end end value of the segment being inserted. The value is not
-+ * inclusive.
++ * @param start_key start value of the segment being inserted. The value
++ * is inclusive.
++ * @param end_key end value of the segment being inserted. The value is
++ * not inclusive.
+ * @param val value associated with this segment.
+ */
-+ void insert_segment(key_type start, key_type end, value_type val)
++ void insert_segment(key_type start_key, key_type end_key, value_type val)
+ {
-+ if (end < get_node(m_left_leaf)->value_leaf.key || start > get_node(m_right_leaf)->value_leaf.key)
++ if (end_key < get_node(m_left_leaf)->value_leaf.key || start_key > get_node(m_right_leaf)->value_leaf.key)
+ // The new segment does not overlap the current interval.
+ return;
+
-+ if (start < get_node(m_left_leaf)->value_leaf.key)
++ if (start_key < get_node(m_left_leaf)->value_leaf.key)
+ // The start value should not be smaller than the current minimum.
-+ start = get_node(m_left_leaf)->value_leaf.key;
++ start_key = get_node(m_left_leaf)->value_leaf.key;
+
-+ if (end > get_node(m_right_leaf)->value_leaf.key)
++ if (end_key > get_node(m_right_leaf)->value_leaf.key)
+ // The end value should not be larger than the current maximum.
-+ end = get_node(m_right_leaf)->value_leaf.key;
++ end_key = get_node(m_right_leaf)->value_leaf.key;
+
-+ if (start >= end)
++ if (start_key >= end_key)
+ return;
+
+ // Find the node with value that either equals or is greater than the
+ // start value.
+
-+ node_base_ptr start_pos = get_insertion_pos_leaf(start, m_left_leaf);
++ node_base_ptr start_pos = get_insertion_pos_leaf(start_key, m_left_leaf);
+ if (!start_pos)
+ // Insertion position not found. Bail out.
+ return;
+
-+ node_base_ptr end_pos = get_insertion_pos_leaf(end, start_pos);
++ node_base_ptr end_pos = get_insertion_pos_leaf(end_key, start_pos);
+ if (!end_pos)
+ end_pos = m_right_leaf;
+
@@ -360,7 +360,7 @@ index 0000000..34fbc44
+
+ // Set the start node.
+
-+ if (get_node(start_pos)->value_leaf.key == start)
++ if (get_node(start_pos)->value_leaf.key == start_key)
+ {
+ // Re-use the existing node, but save the old value for later.
+
@@ -388,7 +388,7 @@ index 0000000..34fbc44
+ {
+ // Insert a new node before the insertion position node.
+ node_base_ptr new_node(new node(true));
-+ get_node(new_node)->value_leaf.key = start;
++ get_node(new_node)->value_leaf.key = start_key;
+ get_node(new_node)->value_leaf.value = val;
+ new_start_node = new_node;
+
@@ -415,7 +415,7 @@ index 0000000..34fbc44
+
+ // Set the end node.
+
-+ if (get_node(end_pos)->value_leaf.key == end)
++ if (get_node(end_pos)->value_leaf.key == end_key)
+ {
+ // The new segment ends exactly at the end node position.
+
@@ -443,7 +443,7 @@ index 0000000..34fbc44
+ {
+ // Insert a new node before the insertion position node.
+ node_base_ptr new_node(new node(true));
-+ get_node(new_node)->value_leaf.key = end;
++ get_node(new_node)->value_leaf.key = end_key;
+ get_node(new_node)->value_leaf.value = old_value;
+
+ // Link to the left node.
@@ -465,43 +465,43 @@ index 0000000..34fbc44
+ * @param start start position of the segment being removed.
+ * @param end end position of the segment being removed.
+ */
-+ void shift_segment_left(key_type start, key_type end)
++ void shift_segment_left(key_type start_key, key_type end_key)
+ {
-+ if (start >= end)
++ if (start_key >= end_key)
+ return;
+
+ key_type left_leaf_key = get_node(m_left_leaf)->value_leaf.key;
+ key_type right_leaf_key = get_node(m_right_leaf)->value_leaf.key;
-+ if (start < left_leaf_key || end < left_leaf_key)
++ if (start_key < left_leaf_key || end_key < left_leaf_key)
+ // invalid key value
+ return;
+
-+ if (start > right_leaf_key || end > right_leaf_key)
++ if (start_key > right_leaf_key || end_key > right_leaf_key)
+ // invalid key value.
+ return;
+
+ node_base_ptr node_pos;
-+ if (left_leaf_key == start)
++ if (left_leaf_key == start_key)
+ node_pos = m_left_leaf;
+ else
+ // Get the first node with a key value equal to or greater than the
+ // start key value. But we want to skip the leftmost node.
-+ node_pos = get_insertion_pos_leaf(start, m_left_leaf->right);
++ node_pos = get_insertion_pos_leaf(start_key, m_left_leaf->right);
+
+ if (!node_pos)
+ return;
+
-+ key_type segment_size = end - start;
++ key_type segment_size = end_key - start_key;
+
+ if (node_pos == m_right_leaf)
+ {
+ // The segment being removed begins after the last node before the
+ // right-most node.
+
-+ if (right_leaf_key <= end)
++ if (right_leaf_key <= end_key)
+ {
+ // The end position equals or is past the right-most node.
-+ append_new_segment(start);
++ append_new_segment(start_key);
+ }
+ else
+ {
@@ -512,7 +512,7 @@ index 0000000..34fbc44
+ return;
+ }
+
-+ if (end < get_node(node_pos)->value_leaf.key)
++ if (end_key < get_node(node_pos)->value_leaf.key)
+ {
+ // The removed segment does not overlap with any nodes. Simply
+ // shift the key values of those nodes that come after the removed
@@ -525,11 +525,11 @@ index 0000000..34fbc44
+
+ // Move the first node to the starting position, and from there search
+ // for the first node whose key value is greater than the end value.
-+ get_node(node_pos)->value_leaf.key = start;
++ get_node(node_pos)->value_leaf.key = start_key;
+ node_base_ptr start_pos = node_pos;
+ node_pos = node_pos->right;
+ value_type last_seg_value = get_node(start_pos)->value_leaf.value;
-+ while (get_node(node_pos) != get_node(m_right_leaf) && get_node(node_pos)->value_leaf.key <= end)
++ while (get_node(node_pos) != get_node(m_right_leaf) && get_node(node_pos)->value_leaf.key <= end_key)
+ {
+ last_seg_value = get_node(node_pos)->value_leaf.value;
+ node_base_ptr next = node_pos->right;
@@ -615,7 +615,7 @@ index 0000000..34fbc44
+ m_valid_tree = false;
+ }
+
-+ bool search(key_type key, value_type& value, key_type* start = NULL, key_type* end = NULL) const
++ bool search(key_type key, value_type& value, key_type* start_key = NULL, key_type* end_key = NULL) const
+ {
+ if (key < get_node(m_left_leaf)->value_leaf.key || get_node(m_right_leaf)->value_leaf.key <= key)
+ // key value is out-of-bound.
@@ -625,26 +625,26 @@ index 0000000..34fbc44
+ if (pos->value_leaf.key == key)
+ {
+ value = pos->value_leaf.value;
-+ if (start)
-+ *start = pos->value_leaf.key;
-+ if (end && pos->right)
-+ *end = get_node(pos->right)->value_leaf.key;
++ if (start_key)
++ *start_key = pos->value_leaf.key;
++ if (end_key && pos->right)
++ *end_key = get_node(pos->right)->value_leaf.key;
+ return true;
+ }
+ else if (pos->left && get_node(pos->left)->value_leaf.key < key)
+ {
+ value = get_node(pos->left)->value_leaf.value;
-+ if (start)
-+ *start = get_node(pos->left)->value_leaf.key;
-+ if (end)
-+ *end = pos->value_leaf.key;
++ if (start_key)
++ *start_key = get_node(pos->left)->value_leaf.key;
++ if (end_key)
++ *end_key = pos->value_leaf.key;
+ return true;
+ }
+
+ return false;
+ }
+
-+ bool search_tree(key_type key, value_type& value, key_type* start = NULL, key_type* end = NULL) const
++ bool search_tree(key_type key, value_type& value, key_type* start_key = NULL, key_type* end_key = NULL) const
+ {
+ if (!m_root_node || !m_valid_tree)
+ {
@@ -715,17 +715,17 @@ index 0000000..34fbc44
+ }
+
+ value = cur_node->value_leaf.value;
-+ if (start)
-+ *start = cur_node->value_leaf.key;
++ if (start_key)
++ *start_key = cur_node->value_leaf.key;
+
-+ if (end)
++ if (end_key)
+ {
+ assert(cur_node->right);
+ if (cur_node->right)
-+ *end = get_node(cur_node->right)->value_leaf.key;
++ *end_key = get_node(cur_node->right)->value_leaf.key;
+ else
+ // This should never happen, but just in case....
-+ *end = get_node(m_right_leaf)->value_leaf.key;
++ *end_key = get_node(m_right_leaf)->value_leaf.key;
+ }
+
+ return true;
@@ -849,9 +849,9 @@ index 0000000..34fbc44
+private:
+ flat_segment_tree();
+
-+ void append_new_segment(key_type start)
++ void append_new_segment(key_type start_key)
+ {
-+ if (get_node(m_right_leaf->left)->value_leaf.key == start)
++ if (get_node(m_right_leaf->left)->value_leaf.key == start_key)
+ {
+ get_node(m_right_leaf->left)->value_leaf.value = m_init_val;
+ return;
@@ -860,7 +860,7 @@ index 0000000..34fbc44
+#ifdef UNIT_TEST
+ // The start position must come after the position of the last node
+ // before the right-most node.
-+ assert(get_node(m_right_leaf->left)->value_leaf.key < start);
++ assert(get_node(m_right_leaf->left)->value_leaf.key < start_key);
+#endif
+
+ if (get_node(m_right_leaf->left)->value_leaf.value == m_init_val)
@@ -869,7 +869,7 @@ index 0000000..34fbc44
+ return;
+
+ node_base_ptr new_node(new node(true));
-+ get_node(new_node)->value_leaf.key = start;
++ get_node(new_node)->value_leaf.key = start_key;
+ get_node(new_node)->value_leaf.value = m_init_val;
+ new_node->left = m_right_leaf->left;
+ new_node->right = m_right_leaf;
More information about the ooo-build-commit
mailing list