1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-04 17:49:45 +02:00

In DirManager.cpp, probably fixed bug 451, by not deleting over-long blockfile.

Made Sequence::HandleXMLEndTag log errors more specific.

Differentiated "Gap detected in project file" error messages.
This commit is contained in:
v.audacity 2011-10-12 05:40:23 +00:00
parent 7b04d6518d
commit 4d1e18d8fd
2 changed files with 12 additions and 5 deletions

View File

@ -45,7 +45,7 @@
The blockfile/directory scheme is rather complicated with two different schemes.
The current scheme uses two levels of subdirectories - up to 256 'eXX' and up to
256 'dYY' directories with in each of the 'eXX' dirs, where XX and YY are hex chars.
256 'dYY' directories within each of the 'eXX' dirs, where XX and YY are hex chars.
In each of the dXX directories there are up to 256 audio files (e.g. .au or .auf).
They have a filename scheme of 'eXXYYZZZZ', where XX and YY refers to the
subdirectories as above. The 'ZZZZ' component is generated randomly for some reason.
@ -1050,6 +1050,9 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
((mMaxSamples > -1) && // is initialized
(pBlockFile->GetLength() > mMaxSamples)))
{
// See http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c13.
// Lock pBlockFile so that the ~BlockFile() will not delete the file on disk.
pBlockFile->Lock();
delete pBlockFile;
return false;
}

View File

@ -827,7 +827,7 @@ void Sequence::HandleXMLEndTag(const wxChar *tag)
if (wxStrcmp(tag, wxT("sequence")) != 0)
return;
// Make sure that the sequence is valid
// Make sure that the sequence is valid.
// First, replace missing blockfiles with SilentBlockFiles
unsigned int b;
for (b = 0; b < mBlock->Count(); b++) {
@ -840,11 +840,15 @@ void Sequence::HandleXMLEndTag(const wxChar *tag)
len = mNumSamples - mBlock->Item(b)->start;
if (len > mMaxSamples)
{
// This could be why the blockfile failed, so limit
// the silent replacement to mMaxSamples.
len = mMaxSamples;
wxLogError(_(" Sequence has missing block file with length > mMaxSamples."));
}
mBlock->Item(b)->f = new SilentBlockFile(len);
wxLogError(_("Gap detected in project file."));
wxLogError(
_("Gap detected in project file. Missing block file replaced with silence."));
mErrorOpening = true;
}
}
@ -854,14 +858,14 @@ void Sequence::HandleXMLEndTag(const wxChar *tag)
for (b = 0; b < mBlock->Count(); b++) {
if (mBlock->Item(b)->start != numSamples) {
mBlock->Item(b)->start = numSamples;
wxLogError(_("Gap detected in project file."));
wxLogError(_("Gap detected in project file.\n Block specification for block file started after end of previous block.\n Start has been moved back so blocks are contiguous."));
mErrorOpening = true;
}
numSamples += mBlock->Item(b)->f->GetLength();
}
if (mNumSamples != numSamples) {
mNumSamples = numSamples;
wxLogError(_("Gap detected in project file."));
wxLogError(_("Gap detected in project file. Sequence sample count corrected."));
mErrorOpening = true;
}
}