[Libreoffice-commits] core.git: 5 commits - chart2/source cui/source svx/source vcl/generic

Norbert Thiebaud nthiebaud at gmail.com
Fri Jul 4 11:13:53 PDT 2014


 chart2/source/controller/main/DragMethod_RotateDiagram.cxx |    4 +-
 cui/source/options/optinet2.cxx                            |   18 ++++++++++---
 svx/source/customshapes/EnhancedCustomShape3d.cxx          |    2 -
 vcl/generic/print/bitmap_gfx.cxx                           |   13 +++++++--
 vcl/generic/print/printerjob.cxx                           |    4 ++
 5 files changed, 30 insertions(+), 11 deletions(-)

New commits:
commit 1c053e7eb3dd08d1971450844dfdf61e7ddfae6a
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jul 4 20:09:01 2014 +0200

    coverity#735340 Unchecked return value
    
    Change-Id: I13df98f64ce505a08ba3e8b2582a17f5d202c4d1

diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx
index 84dbd42..9635aa3 100644
--- a/vcl/generic/print/printerjob.cxx
+++ b/vcl/generic/print/printerjob.cxx
@@ -478,7 +478,9 @@ PrinterJob::EndJob()
                 }
             }
             else
-                chmod( aFileName.getStr(), mnFileMode );
+            {
+                (void)chmod( aFileName.getStr(), mnFileMode );
+            }
         }
         if (pDestFILE == NULL)
             pDestFILE = fopen (aFileName.getStr(), "w");
commit 6151c6f4508fad5f37142d6c6c3286191ecd580c
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jul 4 20:06:16 2014 +0200

    coverity#735300-1 Unchecked return value
    
    Change-Id: I9cb69643ba43adc76ef38db61da2b7c1c3d3e3c1

diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 9fad8b6..00dbf79 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -1030,18 +1030,28 @@ bool MozPluginTabPage::installPlugin()
 #ifdef UNIX
     // get the real file referred by .so lnk file
     char* pHome = getpwuid(getuid())->pw_dir;
+    if(!pHome)
+    {
+        return false;
+    }
     OString lnkFilePath(OString(pHome) + OString("/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION));
-    remove(lnkFilePath.getStr());
+    (void)remove(lnkFilePath.getStr());
 
     // create the dirs if necessary
     struct stat buf;
     char tmpDir[NPP_PATH_MAX] = {0};
-    sprintf(tmpDir, "%s/.mozilla", pHome);
+    snprintf(tmpDir, NPP_PATH_MAX, "%s/.mozilla", pHome);
     if (0 > stat(lnkFilePath.getStr(), &buf))
     {
-        mkdir(tmpDir, 0755);
+        if(mkdir(tmpDir, 0755))
+        {
+            return false;
+        }
         strcat(tmpDir, "/plugins");
-        mkdir(tmpDir, 0755);
+        if(mkdir(tmpDir, 0755))
+        {
+            return false;
+        }
     }
 
     // get the real file path
commit b89311b9710697b3d0fc3a5b474c05c3cab91f42
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jul 4 19:52:50 2014 +0200

    coverity#735602-3 Division by zero
    
    Change-Id: I2da9857e4d526b60b3bf50e10ab180c493fb288f

diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
index eb0ea60..fc2d9d7 100644
--- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
@@ -115,9 +115,9 @@ void DragMethod_RotateDiagram::MoveSdrDrag(const Point& rPnt)
 
         //calculate new angle
         double fX = F_PI / 2.0 * (double)(rPnt.Y() - m_aStartPos.Y())
-                / (double)m_aReferenceRect.GetHeight();
+            / m_aReferenceRect.GetHeight() > 0 ? (double)m_aReferenceRect.GetHeight() : 1.0;
         double fY = F_PI * (double)(rPnt.X() - m_aStartPos.X())
-                / (double)m_aReferenceRect.GetWidth();
+            / m_aReferenceRect.GetWidth() > 0 ? (double)m_aReferenceRect.GetWidth() : 1.0;
 
         if( m_eRotationDirection != ROTATIONDIRECTION_Y )
             m_fAdditionalYAngleRad = fY;
commit 2fe0d7bc992c5c38ac09e4b76f720c924565a61b
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jul 4 19:44:46 2014 +0200

    coverity#704538-9 Division by zero
    
    Change-Id: Ia77648c3e0442bb5e0a08d01bbd495c9d7c8bbf5

diff --git a/vcl/generic/print/bitmap_gfx.cxx b/vcl/generic/print/bitmap_gfx.cxx
index a7bac34..9ee5677 100644
--- a/vcl/generic/print/bitmap_gfx.cxx
+++ b/vcl/generic/print/bitmap_gfx.cxx
@@ -410,9 +410,16 @@ void
 PrinterGfx::DrawBitmap (const Rectangle& rDest, const Rectangle& rSrc,
                         const PrinterBmp& rBitmap)
 {
-    double fScaleX = (double)rDest.GetWidth() / (double)rSrc.GetWidth();
-    double fScaleY = (double)rDest.GetHeight() / (double)rSrc.GetHeight();
-
+    double fScaleX = (double)rDest.GetWidth();
+    double fScaleY = (double)rDest.GetHeight();
+    if(rSrc.GetWidth() > 0)
+    {
+        fScaleX = (double)rDest.GetWidth() / (double)rSrc.GetWidth();
+    }
+    if(rSrc.GetHeigth() > 0)
+    {
+        fScaleY = (double)rDest.GetHeight() / (double)rSrc.GetHeight();
+    }
     PSGSave ();
     PSTranslate (rDest.BottomLeft());
     PSScale (fScaleX, fScaleY);
commit 982c6ab3346f55a877a58f7bb73e74daa27e9820
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jul 4 19:38:21 2014 +0200

    coverity#704499-501 Division by zero
    
    Change-Id: I5f082f10cb6822707a279d5b38ef2936ad2e5c41

diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 62249f8..4d4dbcb 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -524,7 +524,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
                     }
                     else
                     {
-                        if ( aSnapRect != aBoundRect )
+                        if ( aSnapRect != aBoundRect && aSnapRect.GetWidth() > 0 && aSnapRect.GetHeight() > 0)
                         {
                             const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
                             aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();


More information about the Libreoffice-commits mailing list