1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-05 19:21:59 +01: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:
Paul Licameli
2016-08-17 17:27:48 -04:00
parent a1d930322c
commit 0c4c835b27
5 changed files with 43 additions and 16 deletions

View File

@@ -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;