[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[mdds] 41/62: Imported Upstream version 0.10.2



This is an automated email from the git hooks/post-receive script.

rene pushed a commit to branch master
in repository mdds.

commit f9eddb23df4d721b804edc4a021f51dadfb10866
Author: Rene Engelhard <rene@debian.org>
Date:   Thu Apr 21 14:50:52 2016 +0200

    Imported Upstream version 0.10.2
---
 Makefile.in                            | 11 ++++-
 NEWS                                   | 11 +++++
 configure                              | 32 ++++++------
 configure.ac                           |  2 +-
 include/mdds/multi_type_vector_def.inl | 37 +++++++++++++-
 src/multi_type_vector_test_default.cpp | 90 ++++++++++++++++++++++++++++++++++
 6 files changed, 163 insertions(+), 20 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 0356c33..3c824b4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -42,7 +42,16 @@ HEADERS= \
 	@top_srcdir@/$(INCDIR)/mdds/quad_node.hpp \
 	@top_srcdir@/$(INCDIR)/mdds/rectangle_set_def.inl \
 	@top_srcdir@/$(INCDIR)/mdds/rectangle_set.hpp \
-	@top_srcdir@/$(INCDIR)/mdds/segment_tree.hpp
+	@top_srcdir@/$(INCDIR)/mdds/segment_tree.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector_custom_func1.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector_custom_func2.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector_custom_func3.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector_itr.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector_trait.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector_types.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector_macro.hpp \
+	@top_srcdir@/$(INCDIR)/mdds/multi_type_vector_def.inl
 
 DEPENDS= \
 	$(HEADERS)
diff --git a/NEWS b/NEWS
index 2e57494..b9657ff 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,14 @@
+mdds 0.10.2
+
+* multi_type_vector
+
+  * fixed a bug in transfer() that would trigger an assertion and
+    eventually lead to a crash.  The problem occurred when a range of
+    data to be transferred spanned over 2 blocks and consisted of the
+    lower part of an upper block and the upper part of a lower block.
+
+mdds 0.10.1
+
 * multi_type_matrix
 
   * added a variant of set_empty() that takes an additional length
diff --git a/configure b/configure
index 6b19e9b..a9347d2 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for mdds 0.10.1.
+# Generated by GNU Autoconf 2.69 for mdds 0.10.2.
 #
 # Report bugs to <kohei.yoshida@gmail.com>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='mdds'
 PACKAGE_TARNAME='mdds'
-PACKAGE_VERSION='0.10.1'
-PACKAGE_STRING='mdds 0.10.1'
+PACKAGE_VERSION='0.10.2'
+PACKAGE_STRING='mdds 0.10.2'
 PACKAGE_BUGREPORT='kohei.yoshida@gmail.com'
 PACKAGE_URL=''
 
@@ -1181,7 +1181,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures mdds 0.10.1 to adapt to many kinds of systems.
+\`configure' configures mdds 0.10.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1242,7 +1242,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mdds 0.10.1:";;
+     short | recursive ) echo "Configuration of mdds 0.10.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1335,7 +1335,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mdds configure 0.10.1
+mdds configure 0.10.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1352,7 +1352,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by mdds $as_me 0.10.1, which was
+It was created by mdds $as_me 0.10.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -1701,7 +1701,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-VERSION=0.10.1
+VERSION=0.10.2
 
 
 PACKAGE_TARNAME=mdds
@@ -2298,7 +2298,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mdds $as_me 0.10.1, which was
+This file was extended by mdds $as_me 0.10.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2351,7 +2351,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-mdds config.status 0.10.1
+mdds config.status 0.10.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -3455,7 +3455,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mdds $as_me 0.10.1, which was
+This file was extended by mdds $as_me 0.10.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3508,7 +3508,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-mdds config.status 0.10.1
+mdds config.status 0.10.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -4613,7 +4613,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mdds $as_me 0.10.1, which was
+This file was extended by mdds $as_me 0.10.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4666,7 +4666,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-mdds config.status 0.10.1
+mdds config.status 0.10.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -5772,7 +5772,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mdds $as_me 0.10.1, which was
+This file was extended by mdds $as_me 0.10.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5825,7 +5825,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-mdds config.status 0.10.1
+mdds config.status 0.10.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index b7f4ba2..bee551b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(mdds, 0.10.1, kohei.yoshida@gmail.com)
+AC_INIT(mdds, 0.10.2, kohei.yoshida@gmail.com)
 
 VERSION=AC_PACKAGE_VERSION
 AC_SUBST(VERSION)
diff --git a/include/mdds/multi_type_vector_def.inl b/include/mdds/multi_type_vector_def.inl
index 44a7ffe..ed70404 100644
--- a/include/mdds/multi_type_vector_def.inl
+++ b/include/mdds/multi_type_vector_def.inl
@@ -1556,9 +1556,10 @@ multi_type_vector<_CellBlockFunc>::transfer_multi_blocks(
     else
     {
         // Copy to the middle of destination block. Insert slots for new
-        // blocks (plus one for the empty block) below current.
+        // blocks (plus one for the bottom empty block) below current.
         size_type blk2_size = blk_dest->m_size - dest_pos_in_block - len;
         dest.m_blocks.insert(dest.m_blocks.begin()+dest_block_index+1, block_len+1, NULL);
+        assert(dest.m_blocks.size() > dest_block_index+block_len+1);
         dest.m_blocks[dest_block_index+block_len+1] = new block(blk2_size);
         blk_dest->m_size = dest_pos_in_block;
 
@@ -1657,7 +1658,39 @@ multi_type_vector<_CellBlockFunc>::transfer_multi_blocks(
     dest.merge_with_adjacent_blocks(dest_block_index1);
 
     // Delete all transferred blocks, and replace it with one empty block.
-    assert(del_index2 >= del_index1);
+    if (del_index2 < del_index1)
+    {
+        // No blocks will be deleted.  See if we can just extend one of the
+        // neighboring empty blocks.
+
+        block* blk1 = m_blocks[block_index1];
+        block* blk2 = m_blocks[block_index2];
+
+        if (!blk1->mp_data)
+        {
+            assert(blk2->mp_data);
+
+            // Block 1 is empty. Extend this block.
+            blk1->m_size += len;
+            return get_iterator(block_index1, start_pos_in_block1);
+        }
+
+        if (!blk2->mp_data)
+        {
+            assert(blk1->mp_data);
+
+            // Block 2 is empty. Extend this block.
+            blk2->m_size += len;
+            return get_iterator(block_index2, start_pos);
+        }
+
+        // Neither block1 nor block2 are empty. Just insert a new empty block
+        // between them. After the insertion, the old block2 position becomes
+        // the position of the inserted block.
+        m_blocks.insert(m_blocks.begin()+block_index2, new block(len));
+        return get_iterator(block_index2, start_pos);
+    }
+
     if (del_index1 > 0 && !m_blocks[del_index1-1]->mp_data)
     {
         // The block before the first block to be deleted is empty.  Simply
diff --git a/src/multi_type_vector_test_default.cpp b/src/multi_type_vector_test_default.cpp
index 497d326..b6bbc27 100644
--- a/src/multi_type_vector_test_default.cpp
+++ b/src/multi_type_vector_test_default.cpp
@@ -4791,6 +4791,95 @@ void mtv_test_block_identifier()
     assert(mtv::uchar_element_block::block_type == mtv::element_type_uchar);
 }
 
+void mtv_test_transfer()
+{
+    stack_printer __stack_printer__("::mtv_test_transfer");
+    mtv_type db1(5), db2(5);
+    db1.set(0, 1.0);
+    db1.set(1, 2.0);
+    mtv_type::iterator it = db1.transfer(1, 2, db2, 1);
+
+    assert(db1.get<double>(0) == 1.0);
+    assert(db1.is_empty(1));
+    assert(db1.is_empty(2));
+    assert(db1.is_empty(3));
+    assert(db1.is_empty(4));
+
+    assert(db2.is_empty(0));
+    assert(db2.get<double>(1) == 2.0);
+    assert(db2.is_empty(2));
+    assert(db2.is_empty(3));
+    assert(db2.is_empty(4));
+
+    assert(it->size == 4);
+    assert(it->__private_data.block_index == 1);
+    assert(it->position == 1);
+
+    // Reset and start over.
+    db1.clear();
+    db1.resize(5);
+    db2.clear();
+    db2.resize(5);
+
+    db1.set(2, 1.2);
+    db1.set(3, 1.3);
+
+    // Transfer 1:2 in db1 to 2:3 in db2.
+    it = db1.transfer(1, 2, db2, 2);
+
+    assert(db1.is_empty(0));
+    assert(db1.is_empty(1));
+    assert(db1.is_empty(2));
+    assert(db1.get<double>(3) == 1.3);
+    assert(db1.is_empty(4));
+
+    assert(db2.is_empty(0));
+    assert(db2.is_empty(1));
+    assert(db2.is_empty(2));
+    assert(db2.get<double>(3) == 1.2);
+    assert(db2.is_empty(4));
+
+    assert(it->size == 3);
+    assert(it->position == 0);
+    assert(it->__private_data.block_index == 0);
+
+    // Reset and start over.
+    db1.clear();
+    db1.resize(4);
+    db2.clear();
+    db2.resize(4);
+
+    db1.set(0, string("A"));
+    db1.set(1, string("B"));
+    db1.set(2, 11.1);
+    db1.set(3, 11.2);
+
+    it = db1.transfer(1, 2, db2, 1);
+
+    assert(db1.get<string>(0) == "A");
+    assert(db1.is_empty(1));
+    assert(db1.is_empty(2));
+    assert(db1.get<double>(3) == 11.2);
+
+    assert(db2.is_empty(0));
+    assert(db2.get<string>(1) == "B");
+    assert(db2.get<double>(2) == 11.1);
+    assert(db2.is_empty(3));
+
+    assert(it->size == 2);
+    assert(it->position == 1);
+    assert(it->__private_data.block_index == 1);
+
+    // Reset and start over.
+    db1.clear();
+    db1.resize(4);
+    db2.clear();
+    db2.resize(4);
+
+    db1.set(2, 12.8);
+    it = db1.transfer(1, 2, db2, 1);
+}
+
 }
 
 int main (int argc, char **argv)
@@ -4826,6 +4915,7 @@ int main (int argc, char **argv)
     mtv_test_swap_range();
     mtv_test_value_type();
     mtv_test_block_identifier();
+    mtv_test_transfer();
 
     cout << "Test finished successfully!" << endl;
     return EXIT_SUCCESS;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openoffice/mdds.git


Reply to: