[Libreoffice-commits] .: 2 commits - sc/source sw/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 31 08:43:31 PDT 2012


 sc/source/core/data/attarray.cxx         |    3 ++-
 sc/source/core/data/column2.cxx          |    7 +++++--
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   20 ++++++++++++++------
 3 files changed, 21 insertions(+), 9 deletions(-)

New commits:
commit 5115050d01ae4abbba18d07300614fad31dacadf
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 31 16:37:57 2012 +0100

    convert union SingleLineBorders to struct
    
    MSVC warns about the anonymous struct, and the way we write and read
    from the union is undefined.
    
    Change-Id: I683f54d90393a744e5c94857cd87800bcc8f9ffe

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 816c8d0..24618ff 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -404,13 +404,20 @@ void Test::testFdo47669()
     CPPUNIT_ASSERT_EQUAL(OUString("http://www.google.com/#a"), getProperty<OUString>(getRun(getParagraph(1), 2), "HyperLinkURL"));
 }
 
-union SingleLineBorders {
+struct SingleLineBorders {
+    sal_Int16 top, bottom, left, right;
     SingleLineBorders(int t=0, int b=0, int l=0, int r=0)
         : top(t), bottom(b), left(l), right(r) {}
-    struct {
-        sal_Int16 top, bottom, left, right;
-    };
-    sal_Int16 sizes[4];
+    sal_Int16 getBorder(int i) const
+    {
+        switch (i) {
+            case 0: return top;
+            case 1: return bottom;
+            case 2: return left;
+            case 3: return right;
+            default: assert(false); return 0;
+        }
+    }
 };
 void Test::testTableBorders() {
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
@@ -458,7 +465,8 @@ void Test::testTableBorders() {
             {
                 std::stringstream message;
                 message << cells[i] << "'s " << borderNames[j] << " is incorrect";
-                CPPUNIT_ASSERT_EQUAL_MESSAGE(message.str(), borders.sizes[j], aBorderLine.OuterLineWidth);
+                CPPUNIT_ASSERT_EQUAL_MESSAGE(message.str(),
+                        borders.getBorder(j), aBorderLine.OuterLineWidth);
             }
         }
     }
commit 70c3a6be0698e36ff80b7fc590d807ff37aab581
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 31 16:13:54 2012 +0100

    sc: fix erroneous casts of ScCondFormatItem
    
    These cause valgrind warnings in sc_unoapi.
    (regression from d2b49b5b9bffdfa34174af96d85a392fde21fae1)
    
    Change-Id: If3128410bfabc23ff85c24156a8602379b8b7edd

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 3965890..f47bb05 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1320,7 +1320,8 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const
             else if ((SvxCellHorJustify)((const SvxHorJustifyItem&)pPattern->
                         GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_BLOCK)
                 bFound = true;
-            else if (((const SfxUInt32Item&)pPattern->GetItem( ATTR_CONDITIONAL )).GetValue())
+
+            else if (!static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData().empty())
                 bFound = true;
             else if (((const SfxInt32Item&)pPattern->GetItem( ATTR_ROTATE_VALUE )).GetValue())
                 bFound = true;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 6a74d78..d90f79d 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -711,9 +711,12 @@ void ScColumn::GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHe
                 bStdOnly = !bBreak;
 
                 // bedingte Formatierung: Zellen durchgehen
-                if ( bStdOnly && ((const SfxUInt32Item&)pPattern->
-                                    GetItem(ATTR_CONDITIONAL)).GetValue() )
+                if (bStdOnly &&
+                    !static_cast<const ScCondFormatItem&>(pPattern->GetItem(
+                            ATTR_CONDITIONAL)).GetCondFormatData().empty())
+                {
                     bStdOnly = false;
+                }
 
                 // gedrehter Text: Zellen durchgehen
                 if ( bStdOnly && ((const SfxInt32Item&)pPattern->


More information about the Libreoffice-commits mailing list