[Libreoffice-commits] core.git: 7 commits - editeng/source include/editeng offapi/com sfx2/source svtools/source sw/source

Caolán McNamara caolanm at redhat.com
Sun Jul 6 07:15:42 PDT 2014


 editeng/source/accessibility/AccessibleEditableTextPara.cxx     |    2 
 include/editeng/AccessibleEditableTextPara.hxx                  |    2 
 offapi/com/sun/star/accessibility/XAccessibleTextAttributes.idl |    4 -
 sfx2/source/dialog/dinfdlg.cxx                                  |   12 +--
 svtools/source/contnr/imivctl1.cxx                              |    8 +-
 svtools/source/contnr/imivctl2.cxx                              |    4 -
 sw/source/core/docnode/ndtbl.cxx                                |    3 
 sw/source/filter/ww8/ww8par.cxx                                 |   39 ++++++----
 8 files changed, 46 insertions(+), 28 deletions(-)

New commits:
commit 55aa83da68e61fba781e8771d426035468483509
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 6 14:53:46 2014 +0100

    coverity#706073 Unintended sign extension
    
    Change-Id: I13272490bf8a08cbfb1ffc37828fb30fb92f9139

diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx
index 0c48a7c..badf45c 100644
--- a/svtools/source/contnr/imivctl2.cxx
+++ b/svtools/source/contnr/imivctl2.cxx
@@ -635,9 +635,9 @@ GridId IcnGridMap_Impl::GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY )
 {
     Create();
     if( _pView->nWinBits & WB_ALIGN_TOP )
-        return nGridX + ( nGridY * _nGridCols );
+        return nGridX + ( static_cast<GridId>(nGridY) * _nGridCols );
     else
-        return nGridY + ( nGridX * _nGridRows );
+        return nGridY + ( static_cast<GridId>(nGridX) * _nGridRows );
 }
 
 GridId IcnGridMap_Impl::GetGrid( const Point& rDocPos, bool* pbClipped )
commit d9f585b89bfcbfda47d718a15af52ce66390dd28
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 6 14:51:38 2014 +0100

    coverity#706065 Unintended sign extension
    
    Change-Id: If482c75af5128778a176c40e38000b78f2087131

diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index d7ccee1..6b00f95 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -3606,14 +3606,14 @@ sal_uLong SvxIconChoiceCtrl_Impl::GetPredecessorGrid( const Point& rPos) const
     Point aPos( rPos );
     aPos.X() -= LROFFS_WINBORDER;
     aPos.Y() -= TBOFFS_WINBORDER;
-    sal_uInt16 nMaxCol = (sal_uInt16)(aVirtOutputSize.Width() / nGridDX);
+    long nMaxCol = aVirtOutputSize.Width() / nGridDX;
     if( nMaxCol )
         nMaxCol--;
-    sal_uInt16 nGridX = (sal_uInt16)(aPos.X() / nGridDX);
+    long nGridX = aPos.X() / nGridDX;
     if( nGridX > nMaxCol )
         nGridX = nMaxCol;
-    sal_uInt16 nGridY = (sal_uInt16)(aPos.Y() / nGridDY);
-    sal_uInt16 nGridsX = (sal_uInt16)(aOutputSize.Width() / nGridDX);
+    long nGridY = aPos.Y() / nGridDY;
+    long nGridsX = aOutputSize.Width() / nGridDX;
     sal_uLong nGrid = (nGridY * nGridsX) + nGridX;
     long nMiddle = (nGridX * nGridDX) + (nGridDX / 2);
     if( rPos.X() < nMiddle )
commit bbda99198c950b6cfe4bab140b9ad676699fef7b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 6 14:49:43 2014 +0100

    coverity#706056 Unintended sign extension
    
    Change-Id: Iafb36f8135893186710ae3a939e50596a372d065

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 71e6d38..7073d5a 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2019,9 +2019,10 @@ IMPL_LINK_NOARG(CustomPropertiesControl, RemovedHdl)
 void CustomPropertiesControl::AddLine( const OUString& sName, Any& rAny, bool bInteractive )
 {
     m_pPropertiesWin->AddLine( sName, rAny );
-    m_pVertScroll->SetRangeMax( m_pPropertiesWin->GetVisibleLineCount() + 1 );
-    if ( bInteractive && m_pPropertiesWin->GetOutputSizePixel().Height() < m_pPropertiesWin->GetVisibleLineCount() * m_pPropertiesWin->GetLineHeight() )
-        m_pVertScroll->DoScroll( m_pPropertiesWin->GetVisibleLineCount() + 1 );
+    long nLineCount = m_pPropertiesWin->GetVisibleLineCount();
+    m_pVertScroll->SetRangeMax(nLineCount + 1);
+    if ( bInteractive && m_pPropertiesWin->GetOutputSizePixel().Height() < nLineCount * m_pPropertiesWin->GetLineHeight() )
+        m_pVertScroll->DoScroll(nLineCount + 1);
 }
 
 // class SfxCustomPropertiesPage -----------------------------------------
commit 3223306b5c37fd846f52e36020a33c08185e4a79
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 6 14:48:46 2014 +0100

    coverity#706055 Unintended sign extension
    
    Change-Id: Ie917cfd5f41a6f5e58a4c629a6a5b800e2e0b42f

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 0cd33f9..71e6d38 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2009,8 +2009,9 @@ IMPL_LINK( CustomPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
 
 IMPL_LINK_NOARG(CustomPropertiesControl, RemovedHdl)
 {
-    m_pVertScroll->SetRangeMax( m_pPropertiesWin->GetVisibleLineCount() + 1 );
-    if ( m_pPropertiesWin->GetOutputSizePixel().Height() < m_pPropertiesWin->GetVisibleLineCount() * m_pPropertiesWin->GetLineHeight() )
+    long nLineCount = m_pPropertiesWin->GetVisibleLineCount();
+    m_pVertScroll->SetRangeMax(nLineCount + 1);
+    if ( m_pPropertiesWin->GetOutputSizePixel().Height() < nLineCount * m_pPropertiesWin->GetLineHeight() )
         m_pVertScroll->DoScrollAction ( SCROLL_LINEUP );
     return 0;
 }
commit 6db415b15085d5058c805a7bbaa5d34acfba7c1b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 6 14:45:13 2014 +0100

    coverity#706504 Uncaught exception
    
    Change-Id: I727779317672fe58c440aee76762d0a9ae28d8ca

diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index ffb0021..da5e7c2 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -2447,7 +2447,7 @@ namespace accessibility
     // XAccessibleTextAttributes
     uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getDefaultAttributes(
             const uno::Sequence< OUString >& rRequestedAttributes )
-        throw (uno::RuntimeException, std::exception)
+        throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     {
         SolarMutexGuard aGuard;
 
diff --git a/include/editeng/AccessibleEditableTextPara.hxx b/include/editeng/AccessibleEditableTextPara.hxx
index 4daa115..329783e 100644
--- a/include/editeng/AccessibleEditableTextPara.hxx
+++ b/include/editeng/AccessibleEditableTextPara.hxx
@@ -147,7 +147,7 @@ namespace accessibility
         virtual sal_Bool SAL_CALL setText( const OUString& sText ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
         // XAccessibleTextAttributes
-        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
         // XAccessibleHypertext
diff --git a/offapi/com/sun/star/accessibility/XAccessibleTextAttributes.idl b/offapi/com/sun/star/accessibility/XAccessibleTextAttributes.idl
index e343717..de07fb0 100644
--- a/offapi/com/sun/star/accessibility/XAccessibleTextAttributes.idl
+++ b/offapi/com/sun/star/accessibility/XAccessibleTextAttributes.idl
@@ -22,6 +22,7 @@
 
 #include <com/sun/star/lang/IndexOutOfBoundsException.idl>
 #include <com/sun/star/beans/PropertyValue.idl>
+#include <com/sun/star/beans/UnknownPropertyException.idl>
 
 module com { module sun { module star { module accessibility {
 
@@ -52,7 +53,8 @@ interface XAccessibleTextAttributes
             object.
     */
     sequence<::com::sun::star::beans::PropertyValue>
-        getDefaultAttributes ( [in] sequence<string> RequestedAttributes );
+        getDefaultAttributes ( [in] sequence<string> RequestedAttributes )
+        raises ( ::com::sun::star::beans::UnknownPropertyException );
 
     /** Get the run attribute set for the specified position.
 
commit f816087a1f2058f74472508c54038507329f966d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 4 17:06:16 2014 +0100

    coverity#704523 Division or modulo by zero
    
    Change-Id: I165687b22f70a03d4bcb669a04d3495454d09042

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index b8bc0b4..327e9fa 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1303,8 +1303,9 @@ lcl_SetTableBoxWidths2(SwTable & rTable, size_t const nMaxBoxes,
         {
             // default width for box at the end of an incomplete line
             SwTableBoxFmt *const pNewFmt = rDoc.MakeTableBoxFmt();
+            size_t nWidth = nMaxBoxes ? USHRT_MAX / nMaxBoxes : USHRT_MAX;
             pNewFmt->SetFmtAttr( SwFmtFrmSize(ATT_VAR_SIZE,
-                        (USHRT_MAX / nMaxBoxes) * (nMissing + 1)) );
+                        nWidth * (nMissing + 1)) );
             pNewFmt->Add(rBoxes.back());
         }
     }
commit b1cd83c625a2afeb9da43cc9745d79c01963c797
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 4 16:50:54 2014 +0100

    fix crash loading ooo#93570-3.doc
    
    regression from f2945255df273404ee2457dcf761cb8f334b732b
    cp#2013101510000026: doc import of comments affecting more text nodes
    
    use Move(fnMoveBackward, fnGoNode) to at least ensure we stop going
    backwards when we run out of valid places to go backwards to.
    
    This still isn't great because the distance between two msword character
    indexes only equates to the same distance between our characters in the very
    simple cases
    
    Change-Id: I248fd12c067577d2f1fd64f48583321eb6d453e4

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 53d7aa5..8289820 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2170,9 +2170,18 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
             {
                 WW8_CP nStart = GetAnnotationStart(nAtnIndex);
                 WW8_CP nEnd = GetAnnotationEnd(GetAnnotationEndIndex(nAtnIndex));
+                //It is unfortunately fragile and wrong to assume that two
+                //character positions in the original word document, which is
+                //what nStart and nEnd are, will equate to the same length in
+                //the destination writer document.
+                //
+                //Better would be, while writing the content into the writer
+                //document to store the equivalent writer document positions
+                //that relate to each annotation index as the parser passes
+                //those points.
                 sal_Int32 nLen = nEnd - nStart;
                 if( nLen )
-                 {
+                {
                     if (pPaM->GetPoint()->nContent.GetIndex() >= nLen)
                     {
                         pPaM->SetMark();
@@ -2184,24 +2193,28 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
                         nLen -= pPaM->GetPoint()->nContent.GetIndex();
 
                         SwTxtNode* pTxtNode = 0;
-                        // Find first text node which affected by the comment
-                        while( pPaM->GetPoint()->nNode >= 0 )
+
+                        // Find first text node which is affected by the comment
+                        while (nLen > 0)
                         {
-                            SwNode* pNode = 0;
-                            // Find previous text node
-                            do
+                            // Move to previous content node
+                            bool bSuccess = pPaM->Move(fnMoveBackward, fnGoNode);
+
+                            if (!bSuccess)
                             {
-                                pPaM->GetPoint()->nNode--;
-                                nLen--; // End line character
-                                pNode = &pPaM->GetPoint()->nNode.GetNode();
+                                nLen = 0;
+                                break;
                             }
-                            while( !pNode->IsTxtNode() && pPaM->GetPoint()->nNode >= 0 );
+
+                            --nLen; // End line character
+
+                            SwNode& rNode = pPaM->GetPoint()->nNode.GetNode();
 
                             // Subtract previous text node's length
-                            if( pNode->IsTxtNode() )
+                            if (rNode.IsTxtNode())
                             {
-                                pTxtNode = pNode->GetTxtNode();
-                                if( nLen < pTxtNode->Len() )
+                                pTxtNode = rNode.GetTxtNode();
+                                if (nLen < pTxtNode->Len())
                                     break;
                                 else
                                     nLen -= pTxtNode->Len();


More information about the Libreoffice-commits mailing list