mdds/0001-Combine-these-two-calls.-There-is-no-reason-why-they.patch |   27 ++
 mdds/0001-Fix-it-here-too.patch                                      |   36 ++
 mdds/UnpackedTarball_mdds.mk                                         |    2 
 sc/qa/unit/ucalc.cxx                                                 |  122 
+++++++---
 sc/source/core/data/dociter.cxx                                      |    6 
 5 files changed, 155 insertions(+), 38 deletions(-)

New commits:
commit 0cb19d943fc54684a6d4bb4da0e2c9008fde098a
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Tue Jun 25 11:06:43 2013 -0400

    The horizontal cell iterator was *still* broken. Let's fix it again.
    
    And add a test for it.
    
    Change-Id: If76a67e02ac6ad5199d664850bd8591bd3032f32

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 2934a59..302890b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -384,6 +384,12 @@ void printRange(ScDocument* pDoc, const ScRange& rRange, 
const char* pCaption)
 template<size_t _Size>
 ScRange insertRangeData(ScDocument* pDoc, const ScAddress& rPos, const char* 
aData[][_Size], size_t nRowCount)
 {
+    ScRange aRange(rPos);
+    aRange.aEnd.SetCol(rPos.Col()+_Size-1);
+    aRange.aEnd.SetRow(rPos.Row()+nRowCount-1);
+
+    clearRange(pDoc, aRange);
+
     for (size_t i = 0; i < _Size; ++i)
     {
         for (size_t j = 0; j < nRowCount; ++j)
@@ -397,9 +403,6 @@ ScRange insertRangeData(ScDocument* pDoc, const ScAddress& 
rPos, const char* aDa
         }
     }
 
-    ScRange aRange(rPos);
-    aRange.aEnd.SetCol(rPos.Col()+_Size-1);
-    aRange.aEnd.SetRow(rPos.Row()+nRowCount-1);
     printRange(pDoc, aRange, "Range data content");
     return aRange;
 }
@@ -1721,48 +1724,97 @@ void Test::testVolatileFunc()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testHorizontalIterator()
-{
-    m_pDoc->InsertTab(0, "test");
+namespace {
 
-    // Raw data
-    const char* aData[][2] = {
-        { "A", "B" },
-        { "C", "1" },
-        { "D", "2" },
-        { "E", "3" }
-    };
+struct HoriIterCheck
+{
+    SCCOL nCol;
+    SCROW nRow;
+    const char* pVal;
+};
 
+template<size_t _Size>
+bool checkHorizontalIterator(ScDocument* pDoc, const char* pData[][_Size], 
size_t nDataCount, const HoriIterCheck* pChecks, size_t nCheckCount)
+{
     ScAddress aPos(0,0,0);
-    insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData));
-    ScHorizontalCellIterator aIter(m_pDoc, 0, 0, 0, 1, SAL_N_ELEMENTS(aData));
-
-    struct {
-        SCCOL nCol;
-        SCROW nRow;
-        const char* pVal;
-    } aChecks[] = {
-        { 0, 0, "A" },
-        { 1, 0, "B" },
-        { 0, 1, "C" },
-        { 1, 1, "1" },
-        { 0, 2, "D" },
-        { 1, 2, "2" },
-        { 0, 3, "E" },
-        { 1, 3, "3" },
-    };
+    insertRangeData(pDoc, aPos, pData, nDataCount);
+    ScHorizontalCellIterator aIter(pDoc, 0, 0, 0, 1, nDataCount-1);
 
     SCCOL nCol;
     SCROW nRow;
-    size_t i = 0, n = SAL_N_ELEMENTS(aChecks);
+    size_t i = 0;
     for (ScRefCellValue* pCell = aIter.GetNext(nCol, nRow); pCell; pCell = 
aIter.GetNext(nCol, nRow), ++i)
     {
-        if (i >= n)
+        if (i >= nCheckCount)
             CPPUNIT_FAIL("Iterator claims there is more data than there should 
be.");
 
-        CPPUNIT_ASSERT_EQUAL(aChecks[i].nCol, nCol);
-        CPPUNIT_ASSERT_EQUAL(aChecks[i].nRow, nRow);
-        CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(aChecks[i].pVal), 
pCell->getString());
+        if (pChecks[i].nCol != nCol)
+            return false;
+
+        if (pChecks[i].nRow != nRow)
+            return false;
+
+        if (OUString::createFromAscii(pChecks[i].pVal) != pCell->getString())
+            return false;
+    }
+
+    return true;
+}
+
+}
+
+void Test::testHorizontalIterator()
+{
+    m_pDoc->InsertTab(0, "test");
+
+    {
+        // Raw data
+        const char* aData[][2] = {
+            { "A", "B" },
+            { "C", "1" },
+            { "D", "2" },
+            { "E", "3" }
+        };
+
+        HoriIterCheck aChecks[] = {
+            { 0, 0, "A" },
+            { 1, 0, "B" },
+            { 0, 1, "C" },
+            { 1, 1, "1" },
+            { 0, 2, "D" },
+            { 1, 2, "2" },
+            { 0, 3, "E" },
+            { 1, 3, "3" },
+        };
+
+        bool bRes = checkHorizontalIterator(
+            m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, 
SAL_N_ELEMENTS(aChecks));
+
+        if (!bRes)
+            CPPUNIT_FAIL("Failed on test 1.");
+    }
+
+    {
+        // Raw data
+        const char* aData[][2] = {
+            { "A", "B" },
+            { "C",  0  },
+            { "D", "E" },
+        };
+
+        HoriIterCheck aChecks[] = {
+            { 0, 0, "A" },
+            { 1, 0, "B" },
+            { 0, 1, "C" },
+            { 0, 2, "D" },
+            { 1, 2, "E" },
+        };
+
+        bool bRes = checkHorizontalIterator(
+            m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, 
SAL_N_ELEMENTS(aChecks));
+
+        if (!bRes)
+            CPPUNIT_FAIL("Failed on test 2.");
     }
 
     m_pDoc->DeleteTab(0);
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 298bb77..fc0c75a 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1799,9 +1799,6 @@ void ScHorizontalCellIterator::Advance()
         if (r.maPos == r.maEnd)
             continue;
 
-        if (r.maPos->type == sc::element_type_empty)
-            continue;
-
         size_t nRow = static_cast<size_t>(mnRow);
         if (nRow < r.maPos->position)
             continue;
@@ -1810,6 +1807,9 @@ void ScHorizontalCellIterator::Advance()
             if (!advanceBlock(nRow, r.maPos, r.maEnd))
                 continue;
 
+        if (r.maPos->type == sc::element_type_empty)
+            continue;
+
         // Found in the current row.
         mnCol = i;
         bMore = true;
commit 850bd1c38b2b47b6bd906055cba93dcee15fcd21
Author: Luboš Luňák <l.lu...@suse.cz>
Date:   Tue Jun 25 16:47:35 2013 +0200

    one more fix for mdds with msvc
    
    Change-Id: I49dfc1b3efcd00547764159fc9ce3dcc1339f7d2

diff --git a/mdds/0001-Fix-it-here-too.patch b/mdds/0001-Fix-it-here-too.patch
index 9884ff0..5f99a3d 100644
--- a/mdds/0001-Fix-it-here-too.patch
+++ b/mdds/0001-Fix-it-here-too.patch
@@ -21,6 +21,16 @@ index 685899b..cea8ae0 100644
              block* blk = m_blocks[block_index+1];
              blk->mp_data = dst_data.release();
          }
+@@ -2713,8 +2713,7 @@
+         else
+         {
+             // Insert a new block to store the new elements.
+-            m_blocks.insert(m_blocks.begin()+dst_index+1, NULL);
+-            m_blocks[dst_index+1] = new block(len);
++            m_blocks.insert(m_blocks.begin()+dst_index+1, new block(len));
+             blk = m_blocks[dst_index+1];
+             blk->mp_data = element_block_func::create_new_block(cat_src, 0);
+             assert(blk->mp_data);
 -- 
 1.8.0
 
commit a62d258ee8d0af432dd55d1292d8ed9899af8f11
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Tue Jun 25 09:43:54 2013 -0400

    Another place where the same fix needs to be applied.
    
    Change-Id: I2d54fa4c39c28b815a051977715e1db672156957

diff --git a/mdds/0001-Fix-it-here-too.patch b/mdds/0001-Fix-it-here-too.patch
new file mode 100644
index 0000000..9884ff0
--- /dev/null
+++ b/mdds/0001-Fix-it-here-too.patch
@@ -0,0 +1,26 @@
+From e9fdebe0cad9277cfed994cae7fe9d08efbb4ba8 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yosh...@gmail.com>
+Date: Tue, 25 Jun 2013 09:42:19 -0400
+Subject: [PATCH] Fix it here too.
+
+---
+ include/mdds/multi_type_vector_def.inl | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/include/mdds/multi_type_vector_def.inl 
b/include/mdds/multi_type_vector_def.inl
+index 685899b..cea8ae0 100644
+--- a/include/mdds/multi_type_vector_def.inl
++++ b/c/d/include/mdds/multi_type_vector_def.inl
+@@ -1829,8 +1829,7 @@ void 
multi_type_vector<_CellBlockFunc>::swap_single_blocks(
+         }
+         else
+         {
+-            m_blocks.insert(m_blocks.begin()+block_index+1, NULL);
+-            m_blocks[block_index+1] = new block(len);
++            m_blocks.insert(m_blocks.begin()+block_index+1, new block(len));
+             block* blk = m_blocks[block_index+1];
+             blk->mp_data = dst_data.release();
+         }
+-- 
+1.8.0
+
diff --git a/mdds/UnpackedTarball_mdds.mk b/mdds/UnpackedTarball_mdds.mk
index bbad2dd..9d85d74 100644
--- a/mdds/UnpackedTarball_mdds.mk
+++ b/mdds/UnpackedTarball_mdds.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,mdds,\
        mdds/mdds_0.6.0.patch \
        mdds/0001-Workaround-for-an-old-gcc-bug.patch \
        mdds/0001-Combine-these-two-calls.-There-is-no-reason-why-they.patch \
+       mdds/0001-Fix-it-here-too.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
commit 1151248e7b9d728291c280308ccafd4d3638e8e4
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Tue Jun 25 08:19:37 2013 -0400

    Try to help the Windows tinderbox.
    
    Change-Id: Ia3c6df80ff26ea00e91dd97841c4867bf0a55705

diff --git 
a/mdds/0001-Combine-these-two-calls.-There-is-no-reason-why-they.patch 
b/mdds/0001-Combine-these-two-calls.-There-is-no-reason-why-they.patch
new file mode 100644
index 0000000..783210d
--- /dev/null
+++ b/mdds/0001-Combine-these-two-calls.-There-is-no-reason-why-they.patch
@@ -0,0 +1,27 @@
+From a2a1c432f65c0612bb6f1c23a50bd41d2cf0cbdd Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yosh...@gmail.com>
+Date: Tue, 25 Jun 2013 08:08:09 -0400
+Subject: [PATCH] Combine these two calls. There is no reason why they have to
+ separate.
+
+---
+ include/mdds/multi_type_vector_def.inl | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/include/mdds/multi_type_vector_def.inl 
b/include/mdds/multi_type_vector_def.inl
+index 36dde5e..685899b 100644
+--- a/include/mdds/multi_type_vector_def.inl
++++ b/c/d/include/mdds/multi_type_vector_def.inl
+@@ -1801,8 +1801,7 @@ void 
multi_type_vector<_CellBlockFunc>::swap_single_blocks(
+         else
+         {
+             // Insert a new block to store the new elements.
+-            m_blocks.insert(m_blocks.begin()+block_index, NULL);
+-            m_blocks[block_index] = new block(len);
++            m_blocks.insert(m_blocks.begin()+block_index, new block(len));
+             block* blk = m_blocks[block_index];
+             blk->mp_data = dst_data.release();
+         }
+-- 
+1.8.0
+
diff --git a/mdds/UnpackedTarball_mdds.mk b/mdds/UnpackedTarball_mdds.mk
index 69fbf18..bbad2dd 100644
--- a/mdds/UnpackedTarball_mdds.mk
+++ b/mdds/UnpackedTarball_mdds.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,3))
 $(eval $(call gb_UnpackedTarball_add_patches,mdds,\
        mdds/mdds_0.6.0.patch \
        mdds/0001-Workaround-for-an-old-gcc-bug.patch \
+       mdds/0001-Combine-these-two-calls.-There-is-no-reason-why-they.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to