Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,

I've removed all blocks of code #ifdef'ed by _OLD_FILE_IMPL because it was never defined. It builds successfully. Could someone please review to make sure that nothing was deleted accidentally?

Thank you,
Christina
From 665f2746fe89509f5e3e44ce9f263b5befe3cc34 Mon Sep 17 00:00:00 2001
From: Christina Rossmanith <ChrRossmanith@web.de>
Date: Mon, 21 Mar 2011 13:41:50 +0100
Subject: [PATCH] Removed never defined _OLD_FILE_IMPL

---
 basic/source/inc/runtime.hxx     |    9 ---
 basic/source/runtime/iosys.cxx   |   14 +----
 basic/source/runtime/methods.cxx |  135 --------------------------------------
 basic/source/runtime/step0.cxx   |   11 ---
 4 files changed, 1 insertions(+), 168 deletions(-)

diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index bd6c465..e89585a 100755
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -53,11 +53,6 @@ using namespace com::sun::star::lang;
 using namespace com::sun::star::container;
 
 
-// Define activates old file implementation
-// (only in non UCB case)
-// #define _OLD_FILE_IMPL
-
-
 namespace basicEncoder
 {
 
@@ -141,11 +136,7 @@ class SbiRTLData
 {
 public:
 
-#ifdef _OLD_FILE_IMPL
-    Dir*       pDir;
-#else
     ::osl::Directory* pDir;
-#endif
     sal_Int16  nDirFlags;
     short      nCurDirPos;
 
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 940395c..6e50389 100755
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -338,8 +338,6 @@ sal_Bool hasUno( void )
 
 
 
-#ifndef _OLD_FILE_IMPL
-
 class OslStream : public SvStream
 {
     osl::File maFile;
@@ -427,7 +425,7 @@ void OslStream::SetSize( sal_uIntPtr nSize )
     maFile.setSize( (sal_uInt64)nSize );
 }
 
-#endif
+//#endif
 
 
 #ifdef _USE_UNO
@@ -658,11 +656,7 @@ SbError SbiStream::Open
 #endif
     if( !pStrm )
     {
-#ifdef _OLD_FILE_IMPL
-        pStrm = new SvFileStream( aNameStr, nStrmMode );
-#else
         pStrm = new OslStream( aNameStr, nStrmMode );
-#endif
     }
     if( IsAppend() )
         pStrm->Seek( STREAM_SEEK_TO_END );
@@ -676,12 +670,6 @@ SbError SbiStream::Close()
 {
     if(        pStrm )
     {
-        if( !hasUno() )
-        {
-#ifdef _OLD_FILE_IMPL
-            ((SvFileStream *)pStrm)->Close();
-#endif
-        }
         MapError();
         delete pStrm;
         pStrm = NULL;
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 8d144a6..f7b4457 100755
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -616,22 +616,11 @@ RTLFUNC(FileCopy) // JSM
         }
         else
         {
-#ifdef _OLD_FILE_IMPL
-            DirEntry aSourceDirEntry(aSource);
-            if (aSourceDirEntry.Exists())
-            {
-                if (aSourceDirEntry.CopyTo(DirEntry(aDest),FSYS_ACTION_COPYFILE) != FSYS_ERR_OK)
-                    StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-            }
-            else
-                    StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
             FileBase::RC nRet = File::copy( getFullPathUNC( aSource ), getFullPathUNC( aDest ) );
             if( nRet != FileBase::E_None )
             {
                 StarBASIC::Error( SbERR_PATH_NOT_FOUND );
             }
-#endif
         }
     }
     else
@@ -671,12 +660,7 @@ RTLFUNC(Kill) // JSM
         }
         else
         {
-#ifdef _OLD_FILE_IMPL
-            if(DirEntry(aFileSpec).Kill() != FSYS_ERR_OK)
-                StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
             File::remove( getFullPathUNC( aFileSpec ) );
-#endif
         }
     }
     else
@@ -740,12 +724,7 @@ RTLFUNC(MkDir) // JSM
         }
         else
         {
-#ifdef _OLD_FILE_IMPL
-            if (!DirEntry(aPath).MakeDir())
-                StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
             Directory::create( getFullPathUNC( aPath ) );
-#endif
         }
     }
     else
@@ -753,8 +732,6 @@ RTLFUNC(MkDir) // JSM
 }
 
 
-#ifndef _OLD_FILE_IMPL
-
 // In OSL only empty directories can be deleted
 // so we have to delete all files recursively
 void implRemoveDirRecursive( const String& aDirPath )
@@ -810,7 +787,6 @@ void implRemoveDirRecursive( const String& aDirPath )
 
     nRet = Directory::remove( aDirPath );
 }
-#endif
 
 
 RTLFUNC(RmDir) // JSM
@@ -857,13 +833,7 @@ RTLFUNC(RmDir) // JSM
         }
         else
         {
-#ifdef _OLD_FILE_IMPL
-            DirEntry aDirEntry(aPath);
-            if (aDirEntry.Kill() != FSYS_ERR_OK)
-                StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
             implRemoveDirRecursive( getFullPathUNC( aPath ) );
-#endif
         }
     }
     else
@@ -924,16 +894,11 @@ RTLFUNC(FileLen)
         }
         else
         {
-#ifdef _OLD_FILE_IMPL
-            FileStat aStat = DirEntry( aStr );
-            nLen = aStat.GetSize();
-#else
             DirectoryItem aItem;
             DirectoryItem::get( getFullPathUNC( aStr ), aItem );
             FileStatus aFileStatus( FileStatusMask_FileSize );
             aItem.getFileStatus( aFileStatus );
             nLen = (sal_Int32)aFileStatus.getFileSize();
-#endif
         }
         rPar.Get(0)->PutLong( (long)nLen );
     }
@@ -2831,60 +2796,6 @@ RTLFUNC(Dir)
         }
         else
         {
-#ifdef _OLD_FILE_IMPL
-            if ( nParCount >= 2 )
-            {
-                delete pRTLData->pDir;
-                pRTLData->pDir = 0; // wg. Sonderbehandlung Sb_ATTR_VOLUME
-                DirEntry aEntry( rPar.Get(1)->GetString() );
-                FileStat aStat( aEntry );
-                if(!aStat.GetError() && (aStat.GetKind() & FSYS_KIND_FILE))
-                {
-                    // ah ja, ist nur ein dateiname
-                    // Pfad abschneiden (wg. VB4)
-                    rPar.Get(0)->PutString( aEntry.GetName() );
-                    return;
-                }
-                sal_uInt16 nFlags = 0;
-                if ( nParCount > 2 )
-                    pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
-                else
-                    pRTLData->nDirFlags = 0;
-
-                // Sb_ATTR_VOLUME wird getrennt gehandelt
-                if( pRTLData->nDirFlags & Sb_ATTR_VOLUME )
-                    aPath = aEntry.GetVolume();
-                else
-                {
-                    // Die richtige Auswahl treffen
-                    sal_uInt16 nMode = FSYS_KIND_FILE;
-                    if( nFlags & Sb_ATTR_DIRECTORY )
-                        nMode |= FSYS_KIND_DIR;
-                    if( nFlags == Sb_ATTR_DIRECTORY )
-                        nMode = FSYS_KIND_DIR;
-                    pRTLData->pDir = new Dir( aEntry, (DirEntryKind) nMode );
-                    pRTLData->nCurDirPos = 0;
-                }
-            }
-
-            if( pRTLData->pDir )
-            {
-                for( ;; )
-                {
-                    if( pRTLData->nCurDirPos >= pRTLData->pDir->Count() )
-                    {
-                        delete pRTLData->pDir;
-                        pRTLData->pDir = 0;
-                        aPath.Erase();
-                        break;
-                    }
-                    DirEntry aNextEntry=(*(pRTLData->pDir))[pRTLData->nCurDirPos++];
-                    aPath = aNextEntry.GetName(); //Full();
-                    break;
-                }
-            }
-            rPar.Get(0)->PutString( aPath );
-#else
             // TODO: OSL
             if ( nParCount >= 2 )
             {
@@ -2981,7 +2892,6 @@ RTLFUNC(Dir)
                 }
             }
             rPar.Get(0)->PutString( aPath );
-#endif
         }
     }
 }
@@ -3109,12 +3019,6 @@ RTLFUNC(FileDateTime)
         }
         else
         {
-#ifdef _OLD_FILE_IMPL
-            DirEntry aEntry( aPath );
-            FileStat aStat( aEntry );
-            aTime = Time( aStat.TimeModified() );
-            aDate = Date( aStat.DateModified() );
-#else
             DirectoryItem aItem;
             DirectoryItem::get( getFullPathUNC( aPath ), aItem );
             FileStatus aFileStatus( FileStatusMask_ModifyTime );
@@ -3125,7 +3029,6 @@ RTLFUNC(FileDateTime)
 
             aTime = Time( aDT.Hours, aDT.Minutes, aDT.Seconds, 10000000*aDT.NanoSeconds );
             aDate = Date( aDT.Day, aDT.Month, aDT.Year );
-#endif
         }
 
         double fSerial = (double)GetDayDiff( aDate );
@@ -4449,39 +4352,6 @@ RTLFUNC(SetAttr) // JSM
                 }
             }
         }
-        else
-        {
-#ifdef _OLD_FILE_IMPL
-            // #57064 Bei virtuellen URLs den Real-Path extrahieren
-            DirEntry aEntry( aStr );
-            String aFile = aEntry.GetFull();
-            ByteString aByteFile( aFile, gsl_getSystemTextEncoding() );
-    #ifdef WNT
-            if (!SetFileAttributes (aByteFile.GetBuffer(),(DWORD)nFlags))
-                StarBASIC::Error(SbERR_FILE_NOT_FOUND);
-    #endif
-    #ifdef OS2
-            FILESTATUS3 aFileStatus;
-            APIRET rc = DosQueryPathInfo(aByteFile.GetBuffer(),1,
-                                         &aFileStatus,sizeof(FILESTATUS3));
-            if (!rc)
-            {
-                if (aFileStatus.attrFile != nFlags)
-                {
-                    aFileStatus.attrFile = nFlags;
-                    rc = DosSetPathInfo(aFile.GetStr(),1,
-                                        &aFileStatus,sizeof(FILESTATUS3),0);
-                    if (rc)
-                        StarBASIC::Error( SbERR_FILE_NOT_FOUND );
-                }
-            }
-            else
-                StarBASIC::Error( SbERR_FILE_NOT_FOUND );
-    #endif
-#else
-            // Not implemented
-#endif
-        }
     }
     else
         StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4550,14 +4420,9 @@ RTLFUNC(FileExists)
         }
         else
         {
-#ifdef _OLD_FILE_IMPL
-            DirEntry aEntry( aStr );
-            bExists = aEntry.Exists();
-#else
             DirectoryItem aItem;
             FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aStr ), aItem );
             bExists = (nRet == FileBase::E_None);
-#endif
         }
         rPar.Get(0)->PutBool( bExists );
     }
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 2337fc5..e10d806 100755
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -1349,18 +1349,7 @@ void SbiRuntime::StepRENAME()            // Rename Tos+1 to Tos
     }
     else
     {
-#ifdef _OLD_FILE_IMPL
-        DirEntry aSourceDirEntry( aSource );
-        if( aSourceDirEntry.Exists() )
-        {
-            if( aSourceDirEntry.MoveTo( DirEntry(aDest) ) != FSYS_ERR_OK )
-                StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-        }
-        else
-                StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
         implStepRenameOSL( aSource, aDest );
-#endif
     }
 }
 
-- 
1.7.0.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.