summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2006-05-16 16:27:15 +0000
committerjoncruz <joncruz@users.sourceforge.net>2006-05-16 16:27:15 +0000
commit1fe3ba4e4a0443db3e692ebdc18123aa256a3741 (patch)
tree4494f91e5d3d476c4aa05552ffc90081d66efe03
parentrequire libsigc++-2.0.11 for compiling (diff)
downloadinkscape-1fe3ba4e4a0443db3e692ebdc18123aa256a3741.tar.gz
inkscape-1fe3ba4e4a0443db3e692ebdc18123aa256a3741.zip
Corrected ordering of children in subset
(bzr r855)
-rw-r--r--ChangeLog5
-rw-r--r--src/document-subset.cpp35
2 files changed, 22 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 66c748334..965fb1f2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-16 Jon A. Cruz <jon@joncruz.org>
+
+ * src/document-subset.cpp:
+ Corrected ordering of children in subset.
+
2006-05-15 Jon A. Cruz <jon@joncruz.org>
* src/Makefile_insert, src/desktop.cpp, src/desktop.h,
src/layer-manager.cpp, src/menus-skeleton.h, src/verbs.cpp,
diff --git a/src/document-subset.cpp b/src/document-subset.cpp
index 4e7e9f694..4ef547320 100644
--- a/src/document-subset.cpp
+++ b/src/document-subset.cpp
@@ -57,29 +57,28 @@ struct DocumentSubset::Relations : public GC::Managed<GC::ATOMIC>,
} else {
Siblings::const_iterator first=children.begin();
Siblings::const_iterator last=children.end() - 1;
- if ( children.size() == 1 ) {
- int pos = sp_object_compare_position(*first, obj);
+
+ while ( first != last ) {
+ Siblings::const_iterator mid = first + ( last - first + 1 ) / 2;
+ int pos = sp_object_compare_position(*mid, obj);
if ( pos < 0 ) {
- // All good.
+ first = mid;
} else if ( pos > 0 ) {
- last++;
+ if ( last == mid ) {
+ last = mid - 1; // already at the top limit
+ } else {
+ last = mid;
+ }
} else {
g_assert_not_reached();
}
- } else {
- while ( first != last ) {
- Siblings::const_iterator mid=first + ( last - first + 1 ) / 2;
- int pos=sp_object_compare_position(*mid, obj);
- if ( pos < 0 ) {
- first = mid;
- } else if ( pos > 0 ) {
- if ( last == mid ) {
- break;
- }
- last = mid;
- } else {
- g_assert_not_reached();
- }
+ }
+
+ if ( first == last ) {
+ // compare to the single possiblity left
+ int pos = sp_object_compare_position(*last, obj);
+ if ( pos < 0 ) {
+ last++;
}
}