openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1498343 - /openoffice/trunk/main/sfx2/source/doc/docfile.cxx
Date Mon, 01 Jul 2013 09:54:24 GMT
Author: orw
Date: Mon Jul  1 09:54:24 2013
New Revision: 1498343

URL: http://svn.apache.org/r1498343
Log:
121143: SfxMedium - assure that name of internal used temporary file does not clash with SfxMedium's
name

Modified:
    openoffice/trunk/main/sfx2/source/doc/docfile.cxx

Modified: openoffice/trunk/main/sfx2/source/doc/docfile.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/doc/docfile.cxx?rev=1498343&r1=1498342&r2=1498343&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/doc/docfile.cxx (original)
+++ openoffice/trunk/main/sfx2/source/doc/docfile.cxx Mon Jul  1 09:54:24 2013
@@ -585,7 +585,9 @@ Reference < XContent > SfxMedium::GetCon
 SvStream* SfxMedium::GetInStream()
 {
     if ( pInStream )
+    {
         return pInStream;
+    }
 
     if ( pImp->pTempFile )
     {
@@ -601,13 +603,17 @@ SvStream* SfxMedium::GetInStream()
             pInStream = NULL;
         }
         else
+        {
             return pInStream;
+        }
     }
 
     GetMedium_Impl();
 
     if ( GetError() )
+    {
         return NULL;
+    }
 
     return pInStream;
 }
@@ -2330,14 +2336,20 @@ void SfxMedium::GetMedium_Impl()
 
         //TODO/MBA: ErrorHandling - how to transport error from MediaDescriptor
         if ( !GetError() && !pImp->xStream.is() && !pImp->xInputStream.is()
)
+        {
             SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
OSL_LOG_PREFIX ) ) );
+        }
 
         if ( !GetError() )
         {
             if ( pImp->xStream.is() )
+            {
                 pInStream = utl::UcbStreamHelper::CreateStream( pImp->xStream );
+            }
             else if ( pImp->xInputStream.is() )
+            {
                 pInStream = utl::UcbStreamHelper::CreateStream( pImp->xInputStream );
+            }
         }
 
         pImp->bDownloadDone = sal_True;
@@ -3447,15 +3459,23 @@ sal_Bool SfxMedium::SetWritableForUserOn
 void SfxMedium::CreateTempFile( sal_Bool bReplace )
 {
     if ( pImp->pTempFile )
-	{
+    {
         if ( !bReplace )
             return;
 
         DELETEZ( pImp->pTempFile );
-		aName = String();
-	}
+        aName = String();
+    }
 
-    pImp->pTempFile = new ::utl::TempFile();
+    do
+    {
+        pImp->pTempFile = new ::utl::TempFile();
+        if ( GetName().Equals( pImp->pTempFile->GetURL() ) )
+        {
+            delete pImp->pTempFile;
+            pImp->pTempFile = NULL;
+        }
+    } while ( pImp->pTempFile == NULL );
     pImp->pTempFile->EnableKillingFile( sal_True );
     aName = pImp->pTempFile->GetFileName();
     ::rtl::OUString aTmpURL = pImp->pTempFile->GetURL();
@@ -3551,9 +3571,20 @@ void SfxMedium::CreateTempFileNoCopy()
 {
     // this call always replaces the existing temporary file
     if ( pImp->pTempFile )
+    {
         delete pImp->pTempFile;
+        pImp->pTempFile = NULL;
+    }
 
-    pImp->pTempFile = new ::utl::TempFile();
+    do
+    {
+        pImp->pTempFile = new ::utl::TempFile();
+        if ( GetName().Equals( pImp->pTempFile->GetURL() ) )
+        {
+            delete pImp->pTempFile;
+            pImp->pTempFile = NULL;
+        }
+    } while ( pImp->pTempFile == NULL );
     pImp->pTempFile->EnableKillingFile( sal_True );
     aName = pImp->pTempFile->GetFileName();
     if ( !aName.Len() )



Mime
View raw message