[Libreoffice-commits] core.git: 23 commits - chart2/source comphelper/source desktop/unx filter/source include/comphelper sal/osl sc/qa sc/source sd/source svx/source sw/qa sw/source tools/source vcl/generic vcl/qa vcl/source writerperfect/source

Caolán McNamara caolanm at redhat.com
Fri Oct 10 04:50:55 PDT 2014


 chart2/source/tools/MediaDescriptorHelper.cxx           |    1 
 comphelper/source/eventattachermgr/eventattachermgr.cxx |   17 +++++--
 comphelper/source/misc/syntaxhighlight.cxx              |    2 
 desktop/unx/source/splashx.c                            |   30 -------------
 filter/source/graphicfilter/icgm/class5.cxx             |    8 ++-
 include/comphelper/propertysethelper.hxx                |    2 
 sal/osl/unx/file.cxx                                    |   35 ++++++++--------
 sc/qa/unit/ucalc.cxx                                    |    1 
 sc/source/ui/navipi/navipi.cxx                          |    4 -
 sd/source/filter/ppt/pptin.cxx                          |    4 -
 sd/source/ui/func/fudraw.cxx                            |    1 
 sd/source/ui/unoidl/UnoDocumentSettings.cxx             |    4 -
 sd/source/ui/view/drviews1.cxx                          |    5 --
 svx/source/table/tablecontroller.cxx                    |    2 
 sw/qa/extras/inc/swmodeltestbase.hxx                    |    3 -
 sw/source/core/layout/fly.cxx                           |   16 +++++--
 sw/source/core/layout/flycnt.cxx                        |    2 
 sw/source/ui/index/cnttab.cxx                           |    1 
 tools/source/generic/config.cxx                         |    2 
 vcl/generic/fontmanager/fontmanager.cxx                 |    4 -
 vcl/generic/glyphs/gcach_ftyp.cxx                       |    5 +-
 vcl/qa/cppunit/fontcharmap.cxx                          |   10 ++--
 vcl/source/gdi/bmpfast.cxx                              |   35 ++--------------
 writerperfect/source/common/WPXSvInputStream.cxx        |    4 -
 24 files changed, 84 insertions(+), 114 deletions(-)

New commits:
commit 91b65e0a73b35a745921831b73f5f4589bb889b7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 09:58:04 2014 +0100

    coverity#1242395 Don't call random
    
    Change-Id: Idd4adac71222e03d85446c86f1c086ce32528bd6
    mmeeks: just chop that else {} block out in splashx and good riddance

diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c
index 71cde42..a300a02 100644
--- a/desktop/unx/source/splashx.c
+++ b/desktop/unx/source/splashx.c
@@ -354,36 +354,6 @@ static void create_pixmap(struct splash* splash)
         XPutImage( splash->display, pixmap, pixmap_gc, image, 0, 0, 0, 0, splash->width, splash->height );
         XDestroyImage( image );
     }
-    else //if ( depth == 1 || visual->class == DirectColor )
-    {
-        // FIXME Something like the following, but faster ;-) - XDrawPoint is not
-        // a good idea...
-        int x, y;
-        for ( y = 0; y < splash->height; ++y )
-        {
-            color_t* color = (color_t *)&(splash->bitmap_rows[y]);
-
-            int delta = 0;
-            for ( x = 0; x < splash->width; ++x, ++color )
-            {
-                int rnd = (int)( ( (long)( random() - RAND_MAX/2 ) * 32000 )/RAND_MAX );
-                int luminance = delta + rnd + 299 * (int)color->r + 587 * (int)color->g + 114 * (int)color->b;
-
-                if ( luminance < 128000 )
-                {
-                    XSetForeground( splash->display, pixmap_gc, BlackPixel( splash->display, splash->screen ) );
-                    delta = luminance;
-                }
-                else
-                {
-                    XSetForeground( splash->display, pixmap_gc, WhitePixel( splash->display, splash->screen ) );
-                    delta = luminance - 255000;
-                }
-
-                XDrawPoint( splash->display, pixmap, pixmap_gc, x, y );
-            }
-        }
-    }
 
     XSetWindowBackgroundPixmap( splash->display, splash->win, pixmap );
 
commit cb02551714ca65145d4476f3525c0c7ad1d04f66
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 10:03:06 2014 +0100

    coverity#1242472 gold, Identical code for different branches
    
    Change-Id: Ibdba24ef03ee4732e216b32b3f9e665706e96e4a

diff --git a/filter/source/graphicfilter/icgm/class5.cxx b/filter/source/graphicfilter/icgm/class5.cxx
index 99c2a81..a1a9bfb 100644
--- a/filter/source/graphicfilter/icgm/class5.cxx
+++ b/filter/source/graphicfilter/icgm/class5.cxx
@@ -55,7 +55,9 @@ void CGM::ImplDoClass5()
             else
                 nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25; // scaling in 1/4 mm
 
-            pElement->aLineBundle.nLineWidth = nWidth;
+            ( pElement->nAspectSourceFlags & ASF_LINEWIDTH )
+                ? pElement->pLineBundle->nLineWidth = nWidth
+                    : pElement->aLineBundle.nLineWidth = nWidth;
         }
         break;
         case 0x04 : /*Line Color*/
@@ -91,7 +93,7 @@ void CGM::ImplDoClass5()
             else
                 nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25;
             ( pElement->nAspectSourceFlags & ASF_MARKERSIZE )
-                ? pElement->aMarkerBundle.nMarkerSize = nWidth
+                ? pElement->pMarkerBundle->nMarkerSize = nWidth
                     : pElement->aMarkerBundle.nMarkerSize = nWidth;
         }
         break;
@@ -269,7 +271,7 @@ void CGM::ImplDoClass5()
             else
                 nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25;
             ( pElement->nAspectSourceFlags & ASF_EDGEWIDTH )
-                ? pElement->aEdgeBundle.nEdgeWidth = nWidth
+                ? pElement->pEdgeBundle->nEdgeWidth = nWidth
                     : pElement->aEdgeBundle.nEdgeWidth = nWidth;
         }
         break;
commit 30bebeefa0b6bccae7d15937509f506e4cc0c139
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:50:44 2014 +0100

    coverity#1240258 Operands don't affect result
    
    try and silence
    
    coverity#1240258 Operands don't affect result
    and
    coverity#1240255 Operands don't affect result
    
    Change-Id: If53ff385585567e9b46372f45420c4321811bca0

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 0e0e388..e9d91b4 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -1095,6 +1095,11 @@ SAL_CALL osl_syncFile(oslFileHandle Handle)
     return osl_File_E_None;
 }
 
+inline off_t max_off_t()
+{
+    return std::numeric_limits< off_t >::max();
+}
+
 oslFileError
 SAL_CALL osl_mapFile (
     oslFileHandle Handle,
@@ -1114,8 +1119,8 @@ SAL_CALL osl_mapFile (
         return osl_File_E_OVERFLOW;
     size_t const nLength = sal::static_int_cast< size_t >(uLength);
 
-    static sal_uInt64 const g_limit_off_t = std::numeric_limits< off_t >::max();
-    if (g_limit_off_t < uOffset)
+    sal_uInt64 const limit_off_t = max_off_t();
+    if (uOffset > limit_off_t)
         return osl_File_E_OVERFLOW;
 
     if (pImpl->m_kind == FileHandle_Impl::KIND_MEM)
@@ -1319,8 +1324,8 @@ SAL_CALL osl_readFileAt (
     if (0 == (pImpl->m_state & FileHandle_Impl::STATE_SEEKABLE))
         return osl_File_E_SPIPE;
 
-    static sal_uInt64 const g_limit_off_t = std::numeric_limits< off_t >::max();
-    if (g_limit_off_t < uOffset)
+    sal_uInt64 const limit_off_t = max_off_t();
+    if (uOffset > limit_off_t)
         return osl_File_E_OVERFLOW;
     off_t const nOffset = sal::static_int_cast< off_t >(uOffset);
 
@@ -1351,8 +1356,8 @@ SAL_CALL osl_writeFileAt (
     if (0 == (pImpl->m_state & FileHandle_Impl::STATE_WRITEABLE))
         return osl_File_E_BADF;
 
-    static sal_uInt64 const g_limit_off_t = std::numeric_limits< off_t >::max();
-    if (g_limit_off_t < uOffset)
+    sal_uInt64 const limit_off_t = max_off_t();
+    if (limit_off_t < uOffset)
         return osl_File_E_OVERFLOW;
     off_t const nOffset = sal::static_int_cast< off_t >(uOffset);
 
@@ -1400,8 +1405,8 @@ SAL_CALL osl_setFilePos (oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uOffse
     if ((0 == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && (-1 == pImpl->m_fd)))
         return osl_File_E_INVAL;
 
-    static sal_Int64 const g_limit_off_t = std::numeric_limits< off_t >::max();
-    if (g_limit_off_t < uOffset)
+    sal_Int64 const limit_off_t = max_off_t();
+    if (uOffset > limit_off_t)
         return osl_File_E_OVERFLOW;
     off_t nPos = 0, nOffset = sal::static_int_cast< off_t >(uOffset);
 
@@ -1417,7 +1422,7 @@ SAL_CALL osl_setFilePos (oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uOffse
             nPos = sal::static_int_cast< off_t >(pImpl->getPos());
             if ((0 > nOffset) && (-1*nOffset > nPos))
                 return osl_File_E_INVAL;
-            if (g_limit_off_t < (sal_Int64) nPos + nOffset)
+            if (limit_off_t < (sal_Int64) nPos + nOffset)
                 return osl_File_E_OVERFLOW;
             break;
 
@@ -1425,7 +1430,7 @@ SAL_CALL osl_setFilePos (oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uOffse
             nPos = sal::static_int_cast< off_t >(pImpl->getSize());
             if ((0 > nOffset) && (-1*nOffset > nPos))
                 return osl_File_E_INVAL;
-            if (g_limit_off_t < (sal_Int64) nPos + nOffset)
+            if (limit_off_t < (sal_Int64) nPos + nOffset)
                 return osl_File_E_OVERFLOW;
             break;
 
@@ -1459,8 +1464,8 @@ SAL_CALL osl_setFileSize( oslFileHandle Handle, sal_uInt64 uSize )
     if (0 == (pImpl->m_state & FileHandle_Impl::STATE_WRITEABLE))
         return osl_File_E_BADF;
 
-    static sal_uInt64 const g_limit_off_t = std::numeric_limits< off_t >::max();
-    if (g_limit_off_t < uSize)
+    sal_uInt64 const limit_off_t = max_off_t();
+    if (uSize > limit_off_t)
         return osl_File_E_OVERFLOW;
 
     oslFileError result = pImpl->syncFile();
commit e263abafa09520765e29ce420fe8005d6f3e6fbe
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:40:04 2014 +0100

    coverity#706275 Uncaught exception
    
    Change-Id: I538cca9505411e8984ba821807c0072c0ce40e7b

diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 21d8c39..1b5c228 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/io/XPersistObject.hpp>
 #include <com/sun/star/io/XObjectOutputStream.hpp>
 #include <com/sun/star/io/XMarkableStream.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/reflection/theCoreReflection.hpp>
@@ -244,7 +245,6 @@ void AttacherAllListener_Impl::convertToEventReturn( Any & rRet, const Type & rR
     }
 }
 
-
 // Methods of XAllListener
 Any SAL_CALL AttacherAllListener_Impl::approveFiring( const AllEventObject& Event )
     throw( InvocationTargetException, RuntimeException, std::exception )
@@ -314,7 +314,7 @@ Any SAL_CALL AttacherAllListener_Impl::approveFiring( const AllEventObject& Even
                     break;
             }
         }
-        catch( CannotConvertException& )
+        catch (const CannotConvertException&)
         {
             // silent ignore conversions errors from a script call
             Reference< XIdlClass > xListenerType = mpManager->getReflection()->
@@ -325,14 +325,22 @@ Any SAL_CALL AttacherAllListener_Impl::approveFiring( const AllEventObject& Even
                 Reference< XIdlClass > xRetType = xMeth->getReturnType();
                 Type aRetType(xRetType->getTypeClass(), xRetType->getName());
                 aRet.clear();
-                convertToEventReturn( aRet, aRetType );
+                try
+                {
+                    convertToEventReturn( aRet, aRetType );
+                }
+                catch (const CannotConvertException& e)
+                {
+                    throw css::lang::WrappedTargetRuntimeException(
+                        "wrapped CannotConvertException " + e.Message,
+                        css::uno::Reference<css::uno::XInterface>(), makeAny(e));
+                }
             }
         }
     }
     return aRet;
 }
 
-
 // Methods of XEventListener
 void SAL_CALL AttacherAllListener_Impl::disposing(const EventObject& )
     throw( RuntimeException, std::exception )
@@ -340,7 +348,6 @@ void SAL_CALL AttacherAllListener_Impl::disposing(const EventObject& )
     // It is up to the container to release the object
 }
 
-
 // Constructor method for EventAttacherManager
 Reference< XEventAttacherManager > createEventAttacherManager( const Reference< XComponentContext > & rxContext )
     throw( Exception )
commit 8a2da50632059be5845c0bf6c2fbbf7d7e560c43
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:30:11 2014 +0100

    coverity#704776 Dereference after null check
    
    Change-Id: Ifbad1fc30665ff6b9238b5fb4728fc302b0458fa

diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 588cc50..93814cc 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -850,8 +850,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
             }
         }
 
-        if( mpDrawView )
-            mpDrawView->SdrEndTextEdit();
+        mpDrawView->SdrEndTextEdit();
 
         mpActualPage = NULL;
 
@@ -984,7 +983,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
             /**********************************************************************
             * MASTERPAGE
             **********************************************************************/
-            SdrPageView* pPageView = mpDrawView ? mpDrawView->GetSdrPageView() : NULL;
+            SdrPageView* pPageView = mpDrawView->GetSdrPageView();
 
             if (pPageView)
             {
commit 7d746fe50b991a51527aabbadd152ec705c683b3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:28:08 2014 +0100

    coverity#704901 Dereference after null check
    
    Change-Id: I6a44577d7520a8faebdf3a6e8de1c91a6e465bac

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 9299a21..d0b8975 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -858,11 +858,19 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
             }
 
             SwFmtURL aURL( GetFmt()->GetURL() );
-            if ( aURL.GetMap() )
+
+            SwFmtFrmSize *pNewFmtFrmSize = NULL;
+            SwFmtChg *pOldFmtChg = NULL;
+            if (nWhich == RES_FRM_SIZE)
+                pNewFmtFrmSize = (SwFmtFrmSize*)pNew;
+            else
+                pOldFmtChg = (SwFmtChg*)pOld;
+
+            if (aURL.GetMap() && (pNewFmtFrmSize || pOldFmtChg))
             {
-                const SwFmtFrmSize &rOld = nWhich == RES_FRM_SIZE ?
-                                *(SwFmtFrmSize*)pNew :
-                                ((SwFmtChg*)pOld)->pChangedFmt->GetFrmSize();
+                const SwFmtFrmSize &rOld = pNewFmtFrmSize ?
+                                *pNewFmtFrmSize :
+                                pOldFmtChg->pChangedFmt->GetFrmSize();
                 //#35091# Can be "times zero", when loading the template
                 if ( rOld.GetWidth() && rOld.GetHeight() )
                 {
commit 353ef256b1a09ec431c3397c9ed8e232b713765d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:22:31 2014 +0100

    coverity#735906 Dereference after null check
    
    Change-Id: If81f0e18d5236873628301173d07f22d52c4fb0a

diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 7b06f09..0626338 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -642,7 +642,7 @@ static const SwFrm * lcl_CalcDownDist( SwDistance &rRet,
             {
                 bSct = false;
                 const SwSectionFrm* pNxtSect = pLay ? pLay->FindSctFrm() : 0;
-                if( pSect->IsAnFollow( pNxtSect ) )
+                if (pSect->IsAnFollow(pNxtSect) && pLay)
                 {
                     if( pLay->IsVertical() )
                     {
commit 4525355aeeb56826717c3a59dece690b4f783dce
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:20:28 2014 +0100

    coverity#1241199 Unchecked dynamic_cast
    
    Change-Id: I8522084c4b6036d63b144af70bf25312f897ff7d

diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 2e7bf18..980b728 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -574,7 +574,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs )
                 CellRef xSourceCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nPropSrcCol, nRow ).get() ) );
 
                 // When we insert new COLUMNs, we want to copy ROW spans.
-                if( nRowSpan == 0 )
+                if (xSourceCell.is() && nRowSpan == 0)
                 {
                     // we are not in a span yet. Let's find out if the current cell is in a span.
                     sal_Int32 nColSpan = sal_Int32();
commit 4bacf63db7cccd6be6497ac14365cbcf9b7b1429
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:13:06 2014 +0100

    fix coverity#1242413 Logically dead code
    
    Change-Id: Ic56eff808cd4254448f63127da9b5b1d54c733a0

diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index e37baa1..6dde76c 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -525,11 +525,11 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper(
     sal_uInt16 nCmdId;
     switch (eNavMode)
     {
-        case NAV_LMODE_DOCS:        nCmdId = IID_DOCS;      break;
+        case NAV_LMODE_SCENARIOS:   nCmdId = IID_SCENARIOS; break;
         case NAV_LMODE_AREAS:       nCmdId = IID_AREAS;     break;
 // The follwing case can never be reach due to how eNavMode is set-up
+//        case NAV_LMODE_DOCS:        nCmdId = IID_DOCS;      break;
 //        case NAV_LMODE_DBAREAS:     nCmdId = IID_DBAREAS;   break;
-//        case NAV_LMODE_SCENARIOS:   nCmdId = IID_SCENARIOS; break;
         default:                    nCmdId = 0;
     }
     if (nCmdId)
commit edaee2352bcd470e150338c4c19722a6b26784fb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:06:47 2014 +0100

    coverity#1242878 Unused value
    
    Change-Id: I85bc3fffb2d350a13aeb30c75f0c2d0a7bc5e7a3

diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx
index d0546bb..76b72b1 100644
--- a/comphelper/source/misc/syntaxhighlight.cxx
+++ b/comphelper/source/misc/syntaxhighlight.cxx
@@ -488,7 +488,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken( const sal_Unicode*& pos, /*out*
 
                 // Read all numbers
                 while( testCharFlags( *pos, CHAR_IN_OCT_NUMBER ) )
-                    c = *pos++;
+                    ++pos;
             }
             // Hexadecimal?
             else if( *pos == 'h' || *pos == 'H' )
commit e18258411d8c69e41e480aeea71dda366108d59f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 11:03:50 2014 +0100

    coverity#1242762 Unused value
    
    Change-Id: I096f85627351c6de067c7fc686af8cbb47e58190

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 4a146a1..4b8cff8 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2677,7 +2677,6 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL)
             {
                 if( !bLastWasText )
                 {
-                    bLastWasText = true;
                     SwFormToken aTemp(TOKEN_TEXT);
                     Control* pCtrl = InsertItem(aEmptyOUStr, aTemp);
                     if(!pSetActiveControl)
commit 51f7c69f4f07a00363c84097744f1a2bbcdc309a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 10:44:56 2014 +0100

    coverity#1240260 Operands don't affect result
    
    see can we silence these false positives
    
    coverity#1240259 Operands don't affect result
    coverity#1240254 Operands don't affect result
    coverity#1240264 Operands don't affect result
    coverity#1240267 Operands don't affect result
    
    Change-Id: Ieca40474c231e33a516b70f7693346ac73babd61

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index a7eaac1..0e0e388 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -1110,8 +1110,7 @@ SAL_CALL osl_mapFile (
         return osl_File_E_INVAL;
     *ppAddr = 0;
 
-    static sal_uInt64 const g_limit_size_t = std::numeric_limits< size_t >::max();
-    if (g_limit_size_t < uLength)
+    if (uLength > SAL_MAX_SIZE)
         return osl_File_E_OVERFLOW;
     size_t const nLength = sal::static_int_cast< size_t >(uLength);
 
@@ -1190,8 +1189,7 @@ unmapFile (void* pAddr, sal_uInt64 uLength)
     if (0 == pAddr)
         return osl_File_E_INVAL;
 
-    static sal_uInt64 const g_limit_size_t = std::numeric_limits< size_t >::max();
-    if (g_limit_size_t < uLength)
+    if (uLength > SAL_MAX_SIZE)
         return osl_File_E_OVERFLOW;
     size_t const nLength = sal::static_int_cast< size_t >(uLength);
 
diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx
index 913a1cf..fdc7336 100644
--- a/tools/source/generic/config.cxx
+++ b/tools/source/generic/config.cxx
@@ -104,7 +104,7 @@ static sal_uInt8* ImplSysReadConfig( const OUString& rFileName,
         sal_uInt64 nPos = 0;
         if( aFile.getSize( nPos ) == ::osl::FileBase::E_None )
         {
-            if (nPos > std::numeric_limits< std::size_t >::max()) {
+            if (nPos > SAL_MAX_SIZE) {
                 aFile.close();
                 return 0;
             }
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index 1f8d575..3c22f9d 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -504,7 +504,7 @@ long WPXSvInputStreamImpl::tell()
     else
     {
         sal_Int64 tmpPosition = mxSeekable->getPosition();
-        if ((tmpPosition < 0) || (tmpPosition > (std::numeric_limits<long>::max)()))
+        if ((tmpPosition < 0) || (tmpPosition > LONG_MAX))
             return -1L;
         return (long)tmpPosition;
     }
@@ -516,7 +516,7 @@ int WPXSvInputStreamImpl::seek(long offset)
         return -1;
 
     sal_Int64 tmpPosition = mxSeekable->getPosition();
-    if ((tmpPosition < 0) || (tmpPosition > (std::numeric_limits<long>::max)()))
+    if ((tmpPosition < 0) || (tmpPosition > LONG_MAX))
         return -1;
 
     try
commit cbdf857299ebff0bcf2d10bf877bc74c2167a4e8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 10:35:03 2014 +0100

    coverity#707673 Uninitialized scalar field
    
    Change-Id: Ic631ebc74e94f4ccf7e3915db3952714fd4d28d4

diff --git a/chart2/source/tools/MediaDescriptorHelper.cxx b/chart2/source/tools/MediaDescriptorHelper.cxx
index 645a54e..4ecf9bb 100644
--- a/chart2/source/tools/MediaDescriptorHelper.cxx
+++ b/chart2/source/tools/MediaDescriptorHelper.cxx
@@ -192,6 +192,7 @@ void MediaDescriptorHelper::impl_init()
 
     ISSET_WinExtent = false;
 
+    SetEmbedded = false;
     ISSET_SetEmbedded = false;
 
     ISSET_Storage = false;
commit 86b0762bbbf1a80ac824b37db386960e2792e6f9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 10:34:08 2014 +0100

    coverity#708132 Uninitialized scalar field
    
    Change-Id: I830210b44459cf94eabb983b99bfcc104f865492

diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index 360aed0..53e64fd 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -79,6 +79,7 @@ FuDraw::FuDraw(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
     , bDragHelpLine(false)
     , nHelpLine(0)
     , bPermanent(false)
+    , bIsImageSelected(false)
 {
 }
 
commit 8e1b4b8109ed2154a44ef6491cddc180cc8616b8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 10:33:16 2014 +0100

    coverity738920 Uninitialized scalar field
    
    Change-Id: Ic1571d24a8a696dc24b899d262b9e560d005ee88

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index fa93fc6..4a8ddd0 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -489,8 +489,6 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FtFontInfo* pFI )
     static_cast<ImplServerFontEntry*>(rFSD.mpFontEntry)->SetServerFont( this );
 
     maFaceFT = pFI->GetFaceFT();
-    if( !maFaceFT )
-        return;
 
     if( rFSD.mnOrientation != 0 )
     {
@@ -508,6 +506,9 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FtFontInfo* pFI )
     if( (mnWidth < 0) || (mfStretch > +64.0) || (mfStretch < -64.0) )
         return;
 
+    if( !maFaceFT )
+        return;
+
     FT_New_Size( maFaceFT, &maSizeFT );
     FT_Activate_Size( maSizeFT );
     FT_Error rc = FT_Set_Pixel_Sizes( maFaceFT, mnWidth, rFSD.mnHeight );
commit 03327cbd668eeb9ef4cf1ede66c3f27e7303c122
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 10:22:31 2014 +0100

    coverity#1242439 ALPHABITS == nAlphaShift == 8
    
    Change-Id: Ifde395113524df03a2523115ab2234403d405455

diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx
index 84004bf..1764dc6 100644
--- a/vcl/source/gdi/bmpfast.cxx
+++ b/vcl/source/gdi/bmpfast.cxx
@@ -267,18 +267,15 @@ inline void ImplConvertLine( const TrueColorPixelPtr<DSTFMT>& rDst,
 }
 
 // alpha blending truecolor pixels
-template <unsigned ALPHABITS, sal_uLong SRCFMT, sal_uLong DSTFMT>
+template <sal_uLong SRCFMT, sal_uLong DSTFMT>
 inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst,
     const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal )
 {
+    static const unsigned nAlphaShift = 8;
     if( !nAlphaVal )
         ImplConvertPixel( rDst, rSrc );
-    else if( nAlphaVal != ~(~0U << ALPHABITS) )
+    else if( nAlphaVal != ~(~0U << nAlphaShift) )
     {
-        static const unsigned nAlphaShift = (ALPHABITS > 8) ? 8 : ALPHABITS;
-        if( ALPHABITS > nAlphaShift )
-            nAlphaVal >>= ALPHABITS - nAlphaShift;
-
         int nR = rDst.GetRed();
         int nS = rSrc.GetRed();
         nR = nS + (((nR - nS) * nAlphaVal) >> nAlphaShift);
@@ -297,7 +294,7 @@ inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst,
     }
 }
 
-template <unsigned ALPHABITS, sal_uLong MASKFMT, sal_uLong SRCFMT, sal_uLong DSTFMT>
+template <sal_uLong MASKFMT, sal_uLong SRCFMT, sal_uLong DSTFMT>
 inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
     const TrueColorPixelPtr<SRCFMT>& rSrc, const TrueColorPixelPtr<MASKFMT>& rMsk,
     int nPixelCount )
@@ -307,7 +304,7 @@ inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
     TrueColorPixelPtr<SRCFMT> aSrc( rSrc );
     while( --nPixelCount >= 0 )
     {
-        ImplBlendPixels<ALPHABITS>( aDst, aSrc, aMsk.GetAlpha() );
+        ImplBlendPixels(aDst, aSrc, aMsk.GetAlpha());
         ++aDst;
         ++aSrc;
         ++aMsk;
@@ -576,7 +573,7 @@ bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine,
     assert(rDstBuffer.mnHeight <= rSrcBuffer.mnHeight && "not sure about that?");
     for (int y = rDstBuffer.mnHeight; --y >= 0;)
     {
-        ImplBlendLines<8>( aDstLine, rSrcLine, aMskLine, rDstBuffer.mnWidth );
+        ImplBlendLines(aDstLine, rSrcLine, aMskLine, rDstBuffer.mnWidth);
         aDstLine.AddByteOffset( nDstLinestep );
         rSrcLine.AddByteOffset( nSrcLinestep );
         aMskLine.AddByteOffset( nMskLinestep );
commit 04301686969bc244dd21a4d41906617e2e95b47e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 10:17:55 2014 +0100

    drop unused ImplBlendLines template
    
    Change-Id: Id680f6031d40f086e74472d14fbf70cbf8cc43a1

diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx
index 7bfb28b..84004bf 100644
--- a/vcl/source/gdi/bmpfast.cxx
+++ b/vcl/source/gdi/bmpfast.cxx
@@ -314,26 +314,6 @@ inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
     }
 }
 
-template <unsigned ALPHABITS, sal_uLong SRCFMT, sal_uLong DSTFMT>
-inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
-    const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal,
-    int nPixelCount )
-{
-    if( nAlphaVal == ~(~0 << ALPHABITS) )
-        ImplConvertLine( rDst, rSrc, nPixelCount );
-    else if( nAlphaVal )
-    {
-        TrueColorPixelPtr<SRCFMT> aSrc( rSrc );
-        TrueColorPixelPtr<DSTFMT> aDst( rDst );
-        while( --nPixelCount >= 0 )
-        {
-            ImplBlendPixels<ALPHABITS>( aDst, aSrc, nAlphaVal );
-            ++aDst;
-            ++aSrc;
-        }
-    }
-}
-
 static bool ImplCopyImage( BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer )
 {
     const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
commit a1b7164742f6e31bd977328417522343b4a237d6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 09:31:10 2014 +0100

    coverity#1242757 Result is not floating-point
    
    there was two of these, see
    
    commit 164bd64255d71d96e35e908f6425acf8372795fb
    Date:   Thu Oct 2 04:44:33 2014 -0500
        coverity#1242757 Result is not floating-point
    
    Change-Id: I1f66191f329b2d87bdeb52aa1a7528ca662064a6

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index d9cd48d..0429ecf 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2414,8 +2414,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                                             if (std::abs(aLogicRect.Left()   - aOutlineRect.Left())   > MAX_USER_MOVE ||
                                                 std::abs(aLogicRect.Top()    - aOutlineRect.Top())    > MAX_USER_MOVE ||
                                                 std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
-                                                    aLogicSize.Width()  / aOutlineSize.Width()   < 0.48          ||
-                                                    aLogicSize.Width()  / aOutlineSize.Width()   > 0.5)
+                                                    (double)aLogicSize.Width()  / aOutlineSize.Width()   < 0.48          ||
+                                                    (double)aLogicSize.Width()  / aOutlineSize.Width()   > 0.5)
                                             {
                                                 pPresObj->SetUserCall(NULL);
                                             }
commit b9d4244b8f71c9d952ef7eb19022eb09cbfe0a46
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 09:28:42 2014 +0100

    coverity#736943 try another experimental warning workaround
    
    Change-Id: I4fc951e21915f7cbb03ee10fd2c9c4977a2f510a

diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index 05fc829..746d839 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -845,8 +845,8 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::
             //http://processingjs.nihongoresources.com/the_smallest_font/
             //https://github.com/grzegorzrolek/null-ttf
             const int nMaxFontsPossible = fileSize / 528;
-
-            nLength = std::min(nMaxFontsPossible, nLength);
+            if (nLength > nMaxFontsPossible)
+                nLength = nMaxFontsPossible;
 
             for( int i = 0; i < nLength; i++ )
             {
commit 1c3e3557dbb2f235dcd05e35ec835d2da721b975
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 09:23:08 2014 +0100

    coverity#1244940 Unchecked dynamic_cast
    
    Change-Id: I9c7e0d0748e8783ee46bcae549316c931b4281d8

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index cb2b2b9..ace74f6 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -237,7 +237,8 @@ public:
         {
             if (nCurOutputType == text::MailMergeType::SHELL)
             {
-                SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxMMComponent.get());
+                SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument*>(mxMMComponent.get());
+                CPPUNIT_ASSERT(pTxtDoc);
                 pTxtDoc->GetDocShell()->DoClose();
             }
             else
commit d63a7f1b91c3ea9d88e6f12cf0244dfe003a9729
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 09:21:22 2014 +0100

    coverity#1244942 Dereference null return value
    
    Change-Id: I50e453bf9e31f4afc60096ad3888062c365f54c6

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 415cca5..19d13a3 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6072,6 +6072,7 @@ void Test::testFormulaToValue()
 
     // C3:C8 should be shared formula cells.
     pFC = m_pDoc->GetFormulaCell(ScAddress(2,2,0));
+    CPPUNIT_ASSERT(pFC);
     CPPUNIT_ASSERT(pFC->GetSharedTopRow() == 2);
     CPPUNIT_ASSERT(pFC->GetSharedLength() == 6);
 
commit b3ac9676143f5beed532455832f67540ff353d13
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 09:20:35 2014 +0100

    coverity#1244943 Resource leak
    
    Change-Id: Ibee999fada60eed067d0d4e44a94294084529294

diff --git a/vcl/qa/cppunit/fontcharmap.cxx b/vcl/qa/cppunit/fontcharmap.cxx
index 1fee918..2c36158 100644
--- a/vcl/qa/cppunit/fontcharmap.cxx
+++ b/vcl/qa/cppunit/fontcharmap.cxx
@@ -28,13 +28,13 @@ public:
 
 void VclFontCharMapTest::testDefaultFontCharMap()
 {
-    FontCharMap *fcmap = new FontCharMap(); // gets default map
+    FontCharMap fcmap; // gets default map
 
-    CPPUNIT_ASSERT( fcmap->IsDefaultMap() );
+    CPPUNIT_ASSERT( fcmap.IsDefaultMap() );
 
-    sal_uInt32 nStartBMPPlane = fcmap->GetFirstChar();
-    sal_uInt32 nStartSupBMPPlane = fcmap->GetNextChar(0xD800);
-    sal_uInt32 nEndBMPPlane = fcmap->GetLastChar();
+    sal_uInt32 nStartBMPPlane = fcmap.GetFirstChar();
+    sal_uInt32 nStartSupBMPPlane = fcmap.GetNextChar(0xD800);
+    sal_uInt32 nEndBMPPlane = fcmap.GetLastChar();
 
     CPPUNIT_ASSERT( nStartBMPPlane == 0x0020 );
     CPPUNIT_ASSERT( nStartSupBMPPlane == 0xE000 );
commit cb3b90751b8781454b85b816a7e328f31615f563
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 10 09:18:57 2014 +0100

    coverity#1244953 Uncaught exception
    
    Change-Id: I3c4aeb3318af7cdb964128dd78f7d2cfba48000e

diff --git a/include/comphelper/propertysethelper.hxx b/include/comphelper/propertysethelper.hxx
index 37a29ae..55650ed 100644
--- a/include/comphelper/propertysethelper.hxx
+++ b/include/comphelper/propertysethelper.hxx
@@ -46,7 +46,7 @@ private:
     PropertySetHelperImpl* mp;
 
 protected:
-    virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ) = 0;
+    virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception ) = 0;
     virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) = 0;
 
     virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::beans::PropertyState* pStates ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 91430e7..3d4703c 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -110,7 +110,7 @@ namespace sd
                                        const uno::Sequence<beans::PropertyValue>& aConfigProps ) SAL_OVERRIDE;
 
     protected:
-        virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException ) SAL_OVERRIDE;
+        virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception ) SAL_OVERRIDE;
         virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception ) SAL_OVERRIDE;
 
     private:
@@ -397,7 +397,7 @@ void
 DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries,
         const Any* pValues)
 throw (UnknownPropertyException, PropertyVetoException,
-    IllegalArgumentException, WrappedTargetException, RuntimeException)
+    IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
 {
     ::SolarMutexGuard aGuard;
 


More information about the Libreoffice-commits mailing list