[Libreoffice-commits] .: tools/bootstrp tools/inc
Joseph Powers
jpowers at kemper.freedesktop.org
Sat Jan 15 20:50:54 PST 2011
tools/bootstrp/prj.cxx | 62 +++++++--------------------------------------
tools/inc/bootstrp/prj.hxx | 11 +------
2 files changed, 13 insertions(+), 60 deletions(-)
New commits:
commit 059d4603e7adf014397ebd626f5830d03db78c65
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sat Jan 15 20:50:47 2011 -0800
Remove DECLARE_LIST( StarFileList, StarFile * )
Note: I messed up the SolarFileList before so I'm going to submit another
patch to fix it. I'm not sure why the code is working now...
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index 23446bf..928dee6 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.cxx
@@ -573,21 +573,6 @@ Star::~Star()
}
/*****************************************************************************/
-BOOL Star::NeedsUpdate()
-/*****************************************************************************/
-{
- aMutex.acquire();
- for ( ULONG i = 0; i < aLoadedFilesList.Count(); i++ )
- if ( aLoadedFilesList.GetObject( i )->NeedsUpdate()) {
- aMutex.release();
- return TRUE;
- }
-
- aMutex.release();
- return FALSE;
-}
-
-/*****************************************************************************/
void Star::Read( String &rFileName )
/*****************************************************************************/
{
@@ -599,6 +584,7 @@ void Star::Read( String &rFileName )
aEntry = aEntry.GetPath().GetPath().GetPath();
sSourceRoot = aEntry.GetFull();
+ // todo: change this to while( !aFileList.empty() )
for ( size_t i = 0, n = aFileList.size(); i < n; ++ i )
{
StarFile *pFile = new StarFile( *aFileList[ i ] );
@@ -607,10 +593,14 @@ void Star::Read( String &rFileName )
while (( aString = aSolarConfig.GetNext()) != "" )
InsertToken (( char * ) aString.GetBuffer());
}
- aMutex.acquire();
- aLoadedFilesList.Insert( pFile, LIST_APPEND );
- aMutex.release();
+ // todo: delete the pFile (it's not needed any more)
+ // todo: change the delete; to remove the 1st item in the list.
+ // what happens is new files may be added to the list by InsertToken()... thus, the list
+ // gets longer as things get processed. Thus, we need to remove things from the front as
+ // they get processed.
+ delete aFileList[ i ];
}
+ // todo: remove the clear(); if we left the loop above, then the list is empty
aFileList.clear();
// resolve all dependencies recursive
Expand_Impl();
@@ -630,11 +620,7 @@ void Star::Read( SolarFileList *pSolarFiles )
while (( aString = aSolarConfig.GetNext()) != "" )
InsertToken (( char * ) aString.GetBuffer());
}
-
- aMutex.acquire();
- aLoadedFilesList.Insert( pFile, LIST_APPEND );
- aMutex.release();
- delete (*pSolarFiles)[ i ]; // TODO: isn't this deleting the object inserted into aLoadedFilesList?
+ delete (*pSolarFiles)[ i ];
}
pSolarFiles->clear();
delete pSolarFiles;
@@ -1129,11 +1115,7 @@ USHORT StarWriter::Read( String aFileName, BOOL bReadComments, USHORT nMode )
while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" )
InsertTokenLine ( aString );
}
-
- aMutex.acquire();
- aLoadedFilesList.Insert( pFile, LIST_APPEND );
- aMutex.release();
- delete aFileList[ i ]; // TODO: isn't this deleting the object inserted into aLoadedFilesList?
+ delete aFileList[ i ];
}
aFileList.clear();
// resolve all dependencies recursive
@@ -1160,11 +1142,7 @@ USHORT StarWriter::Read( SolarFileList *pSolarFiles, BOOL bReadComments )
while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" )
InsertTokenLine ( aString );
}
-
- aMutex.acquire();
- aLoadedFilesList.Insert( pFile, LIST_APPEND );
- aMutex.release();
- delete (*pSolarFiles)[ i ]; // TODO: isn't this deleting the object inserted into aLoadedFilesList?
+ delete (*pSolarFiles)[ i ];
}
pSolarFiles->clear();
delete pSolarFiles;
@@ -1591,22 +1569,4 @@ StarFile::StarFile( const String &rFile )
bExists = FALSE;
}
-/*****************************************************************************/
-BOOL StarFile::NeedsUpdate()
-/*****************************************************************************/
-{
- DirEntry aEntry( aFileName );
- if ( aEntry.Exists()) {
- if ( !bExists ) {
- bExists = TRUE;
- return TRUE;
- }
- FileStat aStat( aEntry );
- if (( aStat.DateModified() > aDate ) ||
- (( aStat.DateModified() == aDate ) && ( aStat.TimeModified() > aTime )))
- return TRUE;
- }
- return FALSE;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/inc/bootstrp/prj.hxx b/tools/inc/bootstrp/prj.hxx
index ea1b3b5..ecd202a 100644
--- a/tools/inc/bootstrp/prj.hxx
+++ b/tools/inc/bootstrp/prj.hxx
@@ -285,21 +285,16 @@ private:
public:
StarFile( const String &rFile );
- const String &GetName() { return aFileName; }
- Date GetDate() { return aDate; }
- Time GetTime() { return aTime; }
-
- BOOL NeedsUpdate();
BOOL Exists() { return bExists; }
};
-DECLARE_LIST( StarFileList, StarFile * )
-
#define STAR_MODE_SINGLE_PARSE 0x0000
#define STAR_MODE_RECURSIVE_PARSE 0x0001
#define STAR_MODE_MULTIPLE_PARSE 0x0002
typedef ::std::vector< Prj* > StarList;
+// todo: SolarFileList should be a linked list and not a vector.
+// also, the Read() functions need to be changed (see 1st read() in prj.cxx for notes)
typedef ::std::vector< String* > SolarFileList;
class Star
@@ -316,7 +311,6 @@ protected:
USHORT nStarMode;
SolarFileList aFileList;
- StarFileList aLoadedFilesList;
String sSourceRoot;
void InsertSolarList( String sProject );
@@ -347,7 +341,6 @@ public:
ByteString GetPrjName( DirEntry &rPath );
void InsertToken( char *pChar );
- BOOL NeedsUpdate();
USHORT GetMode() { return nStarMode; }
More information about the Libreoffice-commits
mailing list