include/vcl/bitmap.hxx            |    8 +++++++-
 sw/source/filter/ww8/ww8atr.cxx   |    2 ++
 vcl/source/bitmap/bitmap.cxx      |   24 +++++++++++++-----------
 vcl/source/bitmap/bitmappaint.cxx |    2 +-
 vcl/source/gdi/bitmap3.cxx        |    4 ++--
 vcl/source/gdi/bitmap4.cxx        |    8 ++++----
 6 files changed, 29 insertions(+), 19 deletions(-)

New commits:
commit f8869a6bb23312d4498b8862248ef3612a6c9393
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Apr 5 08:19:31 2018 +0100

    coverity#1433793 silence Explicit null dereferenced
    
    and
    
    coverity#1433785 Explicit null dereferenced
    
    Change-Id: I261dc865d58daa2488c2c3c64975a2ff9bb46b53
    Reviewed-on: https://gerrit.libreoffice.org/52430
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 8bcc97c768ed..0e285081d079 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5054,11 +5054,13 @@ static void ParaTabStopDelAdd( WW8Export& rWrt,
 
         if( nOP < nNP )                             // next tab is old
         {
+            assert(pTO);
             aTab.Del(*pTO, nLStypeMgn);             // must be deleted
             nO++;
         }
         else if( nNP < nOP )                        // next tab is new
         {
+            assert(pTN);
             aTab.Add(*pTN, nLParaMgn);              // must be inserted
             nN++;
         }
commit 4eaa447630756f64bceba81e1a787c289c120152
Author: Chris Sherlock <chris.sherloc...@gmail.com>
Date:   Thu Apr 5 16:02:17 2018 +1000

    vcl: ImplAssignWithSize() -> ReassignWithSize()
    
    Change-Id: I278a976028762f5c101dfd46ee62c4aa06bd719d
    Reviewed-on: https://gerrit.libreoffice.org/52422
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 69108febbe4e..5740fc38eb63 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -662,11 +662,17 @@ public:
                                 const BmpFilterParam* pFilterParam = nullptr );
 
 public:
+    /** ReassignWithSize and recalculate bitmap.
+
+      ReassignWithSizes the bitmap, and recalculates the bitmap size based on 
the new bitmap.
+
+      @param rBitmap Bitmap to reassign and use for size calculation
+     */
+    SAL_DLLPRIVATE void     ReassignWithSize(const Bitmap& rBitmap);
 
     SAL_DLLPRIVATE void     ImplMakeUnique();
     const std::shared_ptr<ImpBitmap>& ImplGetImpBitmap() const { return 
mxImpBmp; }
     SAL_DLLPRIVATE void     ImplSetImpBitmap( const 
std::shared_ptr<ImpBitmap>& xImpBmp );
-    SAL_DLLPRIVATE void     ImplAssignWithSize( const Bitmap& rBitmap );
 
     SAL_DLLPRIVATE bool     ImplScaleFast( const double& rScaleX, const 
double& rScaleY );
     SAL_DLLPRIVATE bool     ImplScaleInterpolate( const double& rScaleX, const 
double& rScaleY );
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index bf13e87fe68c..86868f70826a 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -302,20 +302,22 @@ void Bitmap::ImplMakeUnique()
     }
 }
 
-void Bitmap::ImplAssignWithSize( const Bitmap& rBitmap )
+void Bitmap::ReassignWithSize(const Bitmap& rBitmap)
 {
-    const Size      aOldSizePix( GetSizePixel() );
-    const Size      aNewSizePix( rBitmap.GetSizePixel() );
-    const MapMode   aOldMapMode( maPrefMapMode );
-    Size            aNewPrefSize;
+    const Size aOldSizePix(GetSizePixel());
+    const Size aNewSizePix(rBitmap.GetSizePixel());
+    const MapMode aOldMapMode(maPrefMapMode);
+    Size aNewPrefSize;
 
-    if( ( aOldSizePix != aNewSizePix ) && aOldSizePix.Width() && 
aOldSizePix.Height() )
+    if ((aOldSizePix != aNewSizePix) && aOldSizePix.Width() && 
aOldSizePix.Height())
     {
-        aNewPrefSize.setWidth( FRound( maPrefSize.Width() * 
aNewSizePix.Width() / aOldSizePix.Width() ) );
-        aNewPrefSize.setHeight( FRound( maPrefSize.Height() * 
aNewSizePix.Height() / aOldSizePix.Height() ) );
+        aNewPrefSize.setWidth(FRound(maPrefSize.Width() * aNewSizePix.Width() 
/ aOldSizePix.Width()));
+        aNewPrefSize.setHeight(FRound(maPrefSize.Height() * 
aNewSizePix.Height() / aOldSizePix.Height()));
     }
     else
+    {
         aNewPrefSize = maPrefSize;
+    }
 
     *this = rBitmap;
 
@@ -413,7 +415,7 @@ bool Bitmap::Crop( const tools::Rectangle& rRectPixel )
             pReadAcc.reset();
 
             if( bRet )
-                ImplAssignWithSize( aNewBmp );
+                ReassignWithSize( aNewBmp );
         }
     }
 
@@ -810,8 +812,8 @@ bool Bitmap::Expand( sal_uLong nDX, sal_uLong nDY, const 
Color* pInitColor )
 
             pReadAcc.reset();
 
-            if( bRet )
-                ImplAssignWithSize( aNewBmp );
+            if (bRet)
+                ReassignWithSize(aNewBmp);
         }
     }
 
diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index 942d627b588c..877ec5c195f5 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -403,7 +403,7 @@ bool Bitmap::Rotate(long nAngle10, const Color& rFillColor)
 
         bRet = !!aRotatedBmp;
         if (bRet)
-            ImplAssignWithSize(aRotatedBmp);
+            ReassignWithSize(aRotatedBmp);
     }
 
     return bRet;
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index ba28fff0f112..24deaffc640b 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -944,8 +944,8 @@ bool Bitmap::ImplScaleFast( const double& rScaleX, const 
double& rScaleY )
             }
             pReadAcc.reset();
 
-            if( bRet )
-                ImplAssignWithSize( aNewBmp );
+            if (bRet)
+                ReassignWithSize(aNewBmp);
         }
     }
 
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index 62d0dc418350..b63f5c480fe5 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -1176,7 +1176,7 @@ bool Bitmap::ImplSeparableBlurFilter(const double radius)
     }
 
     // Swap current bitmap with new bitmap
-    ImplAssignWithSize( aNewBitmap );
+    ReassignWithSize(aNewBitmap);
 
     // Do vertical filtering
     ImplBlurContributions(nHeight, aNumberOfContributions, pBlurVector, 
pWeights, pPixels, pCount );
@@ -1196,7 +1196,7 @@ bool Bitmap::ImplSeparableBlurFilter(const double radius)
         return bResult;
 
     // Swap current bitmap with new bitmap
-    ImplAssignWithSize( aNewBitmap );
+    ReassignWithSize(aNewBitmap);
 
     return true;
 }
@@ -1242,7 +1242,7 @@ bool Bitmap::ImplSeparableUnsharpenFilter(const double 
radius) {
     pWriteAcc.reset();
     pReadAcc.reset();
     pReadAccBlur.reset();
-    ImplAssignWithSize ( aResultBitmap );
+    ReassignWithSize(aResultBitmap);
     return true;
 }
 
@@ -1273,7 +1273,7 @@ bool Bitmap::ImplDuotoneFilter( const sal_uLong 
nColorOne, const sal_uLong nColo
 
     pWriteAcc.reset();
     pReadAcc.reset();
-    ImplAssignWithSize ( aResultBitmap );
+    ReassignWithSize(aResultBitmap);
     return true;
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to