[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - 4 commits - framework/source sc/source vcl/source

Eike Rathke erack at redhat.com
Tue Jan 6 07:38:03 PST 2015


 framework/source/fwe/classes/addonsoptions.cxx |   44 ++++++++++++++-----------
 sc/source/core/data/compressedarray.cxx        |    4 +-
 sc/source/core/data/table5.cxx                 |    2 -
 vcl/source/filter/jpeg/jpegc.cxx               |    2 -
 4 files changed, 29 insertions(+), 23 deletions(-)

New commits:
commit b29b9c4861e1008171b59aa4caed9cfdf3d0094e
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jan 6 13:00:59 2015 +0100

    move nScanLineBufferComponents to where it is used [-Werror=clobbered]
    
    gcc (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)
    
    vcl/source/filter/jpeg/jpegc.cxx: In function ‘void ReadJPEG(JPEGReader*, void*, long int*, const Size&)’:
    vcl/source/filter/jpeg/jpegc.cxx:72:10: error: variable ‘nScanLineBufferComponents’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
         long                            nScanLineBufferComponents = 0;
              ^
    
    Change-Id: I90a0d02977c49d2471069788a02fb1c7d28c039a
    (cherry picked from commit 09a5910c96a822c6e7fc4b82d89c00c22e905eba)
    Reviewed-on: https://gerrit.libreoffice.org/13766
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index 04aa3a2..411b17b 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -69,7 +69,6 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines,
     long                            nAlignedWidth;
     JSAMPLE*                        aRangeLimit;
     boost::scoped_array<unsigned char> pScanLineBuffer;
-    long                            nScanLineBufferComponents = 0;
 
     if ( setjmp( jerr.setjmp_buffer ) )
     {
@@ -150,6 +149,7 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines,
     nAlignedWidth = aCreateBitmapParam.nAlignedWidth;
     aRangeLimit = cinfo.sample_range_limit;
 
+    long nScanLineBufferComponents = 0;
     if ( cinfo.out_color_space == JCS_CMYK )
     {
         nScanLineBufferComponents = cinfo.output_width * 4;
commit e6d3d22684d6644dad04aa3f747d6fd1030966be
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Jan 5 22:28:34 2015 +0100

    workaround a weird gcc optimization werror bug
    
    gcc (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)
    
    framework/source/fwe/classes/addonsoptions.cxx: In member function ‘void framework::AddonsOptions_Impl::ReadAndAssociateImages(const rtl::OUString&, const rtl::OUString&)’:
    framework/source/fwe/classes/addonsoptions.cxx:267:16: error: array subscript is above array bounds [-Werror=array-bounds]
             struct ImageEntry
                    ^
    
    The combination of aScaled[2]; aImage[2]; aURL[2] in sequence apparently lead
    to some overoptimization and/or alignment problem, already declaring aImage[3]
    helped (but not aScaled[3]), but that's not what we want.
    
    Change-Id: I82e28d4887ab8072a17d0a9341d322c1cf61aedc
    (cherry picked from commit 549b7fad48bb9ddcba7dfa92daea6ce917853a03)
    Reviewed-on: https://gerrit.libreoffice.org/13764
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index 5ec0e61..067dde4 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -260,19 +260,24 @@ class AddonsOptions_Impl : public ConfigItem
     private:
         enum ImageSize
         {
-            IMGSIZE_SMALL,
+            IMGSIZE_SMALL = 0,
             IMGSIZE_BIG
         };
 
+        struct OneImageEntry
+        {
+            Image    aScaled;   ///< cached scaled image
+            Image    aImage;    ///< original un-scaled image
+            OUString aURL;      ///< URL in case it is not loaded yet
+        };
+
         struct ImageEntry
         {
             // if the image is set, it was embedded in some way,
             // otherwise we use the associated URL to load on demand
 
             // accessed in this order
-            Image    aScaled[2];       // cached scaled images
-            Image    aImage[2];        // original un-scaled images
-            OUString aURL[2];         // URLs in case they are not loaded yet
+            OneImageEntry aSizeEntry[2];
             ImageEntry() {}
             void addImage(ImageSize eSize, const Image &rImage, const OUString &rURL);
         };
@@ -355,8 +360,8 @@ void AddonsOptions_Impl::ImageEntry::addImage(ImageSize eSize,
                                               const Image &rImage,
                                               const OUString &rURL)
 {
-    aImage[(int)eSize] = rImage;
-    aURL[(int)eSize] = rURL;
+    aSizeEntry[(int)eSize].aImage = rImage;
+    aSizeEntry[(int)eSize].aURL = rURL;
 }
 
 //  constructor
@@ -589,35 +594,36 @@ Image AddonsOptions_Impl::GetImageFromURL( const OUString& aURL, bool bBig, bool
     ImageManager::iterator pIter = m_aImageManager.find(aURL);
     if ( pIter != m_aImageManager.end() )
     {
-        ImageEntry &rEntry = pIter->second;
+        OneImageEntry& rSizeEntry = pIter->second.aSizeEntry[nIdx];
+        OneImageEntry& rOtherEntry = pIter->second.aSizeEntry[nOtherIdx];
         // actually read the image ...
-        if (!rEntry.aImage[nIdx])
-            rEntry.aImage[nIdx] = ReadImageFromURL(rEntry.aURL[nIdx]);
+        if (!rSizeEntry.aImage)
+            rSizeEntry.aImage = ReadImageFromURL(rSizeEntry.aURL);
 
-        if (!rEntry.aImage[nIdx])
+        if (!rSizeEntry.aImage)
         { // try the other size and scale it
-            aImage = ScaleImage(ReadImageFromURL(rEntry.aURL[nOtherIdx]), bBig);
-            rEntry.aImage[nIdx] = aImage;
-            if (!rEntry.aImage[nIdx])
+            aImage = ScaleImage(ReadImageFromURL(rOtherEntry.aURL), bBig);
+            rSizeEntry.aImage = aImage;
+            if (!rSizeEntry.aImage)
                 SAL_WARN("fwk", "failed to load addons image " << aURL);
         }
 
         // FIXME: bNoScale is not terribly meaningful or useful
 
         if (!aImage && bNoScale)
-            aImage = rEntry.aImage[nIdx];
+            aImage = rSizeEntry.aImage;
 
-        if (!aImage && !!rEntry.aScaled[nIdx])
-            aImage = rEntry.aScaled[nIdx];
+        if (!aImage && !!rSizeEntry.aScaled)
+            aImage = rSizeEntry.aScaled;
 
         else // scale to the correct size for the theme / toolbox
         {
-            aImage = rEntry.aImage[nIdx];
+            aImage = rSizeEntry.aImage;
             if (!aImage) // use and scale the other if one size is missing
-                aImage = rEntry.aImage[nOtherIdx];
+                aImage = rOtherEntry.aImage;
 
             aImage = ScaleImage(aImage, bBig);
-            rEntry.aScaled[nIdx] = aImage; // cache for next time
+            rSizeEntry.aScaled = aImage; // cache for next time
         }
     }
 
commit 8d6fef75e07717b3df927d5f78b7bc26aa531a07
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Wed Sep 3 09:43:37 2014 +0200

    -Wmaybe-uninitialized in ScTable::CopyColFiltered
    
    apply same initialization as in ScTable::CopyRowFiltered
    
    Change-Id: I9e8de6eaae3b3ad9453e5c06a88cfa93766becd9
    Reviewed-on: https://gerrit.libreoffice.org/11263
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>
    (cherry picked from commit 76ef9ecdb98252978dc10d11e98eb9a5cfad8acc)
    Signed-off-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index dfe229f..6eb819f 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -838,7 +838,7 @@ void ScTable::CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol)
     SCCOL nCol = nStartCol;
     while (nCol <= nEndCol)
     {
-        SCCOL nLastCol;
+        SCCOL nLastCol = -1;
         bool bFiltered = rTable.ColFiltered(nCol, NULL, &nLastCol);
         if (nLastCol > nEndCol)
             nLastCol = nEndCol;
commit d900d7387cbff1ab5e57122b92f64f7d72d7c3b5
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Thu Oct 9 14:26:49 2014 +0200

    remove warning: ‘nIndex’ may be used uninitialized
    
    Change-Id: I317c2f4409f556ab967e4f08caa99cffcfce26cc
    Reviewed-on: https://gerrit.libreoffice.org/11876
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>
    (cherry picked from commit 430747397508f297be7ae1fa734a43ea705e9a43)
    Reviewed-on: https://gerrit.libreoffice.org/13769
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/data/compressedarray.cxx b/sc/source/core/data/compressedarray.cxx
index a14cd9d..a617260 100644
--- a/sc/source/core/data/compressedarray.cxx
+++ b/sc/source/core/data/compressedarray.cxx
@@ -248,7 +248,7 @@ template< typename A, typename D >
 void ScCompressedArray<A,D>::CopyFrom( const ScCompressedArray<A,D>& rArray, A nStart,
         A nEnd, long nSourceDy )
 {
-    size_t nIndex;
+    size_t nIndex = 0;
     A nRegionEnd;
     for (A j=nStart; j<=nEnd; ++j)
     {
@@ -385,7 +385,7 @@ void ScBitMaskCompressedArray<A,D>::CopyFromAnded(
         const ScBitMaskCompressedArray<A,D>& rArray, A nStart, A nEnd,
         const D& rValueToAnd, long nSourceDy )
 {
-    size_t nIndex;
+    size_t nIndex = 0;
     A nRegionEnd;
     for (A j=nStart; j<=nEnd; ++j)
     {


More information about the Libreoffice-commits mailing list