[Libreoffice-commits] core.git: 5 commits - sax/source sc/source sw/source vcl/source

Caolán McNamara caolanm at redhat.com
Sat Jan 25 04:28:36 PST 2014


 sax/source/fastparser/fastparser.cxx                         |    5 +-
 sc/source/ui/Accessibility/AccessibleContextBase.cxx         |    3 -
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |    2 
 sc/source/ui/inc/AccessibleContextBase.hxx                   |    3 -
 sc/source/ui/inc/AccessibleDocumentPagePreview.hxx           |    3 -
 sw/source/filter/ww8/wrtww8.cxx                              |    6 +-
 vcl/source/control/edit.cxx                                  |   27 ++++-------
 vcl/source/window/menu.cxx                                   |    1 
 8 files changed, 26 insertions(+), 24 deletions(-)

New commits:
commit 5d7d4e78d72003e75a9aa2c705cd5dad68bdc9be
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 24 21:12:45 2014 +0000

    coverity#1157769 Logically dead code
    
    Change-Id: I48b83a8fba756ad44f9b823357f3fdd42a297430

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 2a17a04..1a0d04c 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -528,8 +528,7 @@ void Edit::ImplRepaint(bool bLayout)
         return;
 
     OUString aText = ImplGetText();
-    sal_Int32 nStart = 0;
-    sal_Int32 nEnd = aText.getLength();
+    sal_Int32 nLen = aText.getLength();
 
     sal_Int32   nDXBuffer[256];
     sal_Int32*  pDXBuffer = NULL;
@@ -543,7 +542,7 @@ void Edit::ImplRepaint(bool bLayout)
             pDX = pDXBuffer;
         }
 
-        GetCaretPositions( aText, pDX, nStart, nEnd );
+        GetCaretPositions( aText, pDX, 0, nLen );
     }
 
     long    nTH = GetTextHeight();
@@ -551,16 +550,14 @@ void Edit::ImplRepaint(bool bLayout)
 
     if( bLayout )
     {
-        long nPos = nStart ? pDX[2*nStart] : 0;
-        aPos.X() = nPos + mnXOffset + ImplGetExtraOffset();
+        aPos.X() = mnXOffset + ImplGetExtraOffset();
 
         MetricVector* pVector = &mpControlData->mpLayoutData->m_aUnicodeBoundRects;
         OUString* pDisplayText = &mpControlData->mpLayoutData->m_aDisplayText;
 
-        DrawText( aPos, aText, nStart, nEnd - nStart, pVector, pDisplayText );
+        DrawText( aPos, aText, 0, nLen, pVector, pDisplayText );
 
-        if( pDXBuffer )
-            delete [] pDXBuffer;
+        delete [] pDXBuffer;
         return;
     }
 
@@ -600,15 +597,14 @@ void Edit::ImplRepaint(bool bLayout)
 
     bool bDrawSelection = maSelection.Len() && ( HasFocus() || ( GetStyle() & WB_NOHIDESELECTION ) || mbActivePopup );
 
-    long nPos = nStart ? pDX[2*nStart] : 0;
-    aPos.X() = nPos + mnXOffset + ImplGetExtraOffset();
+    aPos.X() = mnXOffset + ImplGetExtraOffset();
     if ( bPaintPlaceholderText )
     {
         DrawText( aPos, maPlaceholderText );
     }
     else if ( !bDrawSelection && !mpIMEInfos )
     {
-        DrawText( aPos, aText, nStart, nEnd - nStart );
+        DrawText( aPos, aText, 0, nLen );
     }
     else
     {
@@ -660,13 +656,13 @@ void Edit::ImplRepaint(bool bLayout)
             else
                 SetTextFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() );
         }
-        DrawText( aPos, aText, nStart, nEnd - nStart );
+        DrawText( aPos, aText, 0, nLen );
 
         // draw highlighted text
         SetClipRegion( aHiglightClipRegion );
         SetTextColor( rStyleSettings.GetHighlightTextColor() );
         SetTextFillColor( rStyleSettings.GetHighlightColor() );
-        DrawText( aPos, aText, nStart, nEnd - nStart );
+        DrawText( aPos, aText, 0, nLen );
 
         // if IME info exists loop over portions and output different font attributes
         if( mpIMEInfos && mpIMEInfos->pAttribs )
@@ -730,7 +726,7 @@ void Edit::ImplRepaint(bool bLayout)
                             SetTextColor( Color( COL_LIGHTGRAY ) );
 
                         SetClipRegion( aClip );
-                        DrawText( aPos, aText, nStart, nEnd - nStart );
+                        DrawText( aPos, aText, 0, nLen );
                     }
                 }
             }
@@ -743,8 +739,7 @@ void Edit::ImplRepaint(bool bLayout)
     if ( bVisCursor && ( !mpIMEInfos || mpIMEInfos->bCursor ) )
         pCursor->Show();
 
-    if( pDXBuffer )
-        delete [] pDXBuffer;
+    delete [] pDXBuffer;
 }
 
 // -----------------------------------------------------------------------
commit a4bcd0f35ae89625ce6f1f1014514a3b478e1073
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 24 21:05:33 2014 +0000

    coverity#1158380 Uncaught exception
    
    Change-Id: I5bd8f6e3e4c0b6baf3b0333c2dd8d3f03bf59983

diff --git a/sc/source/ui/Accessibility/AccessibleContextBase.cxx b/sc/source/ui/Accessibility/AccessibleContextBase.cxx
index 121d3e3..c5c287b 100644
--- a/sc/source/ui/Accessibility/AccessibleContextBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleContextBase.cxx
@@ -259,7 +259,8 @@ sal_Int32 SAL_CALL ScAccessibleContextBase::getAccessibleChildCount()
 
 uno::Reference<XAccessible> SAL_CALL
     ScAccessibleContextBase::getAccessibleChild(sal_Int32 /* nIndex */)
-        throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+        throw (lang::IndexOutOfBoundsException, uno::RuntimeException,
+               std::exception)
 {
     OSL_FAIL("should be implemented in the abrevated class");
     return uno::Reference<XAccessible>();
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 0a7a900..2cd9d92 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1500,7 +1500,7 @@ sal_Int32 SAL_CALL ScAccessibleDocumentPagePreview::getAccessibleChildCount()
 }
 
 uno::Reference<XAccessible> SAL_CALL ScAccessibleDocumentPagePreview::getAccessibleChild(sal_Int32 nIndex)
-                throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+    throw (uno::RuntimeException, lang::IndexOutOfBoundsException, std::exception)
 {
     SolarMutexGuard aGuard;
     IsObjectValid();
diff --git a/sc/source/ui/inc/AccessibleContextBase.hxx b/sc/source/ui/inc/AccessibleContextBase.hxx
index eb0da27..5123c0b 100644
--- a/sc/source/ui/inc/AccessibleContextBase.hxx
+++ b/sc/source/ui/inc/AccessibleContextBase.hxx
@@ -148,7 +148,8 @@ public:
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
         getAccessibleChild(sal_Int32 nIndex)
         throw (::com::sun::star::uno::RuntimeException,
-                ::com::sun::star::lang::IndexOutOfBoundsException);
+               ::com::sun::star::lang::IndexOutOfBoundsException,
+               std::exception);
 
     /// Return a reference to the parent.
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
diff --git a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
index 15caf19..474f223 100644
--- a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
+++ b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
@@ -72,7 +72,8 @@ public:
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
         getAccessibleChild(sal_Int32 nIndex)
         throw (::com::sun::star::uno::RuntimeException,
-                ::com::sun::star::lang::IndexOutOfBoundsException);
+               ::com::sun::star::lang::IndexOutOfBoundsException,
+               std::exception);
 
     /// Return the set of current states.
     virtual ::com::sun::star::uno::Reference<
commit 7106e437bc3eec7a601624d5628c3b5e96a01814
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 24 21:03:48 2014 +0000

    1158273 Uncaught exception
    
    Change-Id: I3983da2d585762d81446902a710e9a97c6354669

diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index ff384f0..0361ba8 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -203,7 +203,7 @@ public:
     ~FastSaxParserImpl();
 
     // XFastParser
-    void parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+    void parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception);
     void setFastDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException);
     void setTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException);
     void registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
@@ -795,7 +795,8 @@ void FastSaxParserImpl::splitName( const XML_Char *pwName, const XML_Char *&rpPr
 * the file-specific initialization work. (During a parser run, external files may be opened)
 *
 ****************/
-void FastSaxParserImpl::parseStream( const InputSource& maStructSource) throw (SAXException, IOException, RuntimeException)
+void FastSaxParserImpl::parseStream(const InputSource& maStructSource)
+    throw (SAXException, IOException, RuntimeException, std::exception)
 {
     // Only one text at one time
     MutexGuard guard( maMutex );
commit 8674cf050da1042ad123972a7a50503a3a168bd9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 24 20:57:07 2014 +0000

    coverity#1158196 Dereference null return value
    
    Change-Id: Ic2125631e1986f851296406e91f3cf89bd982915

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 20fa739..af08976 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1536,11 +1536,13 @@ void WW8Export::OutGrfBullets(const sw::Frame & rFrame)
 int MSWordExportBase::GetGrfIndex(const SvxBrushItem& rBrush)
 {
     int nIndex = -1;
-    if ( rBrush.GetGraphic() )
+
+    const Graphic* pGraphic = rBrush.GetGraphic();
+    if (pGraphic)
     {
         for (size_t i = 0; i < m_vecBulletPic.size(); ++i)
         {
-            if (m_vecBulletPic[i]->GetChecksum() == rBrush.GetGraphic()->GetChecksum())
+            if (m_vecBulletPic[i]->GetChecksum() == pGraphic->GetChecksum())
             {
                 nIndex = i;
                 break;
commit ad58005cbe18ba1181de47bd949bfe154f1838a3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 24 20:55:33 2014 +0000

    coverity#1158199 Dereference null return value
    
    Change-Id: I87c5193ed4a605e85bb57bd0991725202c871966

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index f0a4886..8287d7e 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -3694,6 +3694,7 @@ sal_uInt16 PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, sal_uLong
                 0xFFFF, MENUITEM_STRING, 0, aTmpEntryText, Image(), NULL, 0xFFFF, OString() );
             size_t nPos = 0;
             pData = pItemList->GetData( pData->nId, nPos );
+            assert(pData);
             pData->bIsTemporary = true;
             ImplCallEventListeners(VCLEVENT_MENU_SUBMENUCHANGED, nPos);
         }


More information about the Libreoffice-commits mailing list