[Libreoffice-commits] core.git: 2 commits - framework/source include/vcl svtools/source sw/source toolkit/source vcl/source

Caolán McNamara caolanm at redhat.com
Sat Jan 21 14:46:50 UTC 2017


 framework/source/uiconfiguration/imagemanagerimpl.cxx |   18 +++++++++++++-----
 include/vcl/image.hxx                                 |    1 -
 svtools/source/graphic/provider.cxx                   |    8 ++++----
 sw/source/filter/ww8/ww8par.cxx                       |    4 ++--
 toolkit/source/awt/vclxmenu.cxx                       |    2 +-
 toolkit/source/awt/vclxwindows.cxx                    |    2 +-
 vcl/source/image/Image.cxx                            |    7 -------
 7 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 07bcb812c95617ee543e51568cbc8fa83fed243e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 21 14:45:02 2017 +0000

    coverity#704055 Unchecked return value
    
    Change-Id: Ie0c8155955ba975c913738adf40ef6ec092adba0

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index a586b9a..25f499a 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3671,8 +3671,8 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
                 {
                     WW8_FC nPos;
                     void *pData;
-                    pTest->Get(nPos, pData);
-                    sal_uInt32 nData = SVBT32ToUInt32(*static_cast<SVBT32*>(pData));
+                    sal_uInt32 nData = pTest->Get(nPos, pData) ? SVBT32ToUInt32(*static_cast<SVBT32*>(pData))
+                                                               : 0;
                     if (nData & 0x2) // Might be how it works
                     {
                         TabCellEnd();
commit f9b87a2e50e7cc46a19b5fdee61e14d53550393d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 20 17:21:59 2017 +0000

    move GetXGraphic to its only user
    
    Change-Id: I72ec4a7e72ca3355a97f987fab70b3e3a8e45168

diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index d1e73bc..33c6dd7 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -717,6 +717,14 @@ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
     return false;
 }
 
+namespace
+{
+    css::uno::Reference< css::graphic::XGraphic > GetXGraphic(const Image &rImage)
+    {
+        return Graphic(rImage.GetBitmapEx()).GetXGraphic();
+    }
+}
+
 Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages(
     ::sal_Int16 nImageType,
     const Sequence< OUString >& aCommandURLSequence )
@@ -759,7 +767,7 @@ throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException )
                 aImage = rGlobalImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
         }
 
-        aGraphSeq[n] = aImage.GetXGraphic();
+        aGraphSeq[n] = GetXGraphic(aImage);
     }
 
     return aGraphSeq;
@@ -909,7 +917,7 @@ throw ( css::lang::IllegalArgumentException,
                     {
                         if ( !pReplacedImages )
                             pReplacedImages = new CmdToXGraphicNameAccess();
-                        pReplacedImages->addElement( aCommandURLSequence[i], aNewImage.GetXGraphic() );
+                        pReplacedImages->addElement(aCommandURLSequence[i], GetXGraphic(aNewImage));
                     }
                 } // if ( m_bUseGlobal )
                 else
@@ -1013,14 +1021,14 @@ void ImageManagerImpl::reload()
                         if ( !pReplacedImages )
                             pReplacedImages = new CmdToXGraphicNameAccess();
                         pReplacedImages->addElement( aNewUserCmdImageSet[j],
-                                                     pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() );
+                                                     GetXGraphic(pImageList->GetImage(aNewUserCmdImageSet[j])) );
                     }
                     else
                     {
                         if ( !pInsertedImages )
                             pInsertedImages = new CmdToXGraphicNameAccess();
                         pInsertedImages->addElement( aNewUserCmdImageSet[j],
-                                                     pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() );
+                                                     GetXGraphic(pImageList->GetImage(aNewUserCmdImageSet[j])) );
                     }
                 }
 
@@ -1058,7 +1066,7 @@ void ImageManagerImpl::reload()
                                 // Image has been found in the module/global image list => replace user image
                                 if ( !pReplacedImages )
                                     pReplacedImages = new CmdToXGraphicNameAccess();
-                                pReplacedImages->addElement( pIter->first, aImage.GetXGraphic() );
+                                pReplacedImages->addElement(pIter->first, GetXGraphic(aImage));
                             }
                         } // if ( m_bUseGlobal )
                         else
diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx
index 752b900..af4aa26 100644
--- a/include/vcl/image.hxx
+++ b/include/vcl/image.hxx
@@ -65,7 +65,6 @@ public:
     Size            GetSizePixel() const;
 
     BitmapEx        GetBitmapEx() const;
-    css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const;
 
     bool            operator!() const { return !mpImplData; }
     bool            operator==( const Image& rImage ) const;
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index a770906..87fffe6 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -201,19 +201,19 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( co
         OUString sImageName( rResourceURL.copy( nIndex ) );
         if ( sImageName == "info" )
         {
-            xRet = InfoBox::GetStandardImage().GetXGraphic();
+            xRet = Graphic(InfoBox::GetStandardImage().GetBitmapEx()).GetXGraphic();
         }
         else if ( sImageName == "warning" )
         {
-            xRet = WarningBox::GetStandardImage().GetXGraphic();
+            xRet = Graphic(WarningBox::GetStandardImage().GetBitmapEx()).GetXGraphic();
         }
         else if ( sImageName == "error" )
         {
-            xRet = ErrorBox::GetStandardImage().GetXGraphic();
+            xRet = Graphic(ErrorBox::GetStandardImage().GetBitmapEx()).GetXGraphic();
         }
         else if ( sImageName == "query" )
         {
-            xRet = QueryBox::GetStandardImage().GetXGraphic();
+            xRet = Graphic(QueryBox::GetStandardImage().GetBitmapEx()).GetXGraphic();
         }
     }
     return xRet;
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index aafa5b9..624e61e 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -873,7 +873,7 @@ throw (css::uno::RuntimeException, std::exception)
     {
         Image aImage = mpMenu->GetItemImage( nItemId );
         if ( !!aImage )
-            rxGraphic = aImage.GetXGraphic();
+            rxGraphic = Graphic(aImage.GetBitmapEx()).GetXGraphic();
     }
     return rxGraphic;
 }
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 9ceaf50..ff79b03 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -294,7 +294,7 @@ css::uno::Any VCLXGraphicControl::getProperty( const OUString& PropertyName ) th
     switch ( nPropType )
     {
         case BASEPROPERTY_GRAPHIC:
-            aProp <<= maImage.GetXGraphic();
+            aProp <<= Graphic(maImage.GetBitmapEx()).GetXGraphic();
             break;
         case BASEPROPERTY_IMAGEALIGN:
         {
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index d873d3e..eee064b 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -110,13 +110,6 @@ BitmapEx Image::GetBitmapEx() const
     return aRet;
 }
 
-css::uno::Reference< css::graphic::XGraphic > Image::GetXGraphic() const
-{
-    const Graphic aGraphic( GetBitmapEx() );
-
-    return aGraphic.GetXGraphic();
-}
-
 bool Image::operator==(const Image& rImage) const
 {
     bool bRet = false;


More information about the Libreoffice-commits mailing list