[Libreoffice-commits] core.git: 2 commits - framework/inc framework/source include/vcl vcl/source

Noel Grandin noel at peralex.com
Wed May 25 12:26:26 UTC 2016


 framework/inc/uiconfiguration/imagetype.hxx           |    7 -
 framework/source/uiconfiguration/imagemanagerimpl.cxx |   79 +++++++++---------
 framework/source/uiconfiguration/imagemanagerimpl.hxx |   18 ++--
 include/vcl/CommandImageResolver.hxx                  |   15 +--
 vcl/source/bitmap/CommandImageResolver.cxx            |    6 -
 vcl/source/opengl/OpenGLHelper.cxx                    |    4 
 6 files changed, 62 insertions(+), 67 deletions(-)

New commits:
commit 0788f65f4643d2e10cd13277725247010dc4425e
Author: Noel Grandin <noel at peralex.com>
Date:   Tue May 24 11:18:07 2016 +0200

    convert ImageType to scoped enum
    
    and drop duplicate definition in framework.
    
    Change-Id: I6cb95241e659ad58429bffeaaf2f95b07ad12df6
    Reviewed-on: https://gerrit.libreoffice.org/25400
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/framework/inc/uiconfiguration/imagetype.hxx b/framework/inc/uiconfiguration/imagetype.hxx
index 219eb9a..d759674 100644
--- a/framework/inc/uiconfiguration/imagetype.hxx
+++ b/framework/inc/uiconfiguration/imagetype.hxx
@@ -26,13 +26,6 @@
 namespace framework
 {
 
-enum ImageType
-{
-    ImageType_Color = 0,
-    ImageType_Color_Large,
-    ImageType_COUNT
-};
-
 typedef std::unordered_map< OUString,
                             OUString,
                             OUStringHash > CommandToImageNameMap;
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index f833625..8eeac59 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -36,6 +36,7 @@
 
 #include <vcl/svapp.hxx>
 #include <rtl/ustrbuf.hxx>
+#include <o3tl/enumrange.hxx>
 #include <osl/mutex.hxx>
 #include <comphelper/sequence.hxx>
 #include <tools/urlobj.hxx>
@@ -73,13 +74,13 @@ static const char   BITMAPS_FOLDER[]      = "Bitmaps";
 
 static const char   ModuleImageList[]     = "private:resource/images/moduleimages";
 
-static const char*  IMAGELIST_XML_FILE[]  =
+static const o3tl::enumarray<vcl::ImageType, const char*> IMAGELIST_XML_FILE =
 {
     "sc_imagelist.xml",
     "lc_imagelist.xml"
 };
 
-static const char*  BITMAP_FILE_NAMES[]   =
+static const o3tl::enumarray<vcl::ImageType, const char*> BITMAP_FILE_NAMES =
 {
     "sc_userimages.png",
     "lc_userimages.png"
@@ -171,13 +172,13 @@ void CmdImageList::initialize()
 }
 
 
-Image CmdImageList::getImageFromCommandURL(sal_Int16 nImageType, const OUString& rCommandURL)
+Image CmdImageList::getImageFromCommandURL(vcl::ImageType nImageType, const OUString& rCommandURL)
 {
     initialize();
     return m_aResolver.getImageFromCommandURL(nImageType, rCommandURL);
 }
 
-bool CmdImageList::hasImage(sal_Int16 /*nImageType*/, const OUString& rCommandURL)
+bool CmdImageList::hasImage(vcl::ImageType /*nImageType*/, const OUString& rCommandURL)
 {
     initialize();
     return m_aResolver.hasImage(rCommandURL);
@@ -200,13 +201,13 @@ GlobalImageList::~GlobalImageList()
     pGlobalImageList = nullptr;
 }
 
-Image GlobalImageList::getImageFromCommandURL( sal_Int16 nImageType, const OUString& rCommandURL )
+Image GlobalImageList::getImageFromCommandURL( vcl::ImageType nImageType, const OUString& rCommandURL )
 {
     osl::MutexGuard guard( getGlobalImageListMutex() );
     return CmdImageList::getImageFromCommandURL( nImageType, rCommandURL );
 }
 
-bool GlobalImageList::hasImage( sal_Int16 nImageType, const OUString& rCommandURL )
+bool GlobalImageList::hasImage( vcl::ImageType nImageType, const OUString& rCommandURL )
 {
     osl::MutexGuard guard( getGlobalImageListMutex() );
     return CmdImageList::hasImage( nImageType, rCommandURL );
@@ -218,7 +219,7 @@ bool GlobalImageList::hasImage( sal_Int16 nImageType, const OUString& rCommandUR
     return CmdImageList::getImageCommandNames();
 }
 
-static bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic, const uno::Reference< XGraphic >& rInGraphic, sal_Int16 nImageType )
+static bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic, const uno::Reference< XGraphic >& rInGraphic, vcl::ImageType nImageType )
 {
     static Size   aNormSize( IMAGE_SIZE_NORMAL, IMAGE_SIZE_NORMAL );
     static Size   aLargeSize( IMAGE_SIZE_LARGE, IMAGE_SIZE_LARGE );
@@ -234,7 +235,7 @@ static bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic
     Size   aSize = aImage.GetSizePixel();
     bool   bMustScale( false );
 
-    if ( nImageType == ImageType_Color_Large )
+    if ( nImageType == vcl::ImageType::Color_Large )
         bMustScale = ( aSize != aLargeSize );
     else
         bMustScale = ( aSize != aNormSize );
@@ -251,15 +252,15 @@ static bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic
     return true;
 }
 
-static sal_Int16 implts_convertImageTypeToIndex( sal_Int16 nImageType )
+static vcl::ImageType implts_convertImageTypeToIndex( sal_Int16 nImageType )
 {
-    sal_Int16 nIndex( 0 );
+    vcl::ImageType nIndex( vcl::ImageType::Color );
     if ( nImageType & css::ui::ImageType::SIZE_LARGE )
-        nIndex += 1;
+        nIndex = vcl::ImageType::Color_Large;
     return nIndex;
 }
 
-ImageList* ImageManagerImpl::implts_getUserImageList( ImageType nImageType )
+ImageList* ImageManagerImpl::implts_getUserImageList( vcl::ImageType nImageType )
 {
     SolarMutexGuard g;
     if ( !m_pUserImageList[nImageType] )
@@ -304,7 +305,7 @@ void ImageManagerImpl::implts_initialize()
 }
 
 bool ImageManagerImpl::implts_loadUserImages(
-    ImageType nImageType,
+    vcl::ImageType nImageType,
     const uno::Reference< XStorage >& xUserImageStorage,
     const uno::Reference< XStorage >& xUserBitmapsStorage )
 {
@@ -382,7 +383,7 @@ bool ImageManagerImpl::implts_loadUserImages(
 }
 
 bool ImageManagerImpl::implts_storeUserImages(
-    ImageType nImageType,
+    vcl::ImageType nImageType,
     const uno::Reference< XStorage >& xUserImageStorage,
     const uno::Reference< XStorage >& xUserBitmapsStorage )
 {
@@ -516,7 +517,7 @@ ImageManagerImpl::ImageManagerImpl( const uno::Reference< uno::XComponentContext
     , m_bConfigRead( false )
     , m_bDisposed( false )
 {
-    for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
+    for ( vcl::ImageType n : o3tl::enumrange<vcl::ImageType>() )
     {
         m_pUserImageList[n] = nullptr;
         m_bUserImageListModified[n] = false;
@@ -629,10 +630,10 @@ throw (css::uno::RuntimeException, lang::IllegalAccessException)
 
     std::vector< OUString > aUserImageNames;
 
-    for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
+    for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
     {
         aUserImageNames.clear();
-        ImageList* pImageList = implts_getUserImageList( ImageType(i));
+        ImageList* pImageList = implts_getUserImageList(i);
         pImageList->GetImageNames( aUserImageNames );
 
         Sequence< OUString > aRemoveList( comphelper::containerToSequence(aUserImageNames) );
@@ -656,7 +657,7 @@ throw (css::uno::RuntimeException)
 
     ImageNameMap aImageCmdNameMap;
 
-    sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
+    vcl::ImageType nIndex = implts_convertImageTypeToIndex( nImageType );
 
     sal_uInt32 i( 0 );
     if ( m_bUseGlobal )
@@ -674,7 +675,7 @@ throw (css::uno::RuntimeException)
             aImageCmdNameMap.insert( ImageNameMap::value_type( rModuleImageNameVector[i], true ));
     }
 
-    ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
+    ImageList* pImageList = implts_getUserImageList(nIndex);
     std::vector< OUString > rUserImageNames;
     pImageList->GetImageNames( rUserImageNames );
     const sal_uInt32 nUserCount = rUserImageNames.size();
@@ -696,7 +697,7 @@ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
     if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
         throw IllegalArgumentException();
 
-    sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
+    vcl::ImageType nIndex = implts_convertImageTypeToIndex( nImageType );
     if ( m_bUseGlobal && implts_getGlobalImageList()->hasImage( nIndex, aCommandURL ))
         return true;
     else
@@ -706,7 +707,7 @@ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
         else
         {
             // User layer
-            ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
+            ImageList* pImageList = implts_getUserImageList(nIndex);
             if ( pImageList )
                 return ( pImageList->GetImagePos( aCommandURL ) != IMAGELIST_IMAGE_NOTFOUND );
         }
@@ -733,7 +734,7 @@ throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException )
 
     const OUString* aStrArray = aCommandURLSequence.getConstArray();
 
-    sal_Int16                         nIndex            = implts_convertImageTypeToIndex( nImageType );
+    vcl::ImageType                    nIndex            = implts_convertImageTypeToIndex( nImageType );
     rtl::Reference< GlobalImageList > rGlobalImageList;
     CmdImageList*                     pDefaultImageList = nullptr;
     if ( m_bUseGlobal )
@@ -741,7 +742,7 @@ throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException )
         rGlobalImageList  = implts_getGlobalImageList();
         pDefaultImageList = implts_getDefaultImageList();
     }
-    ImageList*                        pUserImageList    = implts_getUserImageList( ImageType( nIndex ));
+    ImageList*                        pUserImageList    = implts_getUserImageList(nIndex);
 
     // We have to search our image list in the following order:
     // 1. user image list (read/write)
@@ -789,8 +790,8 @@ throw (css::lang::IllegalArgumentException,
         if ( m_bReadOnly )
             throw IllegalAccessException();
 
-        sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
-        ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
+        vcl::ImageType nIndex = implts_convertImageTypeToIndex( nImageType );
+        ImageList* pImageList = implts_getUserImageList(nIndex);
 
         uno::Reference< XGraphic > xGraphic;
         for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
@@ -871,7 +872,7 @@ throw ( css::lang::IllegalArgumentException,
         if ( m_bReadOnly )
             throw IllegalAccessException();
 
-        sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
+        vcl::ImageType nIndex = implts_convertImageTypeToIndex( nImageType );
         rtl::Reference< GlobalImageList > rGlobalImageList;
         CmdImageList*                     pDefaultImageList = nullptr;
         if ( m_bUseGlobal )
@@ -879,7 +880,7 @@ throw ( css::lang::IllegalArgumentException,
             rGlobalImageList  = implts_getGlobalImageList();
             pDefaultImageList = implts_getDefaultImageList();
         }
-        ImageList*                        pImageList        = implts_getUserImageList( ImageType( nIndex ));
+        ImageList*                        pImageList        = implts_getUserImageList(nIndex);
         uno::Reference< XGraphic >        xEmptyGraphic( Image().GetXGraphic() );
 
         for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
@@ -979,12 +980,12 @@ void ImageManagerImpl::reload()
 
     if ( m_bModified )
     {
-        for ( sal_Int16 i = 0; i < sal_Int16( ImageType_COUNT ); i++ )
+        for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
         {
             if ( !m_bDisposed && m_bUserImageListModified[i] )
             {
                 std::vector< OUString > aOldUserCmdImageVector;
-                ImageList* pImageList = implts_getUserImageList( (ImageType)i );
+                ImageList* pImageList = implts_getUserImageList(i);
                 pImageList->GetImageNames( aOldUserCmdImageVector );
 
                 // Fill hash map to speed up search afterwards
@@ -994,8 +995,8 @@ void ImageManagerImpl::reload()
                     aOldUserCmdImageSet.insert( CommandMap::value_type( aOldUserCmdImageVector[j], false ));
 
                 // Attention: This can make the old image list pointer invalid!
-                implts_loadUserImages( (ImageType)i, m_xUserImageStorage, m_xUserBitmapsStorage );
-                pImageList = implts_getUserImageList( (ImageType)i );
+                implts_loadUserImages( i, m_xUserImageStorage, m_xUserBitmapsStorage );
+                pImageList = implts_getUserImageList(i);
                 pImageList->GetImageNames( aNewUserCmdImageSet );
 
                 CmdToXGraphicNameAccess* pInsertedImages( nullptr );
@@ -1078,7 +1079,7 @@ void ImageManagerImpl::reload()
                 if ( pInsertedImages != nullptr )
                 {
                     ConfigurationEvent aInsertEvent;
-                    aInsertEvent.aInfo           = uno::makeAny( i );
+                    aInsertEvent.aInfo           = uno::makeAny( (sal_uInt16)i );
                     aInsertEvent.Accessor        = uno::makeAny( xOwner );
                     aInsertEvent.Source          = xOwner;
                     aInsertEvent.ResourceURL     = m_aResourceString;
@@ -1089,7 +1090,7 @@ void ImageManagerImpl::reload()
                 if ( pReplacedImages != nullptr )
                 {
                     ConfigurationEvent aReplaceEvent;
-                    aReplaceEvent.aInfo           = uno::makeAny( i );
+                    aReplaceEvent.aInfo           = uno::makeAny( (sal_uInt16)i );
                     aReplaceEvent.Accessor        = uno::makeAny( xOwner );
                     aReplaceEvent.Source          = xOwner;
                     aReplaceEvent.ResourceURL     = m_aResourceString;
@@ -1101,7 +1102,7 @@ void ImageManagerImpl::reload()
                 if ( pRemovedImages != nullptr )
                 {
                     ConfigurationEvent aRemoveEvent;
-                    aRemoveEvent.aInfo           = uno::makeAny( i );
+                    aRemoveEvent.aInfo           = uno::makeAny( (sal_uInt16)i );
                     aRemoveEvent.Accessor        = uno::makeAny( xOwner );
                     aRemoveEvent.Source          = xOwner;
                     aRemoveEvent.ResourceURL     = m_aResourceString;
@@ -1129,9 +1130,9 @@ void ImageManagerImpl::store()
     if ( m_bModified )
     {
         bool bWritten( false );
-        for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
+        for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
         {
-            bool bSuccess = implts_storeUserImages( ImageType(i), m_xUserImageStorage, m_xUserBitmapsStorage );
+            bool bSuccess = implts_storeUserImages(i, m_xUserImageStorage, m_xUserBitmapsStorage );
             if ( bSuccess )
                 bWritten = true;
             m_bUserImageListModified[i] = false;
@@ -1171,10 +1172,10 @@ void ImageManagerImpl::storeToStorage( const uno::Reference< XStorage >& Storage
         {
             uno::Reference< XStorage > xUserBitmapsStorage = xUserImageStorage->openStorageElement( BITMAPS_FOLDER,
                                                                                                     nModes );
-            for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
+            for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
             {
-                implts_getUserImageList( (ImageType)i );
-                implts_storeUserImages( (ImageType)i, xUserImageStorage, xUserBitmapsStorage );
+                implts_getUserImageList(i);
+                implts_storeUserImages( i, xUserImageStorage, xUserBitmapsStorage );
             }
 
             uno::Reference< XTransactedObject > xTransaction( Storage, UNO_QUERY );
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx b/framework/source/uiconfiguration/imagemanagerimpl.hxx
index f1f71b0..ceb28ab 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.hxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx
@@ -58,8 +58,8 @@ namespace framework
             CmdImageList(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const OUString& aModuleIdentifier);
             virtual ~CmdImageList();
 
-            virtual Image getImageFromCommandURL(sal_Int16 nImageType, const OUString& rCommandURL);
-            virtual bool hasImage(sal_Int16 nImageType, const OUString& rCommandURL);
+            virtual Image getImageFromCommandURL(vcl::ImageType nImageType, const OUString& rCommandURL);
+            virtual bool hasImage(vcl::ImageType nImageType, const OUString& rCommandURL);
             virtual std::vector<OUString>& getImageCommandNames();
 
         protected:
@@ -79,8 +79,8 @@ namespace framework
             explicit GlobalImageList(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
             virtual ~GlobalImageList();
 
-            virtual Image                           getImageFromCommandURL( sal_Int16 nImageType, const OUString& rCommandURL ) override;
-            virtual bool                            hasImage( sal_Int16 nImageType, const OUString& rCommandURL ) override;
+            virtual Image                           getImageFromCommandURL( vcl::ImageType nImageType, const OUString& rCommandURL ) override;
+            virtual bool                            hasImage( vcl::ImageType nImageType, const OUString& rCommandURL ) override;
             virtual ::std::vector< OUString >&      getImageCommandNames() override;
     };
 
@@ -147,11 +147,11 @@ namespace framework
 
             void                                      implts_initialize();
             void                                      implts_notifyContainerListener( const css::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
-            ImageList*                                implts_getUserImageList( ImageType nImageType );
-            bool                                  implts_loadUserImages( ImageType nImageType,
+            ImageList*                                implts_getUserImageList( vcl::ImageType nImageType );
+            bool                                      implts_loadUserImages( vcl::ImageType nImageType,
                                                                              const css::uno::Reference< css::embed::XStorage >& xUserImageStorage,
                                                                              const css::uno::Reference< css::embed::XStorage >& xUserBitmapsStorage );
-            bool                                  implts_storeUserImages( ImageType nImageType,
+            bool                                      implts_storeUserImages( vcl::ImageType nImageType,
                                                                               const css::uno::Reference< css::embed::XStorage >& xUserImageStorage,
                                                                               const css::uno::Reference< css::embed::XStorage >& xUserBitmapsStorage );
             const rtl::Reference< GlobalImageList >&  implts_getGlobalImageList();
@@ -169,8 +169,8 @@ namespace framework
             OUString                                                                   m_aResourceString;
             osl::Mutex m_mutex;
             ::cppu::OMultiTypeInterfaceContainerHelper                                      m_aListenerContainer;   /// container for ALL Listener
-            ImageList*                                                                      m_pUserImageList[ImageType_COUNT];
-            bool                                                                            m_bUserImageListModified[ImageType_COUNT];
+            o3tl::enumarray<vcl::ImageType,ImageList*>                                      m_pUserImageList;
+            o3tl::enumarray<vcl::ImageType,bool>                                            m_bUserImageListModified;
             bool                                                                            m_bUseGlobal;
             bool                                                                            m_bReadOnly;
             bool                                                                            m_bInitialized;
diff --git a/include/vcl/CommandImageResolver.hxx b/include/vcl/CommandImageResolver.hxx
index 875f658..36f2f1e 100644
--- a/include/vcl/CommandImageResolver.hxx
+++ b/include/vcl/CommandImageResolver.hxx
@@ -12,6 +12,7 @@
 
 #include <vcl/dllapi.h>
 #include <vcl/image.hxx>
+#include <o3tl/enumarray.hxx>
 
 #include <com/sun/star/uno/Sequence.hxx>
 
@@ -21,11 +22,11 @@
 namespace vcl
 {
 
-enum ImageType
+enum class ImageType
 {
-    ImageType_Color = 0,
-    ImageType_Color_Large,
-    ImageType_COUNT
+    Color = 0,
+    Color_Large,
+    LAST = Color_Large
 };
 
 class VCL_DLLPUBLIC CommandImageResolver
@@ -37,17 +38,17 @@ private:
     std::vector<OUString> m_aImageCommandNameVector;
     std::vector<OUString> m_aImageNameVector;
 
-    ImageList* m_pImageList[ImageType_COUNT];
+    o3tl::enumarray<ImageType, ImageList*> m_pImageList;
     OUString m_sIconTheme;
 
-    ImageList* getImageList(sal_Int16 nImageType);
+    ImageList* getImageList(ImageType nImageType);
 
 public:
     CommandImageResolver();
     virtual ~CommandImageResolver();
 
     bool registerCommands(css::uno::Sequence<OUString>& aCommandSequence);
-    Image getImageFromCommandURL(sal_Int16 nImageType, const OUString& rCommandURL);
+    Image getImageFromCommandURL(ImageType nImageType, const OUString& rCommandURL);
 
     std::vector<OUString>& getCommandNames()
     {
diff --git a/vcl/source/bitmap/CommandImageResolver.cxx b/vcl/source/bitmap/CommandImageResolver.cxx
index f9143b0..90a5044 100644
--- a/vcl/source/bitmap/CommandImageResolver.cxx
+++ b/vcl/source/bitmap/CommandImageResolver.cxx
@@ -21,7 +21,7 @@ namespace vcl
 namespace
 {
 
-const char* ImageType_Prefixes[ImageType_COUNT] =
+static const o3tl::enumarray<ImageType, const char*> ImageType_Prefixes =
 {
     "cmd/sc_",
     "cmd/lc_"
@@ -121,7 +121,7 @@ bool CommandImageResolver::hasImage(const OUString& rCommandURL)
     return pIterator != m_aCommandToImageNameMap.end();
 }
 
-ImageList* CommandImageResolver::getImageList(sal_Int16 nImageType)
+ImageList* CommandImageResolver::getImageList(ImageType nImageType)
 {
     const OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
 
@@ -144,7 +144,7 @@ ImageList* CommandImageResolver::getImageList(sal_Int16 nImageType)
     return m_pImageList[nImageType];
 }
 
-Image CommandImageResolver::getImageFromCommandURL(sal_Int16 nImageType, const OUString& rCommandURL)
+Image CommandImageResolver::getImageFromCommandURL(ImageType nImageType, const OUString& rCommandURL)
 {
     CommandToImageNameMap::const_iterator pIterator = m_aCommandToImageNameMap.find(rCommandURL);
     if (pIterator != m_aCommandToImageNameMap.end())
commit 591a9129451234a60a88849f8ce01af3c7c5b9b6
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed May 25 15:23:22 2016 +0300

    Don't claim to be reading a file before trying to open it
    
    Change-Id: I8a3332c4b1acaa4dc69ff9349d2e9241fb4f340f

diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index e6ea3a1..70f4b09 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -67,7 +67,6 @@ OString loadShader(const OUString& rFilename)
 {
     OUString aFileURL = getShaderFolder() + rFilename +".glsl";
     osl::File aFile(aFileURL);
-    SAL_INFO("vcl.opengl", "Reading " << aFileURL);
     if(aFile.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None)
     {
         sal_uInt64 nSize = 0;
@@ -77,11 +76,12 @@ OString loadShader(const OUString& rFilename)
         aFile.read(content.get(), nSize, nBytesRead);
         assert(nSize == nBytesRead);
         content.get()[nBytesRead] = 0;
+        SAL_INFO("vcl.opengl", "Read " << nBytesRead << " bytes from " << aFileURL);
         return OString(content.get());
     }
     else
     {
-        SAL_WARN("vcl.opengl", "could not load the file: " << aFileURL);
+        SAL_WARN("vcl.opengl", "Could not open " << aFileURL);
     }
 
     return OString();


More information about the Libreoffice-commits mailing list