mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-01 15:43:44 +02:00
Write and read the wide aliasStart fields carefully...
...They may never have been large enough to matter, but some seek offsets into files were written as 64 bits but read back as only 32. It ought to be consistent.
This commit is contained in:
parent
a1d930322c
commit
0c4c835b27
@ -206,7 +206,10 @@ static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile)
|
||||
xmlFile.WriteAttr(wxT("name"), localName);
|
||||
xmlFile.WriteAttr(wxT("alias"), 1);
|
||||
xmlFile.WriteAttr(wxT("aliaspath"), aliasPath);
|
||||
|
||||
// This was written but not read again?
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), aliasStart);
|
||||
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), aliasLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), aliasChannel);
|
||||
xmlFile.WriteAttr(wxT("summarylen"), localLen);
|
||||
|
@ -68,7 +68,8 @@ void LegacyAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
||||
xmlFile.WriteAttr(wxT("alias"), 1);
|
||||
xmlFile.WriteAttr(wxT("name"), mFileName.GetFullName());
|
||||
xmlFile.WriteAttr(wxT("aliaspath"), mAliasedFileName.GetFullPath());
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
|
||||
xmlFile.WriteAttr(wxT("aliasstart"),
|
||||
static_cast<long long>( mAliasStart ));
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), mLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||
xmlFile.WriteAttr(wxT("summarylen"), mSummaryInfo.totalSummaryBytes);
|
||||
@ -89,6 +90,7 @@ BlockFilePtr LegacyAliasBlockFile::BuildFromXML(const wxString &projDir, const w
|
||||
int summaryLen=0;
|
||||
bool noRMS = false;
|
||||
long nValue;
|
||||
long long nnValue;
|
||||
|
||||
while(*attrs)
|
||||
{
|
||||
@ -116,11 +118,15 @@ BlockFilePtr LegacyAliasBlockFile::BuildFromXML(const wxString &projDir, const w
|
||||
// but we want to keep the reference to the missing file because it's a good path string.
|
||||
aliasFileName.Assign(strValue);
|
||||
}
|
||||
else if ( !wxStricmp(attr, wxT("aliasstart")) )
|
||||
{
|
||||
if (XMLValueChecker::IsGoodInt64(strValue) &&
|
||||
strValue.ToLongLong(&nnValue) && (nnValue >= 0))
|
||||
aliasStart = nnValue;
|
||||
}
|
||||
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{ // integer parameters
|
||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
||||
aliasStart = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
aliasLen = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||
aliasChannel = nValue;
|
||||
|
@ -207,7 +207,8 @@ void ODDecodeBlockFile::SaveXML(XMLWriter &xmlFile)
|
||||
mFileNameMutex.Unlock();
|
||||
LockRead();
|
||||
xmlFile.WriteAttr(wxT("audiofile"), mAudioFileName.GetFullPath());
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
|
||||
xmlFile.WriteAttr(wxT("aliasstart"),
|
||||
static_cast<long long>( mAliasStart ));
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), mLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||
xmlFile.WriteAttr(wxT("decodetype"), (size_t)mType);
|
||||
@ -229,6 +230,7 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
sampleCount aliasStart=0, aliasLen=0;
|
||||
int aliasChannel=0;
|
||||
long nValue;
|
||||
long long nnValue;
|
||||
unsigned int decodeType=0;
|
||||
|
||||
while(*attrs)
|
||||
@ -261,11 +263,15 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
// but we want to keep the reference to the file because it's a good path string.
|
||||
audioFileName.Assign(strValue);
|
||||
}
|
||||
else if ( !wxStricmp(attr, wxT("aliasstart")) )
|
||||
{
|
||||
if (XMLValueChecker::IsGoodInt64(strValue) &&
|
||||
strValue.ToLongLong(&nnValue) && (nnValue >= 0))
|
||||
aliasStart = nnValue;
|
||||
}
|
||||
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{ // integer parameters
|
||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
||||
aliasStart = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
aliasLen = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||
aliasChannel = nValue;
|
||||
|
@ -247,7 +247,8 @@ void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
||||
LockRead();
|
||||
|
||||
xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
|
||||
xmlFile.WriteAttr(wxT("aliasstart"),
|
||||
static_cast<long long>( mAliasStart));
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), mLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||
|
||||
@ -269,6 +270,7 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at
|
||||
sampleCount aliasStart=0, aliasLen=0;
|
||||
int aliasChannel=0;
|
||||
long nValue;
|
||||
long long nnValue;
|
||||
|
||||
while(*attrs)
|
||||
{
|
||||
@ -300,11 +302,15 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at
|
||||
// but we want to keep the reference to the missing file because it's a good path string.
|
||||
aliasFileName.Assign(strValue);
|
||||
}
|
||||
else if ( !wxStricmp(attr, wxT("aliasstart")) )
|
||||
{
|
||||
if (XMLValueChecker::IsGoodInt64(strValue) &&
|
||||
strValue.ToLongLong(&nnValue) && (nnValue >= 0))
|
||||
aliasStart = nnValue;
|
||||
}
|
||||
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{ // integer parameters
|
||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
||||
aliasStart = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
aliasLen = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||
aliasChannel = nValue;
|
||||
|
@ -165,7 +165,8 @@ void PCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
||||
|
||||
xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
|
||||
xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
|
||||
xmlFile.WriteAttr(wxT("aliasstart"),
|
||||
static_cast<long long>( mAliasStart ));
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), mLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||
xmlFile.WriteAttr(wxT("min"), mMin);
|
||||
@ -186,6 +187,7 @@ BlockFilePtr PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
float min = 0.0f, max = 0.0f, rms = 0.0f;
|
||||
double dblValue;
|
||||
long nValue;
|
||||
long long nnValue;
|
||||
|
||||
while(*attrs)
|
||||
{
|
||||
@ -217,11 +219,15 @@ BlockFilePtr PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
// but we want to keep the reference to the missing file because it's a good path string.
|
||||
aliasFileName.Assign(strValue);
|
||||
}
|
||||
else if ( !wxStricmp(attr, wxT("aliasstart")) )
|
||||
{
|
||||
if (XMLValueChecker::IsGoodInt64(strValue) &&
|
||||
strValue.ToLongLong(&nnValue) && (nnValue >= 0))
|
||||
aliasStart = nnValue;
|
||||
}
|
||||
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{ // integer parameters
|
||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
||||
aliasStart = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
aliasLen = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||
aliasChannel = nValue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user