1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-06 03:32:09 +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

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