[PATCH] tempfile: aRet is always empty

Thomas Arnhold (via Code Review) gerrit at gerrit.libreoffice.org
Tue Mar 5 17:30:42 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2558

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/58/2558/1

tempfile: aRet is always empty

pParent is no longer used so this code makes
no sense.

Change-Id: I9c53b263a640e53140a8ae8795181b1c5e43f26d
---
M tools/source/fsys/tempfile.cxx
1 file changed, 6 insertions(+), 26 deletions(-)



diff --git a/tools/source/fsys/tempfile.cxx b/tools/source/fsys/tempfile.cxx
index 1a1da1e..781fe2a 100644
--- a/tools/source/fsys/tempfile.cxx
+++ b/tools/source/fsys/tempfile.cxx
@@ -55,33 +55,13 @@
 
 #define TMPNAME_SIZE  ( 1 + 5 + 5 + 4 + 1 )
 
-OUString ConstructTempDir_Impl( const String* pParent )
+OUString ConstructTempDir_Impl( const String* /* pParent */ )
 {
-    OUString aName;
-    if ( pParent && pParent->Len() )
-    {
-        rtl::OUString aRet;
-
-        // test for valid filename
-        {
-            ::osl::DirectoryItem aItem;
-            sal_Int32 i = aRet.getLength();
-            if ( aRet[i-1] == '/' )
-                i--;
-
-            if ( DirectoryItem::get( aRet.copy(0, i), aItem ) == FileBase::E_None )
-                aName = aRet;
-        }
-    }
-
-    if ( aName.isEmpty() )
-    {
-        // if no parent or invalid parent : use system directory
-        ::rtl::OUString& rTempNameBase_Impl = TempNameBase_Impl::get();
-        if ( rTempNameBase_Impl.isEmpty() )
-            rTempNameBase_Impl = GetSystemTempDirPath_Impl();
-        aName = rTempNameBase_Impl;
-    }
+    // use system directory
+    ::rtl::OUString& rTempNameBase_Impl = TempNameBase_Impl::get();
+    if ( rTempNameBase_Impl.isEmpty() )
+        rTempNameBase_Impl = GetSystemTempDirPath_Impl();
+    OUString aName = rTempNameBase_Impl;
 
     // Make sure that directory ends with a separator
     if( !aName.endsWith( "/" ) )

-- 
To view, visit https://gerrit.libreoffice.org/2558
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c53b263a640e53140a8ae8795181b1c5e43f26d
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Thomas Arnhold <thomas at arnhold.org>



More information about the LibreOffice mailing list