[Libreoffice-commits] core.git: svx/source

Caolán McNamara caolanm at redhat.com
Tue Jan 17 09:24:57 UTC 2017


 svx/source/xoutdev/xattrbmp.cxx |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit d1b088b84a45a61daa545d56dfd34b73531afa31
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 17 09:14:06 2017 +0000

    coverity#1398817 Unintended sign extension
    
    and
    
    coverity#1398818 Unintended sign extension
    
    Change-Id: Id8eaffa6e19dd36dc59d7d63fabb398aefdcf433

diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index d014873..231870a 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -73,7 +73,7 @@ void XOBitmap::Bitmap2Array()
     ScopedVclPtrInstance< VirtualDevice > pVDev;
     bool            bPixelColor = false;
     const Bitmap    aBitmap( GetBitmap() );
-    const sal_uInt16    nLines = 8; // type dependent
+    const sal_Int32 nLines = 8; // type dependent
 
     if( !pPixelArray )
         pPixelArray.reset( new sal_uInt16[ nLines * nLines ] );
@@ -83,9 +83,9 @@ void XOBitmap::Bitmap2Array()
     aPixelColor = aBckgrColor = pVDev->GetPixel( Point() );
 
     // create array and determine foreground and background color
-    for( sal_uInt16 i = 0; i < nLines; i++ )
+    for (sal_Int32 i = 0; i < nLines; ++i)
     {
-        for( sal_uInt16 j = 0; j < nLines; j++ )
+        for (sal_Int32 j = 0; j < nLines; ++j)
         {
             if ( pVDev->GetPixel( Point( j, i ) ) == aBckgrColor )
                 pPixelArray[ j + i * nLines ] = 0;
@@ -105,18 +105,18 @@ void XOBitmap::Bitmap2Array()
 /// convert array, fore- and background color into a bitmap
 void XOBitmap::Array2Bitmap()
 {
-    ScopedVclPtrInstance< VirtualDevice > pVDev;
-    sal_uInt16 nLines = 8; // type dependent
-
-    if( !pPixelArray )
+    if (!pPixelArray)
         return;
 
+    ScopedVclPtrInstance< VirtualDevice > pVDev;
+    const sal_Int32 nLines = 8; // type dependent
+
     pVDev->SetOutputSizePixel( Size( nLines, nLines ) );
 
     // create bitmap
-    for( sal_uInt16 i = 0; i < nLines; i++ )
+    for (sal_Int32 i = 0; i < nLines; ++i)
     {
-        for( sal_uInt16 j = 0; j < nLines; j++ )
+        for (sal_Int32 j = 0; j < nLines; ++j)
         {
             if( pPixelArray[ j + i * nLines ] == 0 )
                 pVDev->DrawPixel( Point( j, i ), aBckgrColor );


More information about the Libreoffice-commits mailing list