[Libreoffice-commits] core.git: include/unotools unotools/source vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Apr 25 08:23:06 UTC 2018


 include/unotools/ucbstreamhelper.hxx          |   15 +++++------
 unotools/source/ucbhelper/ucbstreamhelper.cxx |   34 +++++++++++++-------------
 vcl/source/graphic/GraphicLoader.cxx          |    4 +--
 3 files changed, 26 insertions(+), 27 deletions(-)

New commits:
commit 7c9d8afd913c17100aa4185e3b044137f225c81f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Apr 25 10:22:25 2018 +0200

    Revert "make UcbStreamHelper return SvStream by std::unique_ptr"
    
    This reverts commit eeefb8c440b514cefdc4e82cc06843da9eabeb13.
    
    this was pushed in error

diff --git a/include/unotools/ucbstreamhelper.hxx b/include/unotools/ucbstreamhelper.hxx
index d89048500bcd..68309d094acf 100644
--- a/include/unotools/ucbstreamhelper.hxx
+++ b/include/unotools/ucbstreamhelper.hxx
@@ -25,7 +25,6 @@
 #include <unotools/unotoolsdllapi.h>
 
 #include <tools/stream.hxx>
-#include <memory>
 
 namespace com
 {
@@ -53,13 +52,13 @@ namespace utl
     class UNOTOOLS_DLLPUBLIC UcbStreamHelper
     {
     public:
-        static std::unique_ptr<SvStream> CreateStream( const OUString& rFileName, StreamMode eOpenMode );
-        static std::unique_ptr<SvStream> CreateStream( const OUString& rFileName, StreamMode eOpenMode,
-                                             bool bFileExists );
-        static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream );
-        static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XStream >& xStream );
-        static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream, bool bCloseStream );
-        static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XStream >& xStream, bool bCloseStream );
+        static SvStream*    CreateStream( const OUString& rFileName, StreamMode eOpenMode );
+        static SvStream*    CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+                                          bool bFileExists );
+        static SvStream*    CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream );
+        static SvStream*    CreateStream( const css::uno::Reference < css::io::XStream >& xStream );
+        static SvStream*    CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream, bool bCloseStream );
+        static SvStream*    CreateStream( const css::uno::Reference < css::io::XStream >& xStream, bool bCloseStream );
     };
 }
 
diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx
index 87f7d903a481..63260f632b91 100644
--- a/unotools/source/ucbhelper/ucbstreamhelper.cxx
+++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx
@@ -42,11 +42,11 @@ using namespace ::com::sun::star::beans;
 namespace utl
 {
 
-static std::unique_ptr<SvStream> lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMode,
                                    const Reference < XInteractionHandler >& xInteractionHandler,
                                    bool bEnsureFileExists )
 {
-    std::unique_ptr<SvStream> pStream;
+    SvStream* pStream = nullptr;
     UcbLockBytesRef xLockBytes;
     if ( eOpenMode & StreamMode::WRITE )
     {
@@ -119,7 +119,7 @@ static std::unique_ptr<SvStream> lcl_CreateStream( const OUString& rFileName, St
                                                     eOpenMode, xInteractionHandler );
         if ( xLockBytes.is() )
         {
-            pStream.reset(new SvStream( xLockBytes.get() ));
+            pStream = new SvStream( xLockBytes.get() );
             pStream->SetBufferSize( 4096 );
             pStream->SetError( xLockBytes->GetError() );
         }
@@ -137,7 +137,7 @@ static std::unique_ptr<SvStream> lcl_CreateStream( const OUString& rFileName, St
     return pStream;
 }
 
-std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode )
+SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode )
 {
     // related tdf#99312
     // create a specialized interaction handler to manages Web certificates and Web credentials when needed
@@ -149,7 +149,7 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileNa
     return lcl_CreateStream( rFileName, eOpenMode, xIHScoped, true /* bEnsureFileExists */ );
 }
 
-std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
                                          bool bFileExists )
 {
     // related tdf#99312
@@ -162,13 +162,13 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileNa
 }
 
 
-std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream )
+SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream )
 {
-    std::unique_ptr<SvStream> pStream;
+    SvStream* pStream = nullptr;
     UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream );
     if ( xLockBytes.is() )
     {
-        pStream.reset(new SvStream( xLockBytes.get() ));
+        pStream = new SvStream( xLockBytes.get() );
         pStream->SetBufferSize( 4096 );
         pStream->SetError( xLockBytes->GetError() );
     }
@@ -176,15 +176,15 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInpu
     return pStream;
 }
 
-std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStream >& xStream )
+SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream )
 {
-    std::unique_ptr<SvStream> pStream;
+    SvStream* pStream = nullptr;
     if ( xStream->getOutputStream().is() )
     {
         UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream );
         if ( xLockBytes.is() )
         {
-            pStream.reset(new SvStream( xLockBytes.get() ));
+            pStream = new SvStream( xLockBytes.get() );
             pStream->SetBufferSize( 4096 );
             pStream->SetError( xLockBytes->GetError() );
         }
@@ -195,16 +195,16 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStre
     return pStream;
 }
 
-std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream, bool bCloseStream )
+SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream, bool bCloseStream )
 {
-    std::unique_ptr<SvStream> pStream;
+    SvStream* pStream = nullptr;
     UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream );
     if ( xLockBytes.is() )
     {
         if ( !bCloseStream )
             xLockBytes->setDontClose_Impl();
 
-        pStream.reset(new SvStream( xLockBytes.get() ));
+        pStream = new SvStream( xLockBytes.get() );
         pStream->SetBufferSize( 4096 );
         pStream->SetError( xLockBytes->GetError() );
     }
@@ -212,9 +212,9 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInpu
     return pStream;
 };
 
-std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStream >& xStream, bool bCloseStream )
+SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream, bool bCloseStream )
 {
-    std::unique_ptr<SvStream> pStream;
+    SvStream* pStream = nullptr;
     if ( xStream->getOutputStream().is() )
     {
         UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream );
@@ -223,7 +223,7 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStre
             if ( !bCloseStream )
                 xLockBytes->setDontClose_Impl();
 
-            pStream.reset(new SvStream( xLockBytes.get() ));
+            pStream = new SvStream( xLockBytes.get() );
             pStream->SetBufferSize( 4096 );
             pStream->SetError( xLockBytes->GetError() );
         }
diff --git a/vcl/source/graphic/GraphicLoader.cxx b/vcl/source/graphic/GraphicLoader.cxx
index d7f66c0fde7f..9c453acf0864 100644
--- a/vcl/source/graphic/GraphicLoader.cxx
+++ b/vcl/source/graphic/GraphicLoader.cxx
@@ -34,8 +34,8 @@ Graphic loadFromURL(OUString const& rURL, sal_Int16 nExtWidth, sal_Int16 nExtHei
 
     Graphic aGraphic;
 
-    std::unique_ptr<SvStream> pInputStream
-        = utl::UcbStreamHelper::CreateStream(rURL, StreamMode::READ);
+    std::unique_ptr<SvStream> pInputStream;
+    pInputStream.reset(utl::UcbStreamHelper::CreateStream(rURL, StreamMode::READ));
 
     if (pInputStream)
     {


More information about the Libreoffice-commits mailing list