1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-19 01:08:02 +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

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