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...
This commit is contained in:
parent
008023cd2a
commit
7763ff4539
2 changed files with 13 additions and 60 deletions
|
@ -572,21 +572,6 @@ Star::~Star()
|
|||
maStarList.clear();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
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: */
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue