mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-19 14:17:41 +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("name"), localName);
|
||||||
xmlFile.WriteAttr(wxT("alias"), 1);
|
xmlFile.WriteAttr(wxT("alias"), 1);
|
||||||
xmlFile.WriteAttr(wxT("aliaspath"), aliasPath);
|
xmlFile.WriteAttr(wxT("aliaspath"), aliasPath);
|
||||||
|
|
||||||
|
// This was written but not read again?
|
||||||
xmlFile.WriteAttr(wxT("aliasstart"), aliasStart);
|
xmlFile.WriteAttr(wxT("aliasstart"), aliasStart);
|
||||||
|
|
||||||
xmlFile.WriteAttr(wxT("aliaslen"), aliasLen);
|
xmlFile.WriteAttr(wxT("aliaslen"), aliasLen);
|
||||||
xmlFile.WriteAttr(wxT("aliaschannel"), aliasChannel);
|
xmlFile.WriteAttr(wxT("aliaschannel"), aliasChannel);
|
||||||
xmlFile.WriteAttr(wxT("summarylen"), localLen);
|
xmlFile.WriteAttr(wxT("summarylen"), localLen);
|
||||||
|
@ -68,7 +68,8 @@ void LegacyAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
|||||||
xmlFile.WriteAttr(wxT("alias"), 1);
|
xmlFile.WriteAttr(wxT("alias"), 1);
|
||||||
xmlFile.WriteAttr(wxT("name"), mFileName.GetFullName());
|
xmlFile.WriteAttr(wxT("name"), mFileName.GetFullName());
|
||||||
xmlFile.WriteAttr(wxT("aliaspath"), mAliasedFileName.GetFullPath());
|
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("aliaslen"), mLen);
|
||||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||||
xmlFile.WriteAttr(wxT("summarylen"), mSummaryInfo.totalSummaryBytes);
|
xmlFile.WriteAttr(wxT("summarylen"), mSummaryInfo.totalSummaryBytes);
|
||||||
@ -89,6 +90,7 @@ BlockFilePtr LegacyAliasBlockFile::BuildFromXML(const wxString &projDir, const w
|
|||||||
int summaryLen=0;
|
int summaryLen=0;
|
||||||
bool noRMS = false;
|
bool noRMS = false;
|
||||||
long nValue;
|
long nValue;
|
||||||
|
long long nnValue;
|
||||||
|
|
||||||
while(*attrs)
|
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.
|
// but we want to keep the reference to the missing file because it's a good path string.
|
||||||
aliasFileName.Assign(strValue);
|
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))
|
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||||
{ // integer parameters
|
{ // integer parameters
|
||||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||||
aliasStart = nValue;
|
|
||||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
|
||||||
aliasLen = nValue;
|
aliasLen = nValue;
|
||||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||||
aliasChannel = nValue;
|
aliasChannel = nValue;
|
||||||
|
@ -207,7 +207,8 @@ void ODDecodeBlockFile::SaveXML(XMLWriter &xmlFile)
|
|||||||
mFileNameMutex.Unlock();
|
mFileNameMutex.Unlock();
|
||||||
LockRead();
|
LockRead();
|
||||||
xmlFile.WriteAttr(wxT("audiofile"), mAudioFileName.GetFullPath());
|
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("aliaslen"), mLen);
|
||||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||||
xmlFile.WriteAttr(wxT("decodetype"), (size_t)mType);
|
xmlFile.WriteAttr(wxT("decodetype"), (size_t)mType);
|
||||||
@ -229,6 +230,7 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
|||||||
sampleCount aliasStart=0, aliasLen=0;
|
sampleCount aliasStart=0, aliasLen=0;
|
||||||
int aliasChannel=0;
|
int aliasChannel=0;
|
||||||
long nValue;
|
long nValue;
|
||||||
|
long long nnValue;
|
||||||
unsigned int decodeType=0;
|
unsigned int decodeType=0;
|
||||||
|
|
||||||
while(*attrs)
|
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.
|
// but we want to keep the reference to the file because it's a good path string.
|
||||||
audioFileName.Assign(strValue);
|
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))
|
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||||
{ // integer parameters
|
{ // integer parameters
|
||||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||||
aliasStart = nValue;
|
|
||||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
|
||||||
aliasLen = nValue;
|
aliasLen = nValue;
|
||||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||||
aliasChannel = nValue;
|
aliasChannel = nValue;
|
||||||
|
@ -247,7 +247,8 @@ void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
|||||||
LockRead();
|
LockRead();
|
||||||
|
|
||||||
xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
|
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("aliaslen"), mLen);
|
||||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||||
|
|
||||||
@ -269,6 +270,7 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at
|
|||||||
sampleCount aliasStart=0, aliasLen=0;
|
sampleCount aliasStart=0, aliasLen=0;
|
||||||
int aliasChannel=0;
|
int aliasChannel=0;
|
||||||
long nValue;
|
long nValue;
|
||||||
|
long long nnValue;
|
||||||
|
|
||||||
while(*attrs)
|
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.
|
// but we want to keep the reference to the missing file because it's a good path string.
|
||||||
aliasFileName.Assign(strValue);
|
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))
|
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||||
{ // integer parameters
|
{ // integer parameters
|
||||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||||
aliasStart = nValue;
|
|
||||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
|
||||||
aliasLen = nValue;
|
aliasLen = nValue;
|
||||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||||
aliasChannel = nValue;
|
aliasChannel = nValue;
|
||||||
|
@ -165,7 +165,8 @@ void PCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
|||||||
|
|
||||||
xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
|
xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
|
||||||
xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
|
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("aliaslen"), mLen);
|
||||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||||
xmlFile.WriteAttr(wxT("min"), mMin);
|
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;
|
float min = 0.0f, max = 0.0f, rms = 0.0f;
|
||||||
double dblValue;
|
double dblValue;
|
||||||
long nValue;
|
long nValue;
|
||||||
|
long long nnValue;
|
||||||
|
|
||||||
while(*attrs)
|
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.
|
// but we want to keep the reference to the missing file because it's a good path string.
|
||||||
aliasFileName.Assign(strValue);
|
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))
|
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||||
{ // integer parameters
|
{ // integer parameters
|
||||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||||
aliasStart = nValue;
|
|
||||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
|
||||||
aliasLen = nValue;
|
aliasLen = nValue;
|
||||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||||
aliasChannel = nValue;
|
aliasChannel = nValue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user