Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv10992
Modified Files:
DirManager.h FileFormats.h FileFormats.cpp DirManager.cpp
Log Message:
Removed all usage of wxStringList as it has been deprecated and was causing a
tremendous slowdown in DirManager when dealing with a large number of files.
Index: FileFormats.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/FileFormats.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- FileFormats.cpp 15 Jun 2006 14:26:13 -0000 1.14
+++ FileFormats.cpp 17 Sep 2006 01:03:25 -0000 1.15
@@ -204,7 +204,7 @@
subtype == SF_FORMAT_PCM_32);
}
-void sf_get_all_extensions(wxStringList exts)
+void sf_get_all_extensions(wxArrayString &exts)
{
SF_FORMAT_INFO format_info;
int count, k;
Index: FileFormats.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/FileFormats.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- FileFormats.h 2 Oct 2003 02:34:12 -0000 1.10
+++ FileFormats.h 17 Sep 2006 01:03:25 -0000 1.11
@@ -54,7 +54,7 @@
bool sf_subtype_more_than_16_bits(unsigned int format);
bool sf_subtype_is_integer(unsigned int format);
-void sf_get_all_extensions(wxStringList exts);
+void sf_get_all_extensions(wxArrayString &exts);
//
// Mac OS 4-char type
Index: DirManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/DirManager.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- DirManager.h 25 Jul 2006 18:50:20 -0000 1.31
+++ DirManager.h 17 Sep 2006 01:03:25 -0000 1.32
@@ -157,7 +157,7 @@
wxString lastProject;
- wxStringList aliasList;
+ wxArrayString aliasList;
BlockFile **mLoadingTarget;
sampleFormat mLoadingFormat;
Index: DirManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/DirManager.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- DirManager.cpp 25 Jul 2006 18:50:20 -0000 1.68
+++ DirManager.cpp 17 Sep 2006 01:03:25 -0000 1.69
@@ -149,7 +149,7 @@
}
// behavior of dash_rf_enum is tailored to our two uses and thus not
-// entirely strightforward. It recurses depth-first from the passed
+// entirely straightforward. It recurses depth-first from the passed
// in directory into its subdirs according to optional dirspec
// matching, building a list of directories and [optionally] files to
// be rm()ed in the listed order. The dirspec is not applied to
@@ -158,7 +158,7 @@
// to the list.
static int rm_dash_rf_enumerate_i(wxString dirpath,
- wxStringList *flist,
+ wxArrayString &flist,
wxString dirspec,
int files_p,int dirs_p,
int progress_count,int progress_bias,
@@ -177,7 +177,7 @@
wxString filepath=dirpath + wxFILE_SEP_PATH + name;
count++;
- flist->Add(filepath);
+ flist.Add(filepath);
cont = dir.GetNext(&name);
@@ -207,7 +207,7 @@
}
if(dirs_p){
- flist->Add(dirpath);
+ flist.Add(dirpath);
count++;
}
@@ -216,7 +216,7 @@
static int rm_dash_rf_enumerate_prompt(wxString dirpath,
- wxStringList *flist,
+ wxArrayString &flist,
wxString dirspec,
int files_p,int dirs_p,
int progress_count,
@@ -236,7 +236,7 @@
}
static int rm_dash_rf_enumerate(wxString dirpath,
- wxStringList *flist,
+ wxArrayString &flist,
wxString dirspec,
int files_p,int dirs_p){
@@ -246,16 +246,16 @@
}
-static void rm_dash_rf_execute(wxStringList fnameList,
+static void rm_dash_rf_execute(wxArrayString &fList,
int count, int files_p, int dirs_p,
const wxChar *prompt){
- wxChar **array = fnameList.ListToArray();
wxProgressDialog *progress = NULL;
wxStartTimer();
for (int i = 0; i < count; i++) {
- wxChar *file = array[i];
+ const wxChar *file = fList[i].fn_str();
+
if(files_p){
wxRemoveFile(file);
}
@@ -277,8 +277,6 @@
if (progress)
delete progress;
-
- delete [] array;
}
// static
@@ -287,17 +285,17 @@
if (dontDeleteTempFiles)
return; // do nothing
- wxStringList fnameList;
- int count = 0;
+ wxArrayString flist;
+ int count;
// don't count the global temp directory, which this will find and
// list last
- count=rm_dash_rf_enumerate(globaltemp,&fnameList,wxT("project*"),1,1)-1;
+ count=rm_dash_rf_enumerate(globaltemp,flist,wxT("project*"),1,1)-1;
if (count == 0)
return;
- rm_dash_rf_execute(fnameList,count,1,1,_("Cleaning up temporary files"));
+ rm_dash_rf_execute(flist,count,1,1,_("Cleaning up temporary files"));
}
bool DirManager::SetProject(wxString & projPath, wxString & projName,
@@ -420,9 +418,9 @@
// recurse depth-first and rmdir every directory seen in old and
// new; rmdir will fail on non-empty dirs.
- wxStringList dirlist;
- count=rm_dash_rf_enumerate(cleanupLoc1,&dirlist,wxEmptyString,0,1);
- count+=rm_dash_rf_enumerate(cleanupLoc2,&dirlist,wxEmptyString,0,1);
+ wxArrayString dirlist;
+ count=rm_dash_rf_enumerate(cleanupLoc1,dirlist,wxEmptyString,0,1);
+ count+=rm_dash_rf_enumerate(cleanupLoc2,dirlist,wxEmptyString,0,1);
if(count)
rm_dash_rf_execute(dirlist,count,0,1,_("Cleaning up cache
directories"));
@@ -969,7 +967,7 @@
// Quick check: If it's not even in our alias list,
// then the file name is A-OK.
- if (!aliasList.Member(fName.GetFullPath()))
+ if (aliasList.Index(fName.GetFullPath()) == wxNOT_FOUND)
return true;
// If any of the following commands fail, your guess is as
@@ -1055,7 +1053,7 @@
return false;
}
- aliasList.Delete(fName.GetFullPath());
+ aliasList.Remove(fName.GetFullPath());
aliasList.Add(renamedFile.GetFullPath());
}
@@ -1099,11 +1097,12 @@
// at each step by looking at the size of the blockfile hash
int blockcount=blockFileHash.size();
int ret=0;
+ int ndx;
// enumerate *all* files in the project directory
- wxStringList fnameList;
+ wxArrayString fnameList;
- wxStringList orphanList;
+ wxArrayString orphanList;
BlockHash missingAliasList;
BlockHash missingAliasFiles;
BlockHash missingSummaryList;
@@ -1111,14 +1110,13 @@
// this function is finally a misnomer
rm_dash_rf_enumerate_prompt((projFull != wxT("")? projFull: mytemp),
- &fnameList,wxEmptyString,1,0,blockcount,
+ fnameList,wxEmptyString,1,0,blockcount,
_("Inspecting project file data..."));
// enumerate orphaned blockfiles
BlockHash diskFileHash;
- wxStringListNode *node = fnameList.GetFirst();
- while(node){
- wxFileName fullname(node->GetData());
+ for(ndx=0;ndx<(int)fnameList.GetCount();ndx++){
+ wxFileName fullname = fnameList[ndx];
wxString basename=fullname.GetName();
diskFileHash[basename.c_str()]=0; // just needs to be defined
@@ -1129,7 +1127,6 @@
wxLogWarning(_("Orphaned blockfile: (%s)"),
fullname.GetFullPath().c_str());
}
- node=node->GetNext();
}
// enumerate missing alias files
@@ -1221,7 +1218,7 @@
_("Project check found %d orphaned blockfile[s]. These files
are\nunused and probably left over from a crash or some other bug.\nThey should
be deleted to avoid disk contention.");
wxString prompt;
- prompt.Printf(promptA,orphanList.GetCount());
+ prompt.Printf(promptA,(int)orphanList.GetCount());
const wxChar *buttons[]={_("Delete orphaned files [safe and
recommended]"),
_("Continue without deleting; silently work
around the extra files"),
@@ -1234,11 +1231,8 @@
if(action==0){
ret |= FSCKstatus_CHANGED;
- wxStringListNode *node=orphanList.GetFirst();
- while(node){
- wxString fullpath=node->GetData();
- wxRemoveFile(fullpath);
- node=node->GetNext();
+ for(ndx=0;ndx<(int)orphanList.GetCount();ndx++){
+ wxRemoveFile(orphanList[ndx]);
}
}
}
@@ -1376,7 +1370,7 @@
// clean up any empty directories
fnameList.Clear();
rm_dash_rf_enumerate_prompt((projFull != wxT("")? projFull: mytemp),
- &fnameList,wxEmptyString,0,1,blockcount,
+ fnameList,wxEmptyString,0,1,blockcount,
_("Cleaning up unused directories in project
data..."));
rm_dash_rf_execute(fnameList,0,0,1,0);
@@ -1393,38 +1387,35 @@
// Might want to unify / modularize the approach some time.
void DirManager::RemoveOrphanedBlockfiles()
{
+ int i;
+
// get a rough guess of how many blockfiles will be found/processed
// at each step by looking at the size of the blockfile hash
int blockcount=blockFileHash.size();
// enumerate *all* files in the project directory
- wxStringList fnameList;
+ wxArrayString fnameList;
// this function is finally a misnomer
rm_dash_rf_enumerate_prompt((projFull != wxT("")? projFull: mytemp),
- &fnameList,wxEmptyString,1,0,blockcount,
+ fnameList,wxEmptyString,1,0,blockcount,
_("Inspecting project file data..."));
// enumerate orphaned blockfiles
- wxStringList orphanList;
- wxStringListNode *node = fnameList.GetFirst();
- while(node){
- wxFileName fullname(node->GetData());
+ wxArrayString orphanList;
+ for(i=0;i<(int)fnameList.GetCount();i++){
+ wxFileName fullname(fnameList[i]);
wxString basename=fullname.GetName();
if(blockFileHash.find(basename) == blockFileHash.end()){
// the blockfile on disk is orphaned
orphanList.Add(fullname.GetFullPath());
}
- node=node->GetNext();
}
// remove all orphaned blockfiles
- node=orphanList.GetFirst();
- while(node){
- wxString fullpath=node->GetData();
- wxRemoveFile(fullpath);
- node=node->GetNext();
+ for(i=0;i<(int)orphanList.GetCount();i++){
+ wxRemoveFile(orphanList[i]);
}
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs