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

Matúš Kukan matus.kukan at collabora.com
Wed Nov 19 02:29:25 PST 2014


 vcl/inc/impgraph.hxx        |    2 
 vcl/source/gdi/impgraph.cxx |  102 --------------------------------------------
 2 files changed, 3 insertions(+), 101 deletions(-)

New commits:
commit db222b74f1482870aac76d51646215d756901b8d
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Wed Nov 19 11:18:16 2014 +0100

    mbSwapUnderway always true inside ImpGraphic::ImplReadEmbedded
    
    Change-Id: I641a9ca69d8e821f6b4e82ca98179a59b793345a

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index eafd6c3..4b3dc17 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -981,17 +981,6 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
     const sal_uInt16    nOldFormat = rIStm.GetNumberFormatInt();
     bool            bRet = false;
 
-    if( !mbSwapUnderway )
-    {
-        const OUString aTempURLStr( maDocFileURLStr );
-        const sal_uLong nTempPos = mnDocFilePos;
-
-        ImplClear();
-
-        maDocFileURLStr = aTempURLStr;
-        mnDocFilePos = nTempPos;
-    }
-
     rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
     rIStm.ReadUInt32( nId );
 
commit b62e70ef6f352c61d50eca36388e9aa8d3f5e412
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Wed Nov 19 11:09:44 2014 +0100

    ImpGraphic::ImplReadEmbedded: bSwap is false; remove dead code
    
    Change-Id: Ie5b6b593e178d3752ebf7421af8aee4b50f75819

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 513074d..f376603 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -136,7 +136,7 @@ private:
     const OUString&     ImplGetDocFileName() const;
     sal_uLong               ImplGetDocFilePos() const { return mnDocFilePos;}
 
-    bool                ImplReadEmbedded( SvStream& rIStream, bool bSwap = false );
+    bool                ImplReadEmbedded( SvStream& rIStream );
     bool                ImplWriteEmbedded( SvStream& rOStream );
 
     bool                ImplSwapIn();
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index b41ecd8..eafd6c3 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -40,7 +40,6 @@
 #include <vcl/dibtools.hxx>
 #include <boost/scoped_ptr.hpp>
 
-#define GRAPHIC_MAXPARTLEN          256000L
 #define GRAPHIC_MTFTOBMP_MAXEXT     2048
 #define GRAPHIC_STREAMBUFSIZE       8192UL
 
@@ -970,7 +969,7 @@ const OUString& ImpGraphic::ImplGetDocFileName() const
 }
 
 
-bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, bool bSwap )
+bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
 {
     MapMode         aMapMode;
     Size            aSize;
@@ -1071,93 +1070,7 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, bool bSwap )
             maMetaFile.SetPrefSize( aSize );
         }
 
-        if( bSwap )
-        {
-            if (!maDocFileURLStr.isEmpty())
-            {
-                rIStm.Seek( nStartPos + nHeaderLen + nLen );
-                bRet = mbSwapOut = true;
-            }
-            else
-            {
-                ::utl::TempFile     aTempFile;
-                const INetURLObject aTmpURL( aTempFile.GetURL() );
-
-                if( !aTmpURL.GetMainURL( INetURLObject::NO_DECODE ).isEmpty() )
-                {
-                    boost::scoped_ptr<SvStream> pOStm;
-                    try
-                    {
-                        pOStm.reset(::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE | STREAM_SHARE_DENYWRITE ));
-                    }
-                    catch( const ::com::sun::star::uno::Exception& )
-                    {
-                    }
-
-                    if( pOStm )
-                    {
-                        sal_uLong   nFullLen = nHeaderLen + nLen;
-                        sal_uLong   nPartLen = std::min( nFullLen, (sal_uLong) GRAPHIC_MAXPARTLEN );
-                        sal_uInt8*  pBuffer = (sal_uInt8*) rtl_allocateMemory( nPartLen );
-
-                          pOStm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
-
-                        if( pBuffer )
-                        {
-                            rIStm.Seek( nStartPos );
-
-                            while( nFullLen )
-                            {
-                                rIStm.Read( (char*) pBuffer, nPartLen );
-                                pOStm->Write( (char*) pBuffer, nPartLen );
-
-                                nFullLen -= nPartLen;
-
-                                if( nFullLen < GRAPHIC_MAXPARTLEN )
-                                    nPartLen = nFullLen;
-                            }
-
-                            rtl_freeMemory( pBuffer );
-                            sal_uLong nReadErr = rIStm.GetError(), nWriteErr = pOStm->GetError();
-                            pOStm.reset();
-
-                            if( !nReadErr && !nWriteErr )
-                            {
-                                bRet = mbSwapOut = true;
-                                mpSwapFile = new ImpSwapFile;
-                                mpSwapFile->nRefCount = 1;
-                                mpSwapFile->aSwapURL = aTmpURL;
-                            }
-                            else
-                            {
-                                try
-                                {
-                                    ::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ),
-                                                         ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
-                                                         comphelper::getProcessComponentContext() );
-
-                                    aCnt.executeCommand( OUString("delete"),
-                                                         ::com::sun::star::uno::makeAny( true ) );
-                                }
-                                catch( const ::com::sun::star::ucb::ContentCreationException& )
-                                {
-                                }
-                                catch( const ::com::sun::star::uno::RuntimeException& )
-                                {
-                                }
-                                catch( const ::com::sun::star::ucb::CommandAbortedException& )
-                                {
-                                }
-                                catch( const ::com::sun::star::uno::Exception& )
-                                {
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        else if( meType == GRAPHIC_BITMAP || meType == GRAPHIC_GDIMETAFILE )
+        if( meType == GRAPHIC_BITMAP || meType == GRAPHIC_GDIMETAFILE )
         {
             ReadImpGraphic( rIStm, *this );
             bRet = ( rIStm.GetError() == 0UL );


More information about the Libreoffice-commits mailing list