[Libreoffice-commits] core.git: 10 commits - include/svx sc/source sdext/source sd/source svl/unx sw/qa

Caolán McNamara caolanm at redhat.com
Tue Mar 25 10:04:17 PDT 2014


 include/svx/galmisc.hxx                          |   10 +++--
 sc/source/ui/docshell/docsh8.cxx                 |   33 ------------------
 sc/source/ui/view/output2.cxx                    |   40 -----------------------
 sc/source/ui/view/viewfunc.cxx                   |    6 ---
 sd/source/core/drawdoc3.cxx                      |   12 +++---
 sd/source/ui/view/sdruler.cxx                    |    7 ++--
 sdext/source/pdfimport/pdfparse/pdfentries.cxx   |    2 -
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |    4 +-
 svl/unx/source/svdde/ddedummy.cxx                |    1 
 sw/qa/extras/inc/swmodeltestbase.hxx             |    1 
 10 files changed, 22 insertions(+), 94 deletions(-)

New commits:
commit 729f40f0359bcaa311c7d0067c84e7755286d261
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 14:02:35 2014 +0000

    coverity#738830 Uninitialized pointer field
    
    Change-Id: I82b0c24957761573e0870b11b7b1ddb3553119c4

diff --git a/sd/source/ui/view/sdruler.cxx b/sd/source/ui/view/sdruler.cxx
index 66bed37..dc1943f 100644
--- a/sd/source/ui/view/sdruler.cxx
+++ b/sd/source/ui/view/sdruler.cxx
@@ -73,9 +73,10 @@ void RulerCtrlItem::StateChanged( sal_uInt16 nSId, SfxItemState, const SfxPoolIt
 
 
 Ruler::Ruler( DrawViewShell& rViewSh, ::Window* pParent, ::sd::Window* pWin, sal_uInt16 nRulerFlags,  SfxBindings& rBindings, WinBits nWinStyle)
-: SvxRuler(pParent, pWin, nRulerFlags, rBindings, nWinStyle)
-, pSdWin(pWin)
-, pDrViewShell(&rViewSh)
+    : SvxRuler(pParent, pWin, nRulerFlags, rBindings, nWinStyle)
+    , pSdView(NULL)
+    , pSdWin(pWin)
+    , pDrViewShell(&rViewSh)
 {
     rBindings.EnterRegistrations();
     pCtrlItem = new RulerCtrlItem(SID_RULER_NULL_OFFSET, *this, rBindings);
commit 80450fe68f193c69a49bdd0f9b40dac8f1b9f407
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 14:01:13 2014 +0000

    coverity#738856 Uninitialized pointer field
    
    Change-Id: I3dec3b5bed90b63f8869e0f28c970cec93d040c8

diff --git a/svl/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx
index 1fca271..de726e7 100644
--- a/svl/unx/source/svdde/ddedummy.cxx
+++ b/svl/unx/source/svdde/ddedummy.cxx
@@ -147,6 +147,7 @@ DdePoke::DdePoke( DdeConnection& rConnection, const OUString& rString, const Dde
 
 
 DdeTopic::DdeTopic( const OUString& )
+    : pName(NULL)
 {
 }
 
commit 361000e7b670c78ee9009d101c25ac3618e36243
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 14:00:19 2014 +0000

    coverity#738867 Uninitialized pointer field
    
    Change-Id: I14e7a499d994d5a93ca1c6263a5c52e3c6b14fb6

diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
index b9bf2ac..5d08606 100644
--- a/include/svx/galmisc.hxx
+++ b/include/svx/galmisc.hxx
@@ -41,10 +41,12 @@ struct ExchangeData
     Date            aThemeChangeDate;
     Time            aThemeChangeTime;
 
-    ExchangeData() :
-        aThemeChangeDate( Date::EMPTY ),
-        aThemeChangeTime( Time::EMPTY )
-        {}
+    ExchangeData()
+        : pTheme(NULL)
+        , aThemeChangeDate( Date::EMPTY )
+        , aThemeChangeTime( Time::EMPTY )
+        {
+        }
 };
 
 enum SgaObjKind
commit 138d02c6c6e588903b151a8ba5d93c03fae3f75e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 13:58:28 2014 +0000

    coverity#982474 Unchecked dynamic_cast
    
    Change-Id: I67f495755502b034b8a09d8b6d61ede45f2d91e1

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index f460800..043debb 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -216,6 +216,7 @@ private:
     void calcLayout()
     {
         SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+        CPPUNIT_ASSERT(pTxtDoc);
         SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
         pDoc->GetCurrentViewShell()->CalcLayout();
     }
commit 7fce0e3fe7b6de17c896bcd60cf054e4721bce67
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 13:57:25 2014 +0000

    coverity#982469 Unchecked dynamic_cast
    
    Change-Id: I6fa95fbd64f69cca1837b57f9c632f0bdbaec1d0

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index bd8e618..626480d 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -707,7 +707,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& rParent)
             }
             bool bPara = strspn("ParagraphElement", typeid(rParent).name());
             ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(&rParent);
-            if (bPara && isComplex)
+            if (bPara && pPara && isComplex)
                 pPara->bRtl = true;
             if( pNext )
             {
@@ -737,7 +737,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& rParent)
                         if (nType == ::com::sun::star::i18n::ScriptType::COMPLEX)
                             isComplex = true;
                     }
-                    if (bPara && isComplex)
+                    if (bPara && pPara && isComplex)
                         pPara->bRtl = true;
                     // append eventual children to current element
                     // and clear children (else the children just
commit 356263dcdb499631cf642eca869449b374e1f7dd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 13:56:09 2014 +0000

    coverity#982468 Unchecked dynamic_cast
    
    Change-Id: Ie98fa4199ebfa96495bdb7fa4582b09926fac8f1

diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 6603368..c1a8d29 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -912,7 +912,7 @@ PDFEntry* PDFObject::clone() const
         {
             pNewOb->m_pStream = dynamic_cast<PDFStream*>(pNewOb->m_aSubElements[i]);
             PDFDict* pNewDict = dynamic_cast<PDFDict*>(pNewOb->m_pObject);
-            if( pNewDict )
+            if (pNewDict && pNewOb->m_pStream)
                 pNewOb->m_pStream->m_pDict = pNewDict;
         }
     }
commit ca276d55ea0c4946d455ffa3ee8693cab1b17160
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 13:54:13 2014 +0000

    coverity#982466 Unchecked dynamic_cast
    
    Change-Id: I6016ab4ffd2712d62cf3a8136a7d292f06abc8dd

diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 8e806bd..ca34cf1 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -486,8 +486,8 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
     lcl_IterateBookmarkPages( *this, pBookmarkDoc, rBookmarkList, nBMSdPageCount, aSearchFunctor, ( rBookmarkList.empty() && pBookmarkDoc != this ) );
 
     // Copy the style that we actually need.
-    SdStyleSheetPool* pBookmarkStyleSheetPool = dynamic_cast<SdStyleSheetPool*>(pBookmarkDoc->GetStyleSheetPool());
-    SdStyleSheetPool* pStyleSheetPool = dynamic_cast<SdStyleSheetPool*>(GetStyleSheetPool());
+    SdStyleSheetPool& rBookmarkStyleSheetPool = dynamic_cast<SdStyleSheetPool&>(*pBookmarkDoc->GetStyleSheetPool());
+    SdStyleSheetPool& rStyleSheetPool = dynamic_cast<SdStyleSheetPool&>(*GetStyleSheetPool());
 
     // When copying styles, also copy the master pages!
     if( !aLayoutsToTransfer.empty() )
@@ -499,7 +499,7 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
         SdStyleSheetVector aCreatedStyles;
         OUString layoutName = *pIter;
 
-        pStyleSheetPool->CopyLayoutSheets(layoutName, *pBookmarkStyleSheetPool,aCreatedStyles);
+        rStyleSheetPool.CopyLayoutSheets(layoutName, rBookmarkStyleSheetPool,aCreatedStyles);
 
         if(!aCreatedStyles.empty())
         {
@@ -519,12 +519,12 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
     OUString aRenameStr;
     if(!bReplace && !bNoDialogs)
         aRenameStr = OUString("_");
-    pStyleSheetPool->RenameAndCopyGraphicSheets(*pBookmarkStyleSheetPool, aNewGraphicStyles, aRenameStr);
+    rStyleSheetPool.RenameAndCopyGraphicSheets(rBookmarkStyleSheetPool, aNewGraphicStyles, aRenameStr);
     SdStyleSheetVector aNewCellStyles;
-    pStyleSheetPool->CopyCellSheets(*pBookmarkStyleSheetPool, aNewCellStyles);
+    rStyleSheetPool.CopyCellSheets(rBookmarkStyleSheetPool, aNewCellStyles);
 
     // TODO handle undo of table styles too
-    pStyleSheetPool->CopyTableStyles(*pBookmarkStyleSheetPool);
+    rStyleSheetPool.CopyTableStyles(rBookmarkStyleSheetPool);
 
     // Insert document
 
commit 592f1387486eefa6d97858d538cde7ff085972e7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 13:49:59 2014 +0000

    coverity#1130187 Logically dead code
    
    Change-Id: I0d89af20a61123d7a47452c024c987774d929475

diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index a96c4e6..6a017ef 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -186,11 +186,7 @@ bool ScViewFunc::TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrC
     if (bFound)
         aFormatArea = aNewRange;    // extend
     else
-    {
-        bFormatValid = false;       // outdside of range -> break
-        if ( bAttrChanged )         // if value entered with numberformat?
-            StartFormatArea();      // then start again
-    }
+        bFormatValid = false;       // outside of range -> break
 
     return bFound;
 }
commit 960da63a9e0f84c4531399baa82df057084414e3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 13:42:06 2014 +0000

    coverity#982303 Logically dead code
    
    Change-Id: I45aca72d340295fcda04f9045f0c61b882722fd8

diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 44dcbed..de3ecf2 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -488,11 +488,6 @@ void lcl_GetColumnTypes(
     OUString* pColNames, sal_Int32* pColTypes, sal_Int32* pColLengths,
     sal_Int32* pColScales, bool& bHasMemo, rtl_TextEncoding eCharSet )
 {
-    //  updating of column titles didn't work in 5.2 and isn't always wanted
-    //  (saving normally shouldn't modify the document)
-    //! read flag from configuration
-    bool bUpdateTitles = false;
-
     ScDocument* pDoc = rDocShell.GetDocument();
     SvNumberFormatter* pNumFmt = pDoc->GetFormatTable();
 
@@ -715,34 +710,6 @@ void lcl_GetColumnTypes(
             if ( bSdbLenBad && nFieldLen == 1 )
                 nFieldLen = 2;      // THIS is reality
         }
-        if ( bUpdateTitles )
-        {   // Angabe anpassen und ausgeben
-            OUString aOutString = aFieldName;
-            switch ( nDbType )
-            {
-                case sdbc::DataType::BIT :
-                    aOutString += ",L";
-                    break;
-                case sdbc::DataType::DATE :
-                    aOutString += ",D";
-                    break;
-                case sdbc::DataType::LONGVARCHAR :
-                    aOutString += ",M";
-                    break;
-                case sdbc::DataType::VARCHAR :
-                    aOutString += ",C," + OUString::number( nFieldLen );
-                    break;
-                case sdbc::DataType::DECIMAL :
-                    aOutString += ",N,"  + OUString::number( nFieldLen ) +
-                                  "," + OUString::number( nPrecision );
-                    break;
-            }
-            if ( !aOutString.equalsIgnoreAsciiCase( aString ) )
-            {
-                pDoc->SetString( nCol, nFirstRow, nTab, aOutString );
-                rDocShell.PostPaint( nCol, nFirstRow, nTab, nCol, nFirstRow, nTab, PAINT_GRID );
-            }
-        }
         ++nField;
     }
 }
commit 9104fbc571d5c81a30250a3b97c3dec1f1a55490
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 25 13:12:07 2014 +0000

    coverity#735475 Logically dead code
    
    Change-Id: I6c1538ac40db97d687f446a8059e51b4a588199e

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index eb46c4a..5d1ae19 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -3879,46 +3879,6 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
             nEngineWidth, nEngineHeight, nNeededPixel,
             aAreaParam.mbLeftClip, aAreaParam.mbRightClip );
 
-        if ( bRepeat && !aAreaParam.mbLeftClip && !aAreaParam.mbRightClip && rParam.mpEngine->GetParagraphCount() == 1 )
-        {
-            // First check if twice the space for the formatted text is available
-            // (otherwise just keep it unchanged).
-
-            long nFormatted = nNeededPixel - nLeftM - nRightM;      // without margin
-            long nAvailable = aAreaParam.maAlignRect.GetWidth() - nLeftM - nRightM;
-            if ( nAvailable >= 2 * nFormatted )
-            {
-                // "repeat" is handled with unformatted text (for performance reasons)
-                OUString aCellStr = rParam.mpEngine->GetText();
-                rParam.mpEngine->SetText( aCellStr );
-
-                long nRepeatSize = (long) rParam.mpEngine->CalcTextWidth();
-                if (rParam.mbPixelToLogic)
-                    nRepeatSize = mpRefDevice->LogicToPixel(Size(nRepeatSize,0)).Width();
-                if ( pFmtDevice != mpRefDevice )
-                    ++nRepeatSize;
-                if ( nRepeatSize > 0 )
-                {
-                    long nRepeatCount = nAvailable / nRepeatSize;
-                    if ( nRepeatCount > 1 )
-                    {
-                        OUString aRepeated = aCellStr;
-                        for ( long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
-                            aRepeated += aCellStr;
-                        rParam.mpEngine->SetText( aRepeated );
-
-                        nEngineHeight = rParam.mpEngine->GetTextHeight();
-                        nEngineWidth = (long) rParam.mpEngine->CalcTextWidth();
-                        if (rParam.mbPixelToLogic)
-                            nNeededPixel = mpRefDevice->LogicToPixel(Size(nEngineWidth,0)).Width();
-                        else
-                            nNeededPixel = nEngineWidth;
-                        nNeededPixel += nLeftM + nRightM;
-                    }
-                }
-            }
-        }
-
         if ( rParam.mbCellIsValue && ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) )
         {
             rParam.mpEngine->SetText(OUString("###"));


More information about the Libreoffice-commits mailing list