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

Caolán McNamara caolanm at redhat.com
Thu Jul 16 06:07:14 PDT 2015


 include/unotools/tempfile.hxx          |   15 ++++-----------
 unotools/source/ucbhelper/tempfile.cxx |   20 +++++++-------------
 2 files changed, 11 insertions(+), 24 deletions(-)

New commits:
commit 59bdafe4c8faecfadde11ecdd5904e655918160a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 16 09:09:08 2015 +0100

    why bring ucb into the tempfile story when its always a file://
    
    Change-Id: I48d51cd24831072af647dd0172a2fd2e4a9ed2a5

diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx
index 51d901a..7876c82 100644
--- a/include/unotools/tempfile.hxx
+++ b/include/unotools/tempfile.hxx
@@ -45,7 +45,6 @@ namespace utl
 class UNOTOOLS_DLLPUBLIC TempFile
 {
     OUString    aName;
-    OUString    aURL;
     SvStream*   pStream;
     bool        bIsDirectory;
     bool        bKillingFileEnabled;
@@ -82,20 +81,14 @@ public:
     bool            IsValid() const;
 
                     /**
-                    Returns the "UCB compatible" URL of the tempfile object.
-                    If you want to have the "physical" file name, use the GetFileName() method of this object, because these
-                    method uses the UCB for the conversion, but never use any external conversion functions for URLs into
-                    "physical" names.
-                    If no UCP is available for the local file system, an empty URL is returned. In this case you can't access
-                    the file as a UCB content !
+                    Returns the URL of the tempfile object.
+                    If you want to have the system path file name, use the GetFileName() method of this object
                     */
     OUString        GetURL();
 
                     /**
-                    Returns the "physical" name of the tempfile in host notation ( should only be used for 3rd party code
-                    with file name interfaces ).
-                    If you want to have the URL, use the GetURL() method of this object, but never use any external
-                    conversion functions for "physical" names into URLs.
+                    Returns the system path name of the tempfile in host notation
+                    If you want to have the URL, use the GetURL() method of this object.
                     */
     OUString        GetFileName() const;
 
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index acd15e5..4f6628d 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -362,30 +362,24 @@ bool TempFile::IsValid() const
 OUString TempFile::GetFileName() const
 {
     OUString aTmp;
-    FileBase::getSystemPathFromFileURL( aName, aTmp );
+    FileBase::getSystemPathFromFileURL(aName, aTmp);
     return aTmp;
 }
 
 OUString TempFile::GetURL()
 {
-    if ( aURL.isEmpty() )
-    {
-        OUString const name(GetFileName());
-        LocalFileHelper::ConvertPhysicalNameToURL(name, aURL);
-        assert((name.isEmpty() || !aURL.isEmpty()) && "TempFile::GetURL failed: unit test is leaking temp files, add the ucpfile1 component!");
-    }
-
-    return aURL;
+    assert(!aName.isEmpty() && "TempFile::GetURL failed: unit test is leaking temp files, add the ucpfile1 component!");
+    return aName;
 }
 
 SvStream* TempFile::GetStream( StreamMode eMode )
 {
-    if ( !pStream )
+    if (!pStream)
     {
-        if ( !GetURL().isEmpty() )
-            pStream = UcbStreamHelper::CreateStream( aURL, eMode, true /* bFileExists */ );
+        if (!aName.isEmpty())
+            pStream = new SvFileStream(aName, eMode);
         else
-            pStream = new SvMemoryStream( NULL, 0, eMode );
+            pStream = new SvMemoryStream(NULL, 0, eMode);
     }
 
     return pStream;


More information about the Libreoffice-commits mailing list