diff --git a/src/AutoRecovery.h b/src/AutoRecovery.h index 2fc31476b..3682de31f 100644 --- a/src/AutoRecovery.h +++ b/src/AutoRecovery.h @@ -72,6 +72,7 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL(short, NameMap, class AUDACITY_DLL_API); WX_DECLARE_HASH_MAP_WITH_DECL(short, wxString, wxIntegerHash, wxIntegerEqual, IdMap, class AUDACITY_DLL_API); WX_DECLARE_OBJARRAY_WITH_DECL(IdMap, IdMapArray, class AUDACITY_DLL_API); +// This class's overrides do NOT throw AudacityException. class AUDACITY_DLL_API AutoSaveFile final : public XMLWriter { public: diff --git a/src/Envelope.cpp b/src/Envelope.cpp index a78d4df0b..1fb1b7da2 100644 --- a/src/Envelope.cpp +++ b/src/Envelope.cpp @@ -352,6 +352,7 @@ XMLTagHandler *Envelope::HandleXMLChild(const wxChar *tag) } void Envelope::WriteXML(XMLWriter &xmlFile) const +// may throw { unsigned int ctrlPt; diff --git a/src/LabelTrack.cpp b/src/LabelTrack.cpp index 92280ed17..e3cfd720f 100644 --- a/src/LabelTrack.cpp +++ b/src/LabelTrack.cpp @@ -2266,6 +2266,7 @@ XMLTagHandler *LabelTrack::HandleXMLChild(const wxChar *tag) } void LabelTrack::WriteXML(XMLWriter &xmlFile) const +// may throw { int len = mLabels.size(); diff --git a/src/Legacy.cpp b/src/Legacy.cpp index 88abd17cb..8316afff5 100644 --- a/src/Legacy.cpp +++ b/src/Legacy.cpp @@ -83,6 +83,7 @@ public: }; static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile) +// may throw { wxString line; wxString kind; diff --git a/src/NoteTrack.cpp b/src/NoteTrack.cpp index 3bcf57e6b..27b770469 100644 --- a/src/NoteTrack.cpp +++ b/src/NoteTrack.cpp @@ -804,6 +804,7 @@ XMLTagHandler *NoteTrack::HandleXMLChild(const wxChar * WXUNUSED(tag)) } void NoteTrack::WriteXML(XMLWriter &xmlFile) const +// may throw { std::ostringstream data; // Normally, Duplicate is called in pairs -- once to put NoteTrack diff --git a/src/Project.cpp b/src/Project.cpp index 52b765742..cb9b51cb2 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -3541,6 +3541,7 @@ void AudacityProject::WriteXMLHeader(XMLWriter &xmlFile) const } void AudacityProject::WriteXML(XMLWriter &xmlFile) +// may throw { //TIMER_START( "AudacityProject::WriteXML", xml_writer_timer ); // Warning: This block of code is duplicated in Save, for now... diff --git a/src/SelectedRegion.cpp b/src/SelectedRegion.cpp index 640ee7388..bcab9a028 100644 --- a/src/SelectedRegion.cpp +++ b/src/SelectedRegion.cpp @@ -24,6 +24,7 @@ const wxChar *sDefaultF1Name = wxT("selHigh"); void SelectedRegion::WriteXMLAttributes (XMLWriter &xmlFile, const wxChar *legacyT0Name, const wxChar *legacyT1Name) const +// may throw { xmlFile.WriteAttr(legacyT0Name, t0(), 10); xmlFile.WriteAttr(legacyT1Name, t1(), 10); diff --git a/src/Sequence.cpp b/src/Sequence.cpp index 2a52bbc2f..b19601c45 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -1026,6 +1026,7 @@ XMLTagHandler *Sequence::HandleXMLChild(const wxChar *tag) // Throws exceptions rather than reporting errors. void Sequence::WriteXML(XMLWriter &xmlFile) const +// may throw { unsigned int b; @@ -1544,8 +1545,9 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format, blockFileLog != NULL), lastBlock.start ); - // FIXME: TRAP_ERR This could throw an exception that should(?) be converted to return false. + if (blockFileLog) + // shouldn't throw, because XMLWriter is not XMLFileWriter static_cast< SimpleBlockFile * >( &*newLastBlock.f ) ->SaveXML( *blockFileLog ); @@ -1570,8 +1572,8 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format, blockFileLog != NULL); } - // FIXME: TRAP_ERR This could throw an exception that should(?) be converted to return false. if (blockFileLog) + // shouldn't throw, because XMLWriter is not XMLFileWriter static_cast< SimpleBlockFile * >( &*pFile )->SaveXML( *blockFileLog ); mBlock.push_back(SeqBlock(pFile, mNumSamples)); diff --git a/src/Tags.cpp b/src/Tags.cpp index a9e09a2db..6b522bd98 100644 --- a/src/Tags.cpp +++ b/src/Tags.cpp @@ -551,6 +551,7 @@ XMLTagHandler *Tags::HandleXMLChild(const wxChar *tag) } void Tags::WriteXML(XMLWriter &xmlFile) const +// may throw { xmlFile.StartTag(wxT("tags")); diff --git a/src/TimeTrack.cpp b/src/TimeTrack.cpp index 4d6e87b72..6f47af6f3 100644 --- a/src/TimeTrack.cpp +++ b/src/TimeTrack.cpp @@ -205,6 +205,7 @@ XMLTagHandler *TimeTrack::HandleXMLChild(const wxChar *tag) } void TimeTrack::WriteXML(XMLWriter &xmlFile) const +// may throw { xmlFile.StartTag(wxT("timetrack")); diff --git a/src/ViewInfo.cpp b/src/ViewInfo.cpp index da81976ac..30107b4e5 100644 --- a/src/ViewInfo.cpp +++ b/src/ViewInfo.cpp @@ -162,6 +162,7 @@ void ViewInfo::SetBeforeScreenWidth(wxInt64 beforeWidth, wxInt64 screenWidth, do } void ViewInfo::WriteXMLAttributes(XMLWriter &xmlFile) const +// may throw { selectedRegion.WriteXMLAttributes(xmlFile, wxT("sel0"), wxT("sel1")); xmlFile.WriteAttr(wxT("vpos"), vpos); diff --git a/src/WaveClip.cpp b/src/WaveClip.cpp index ffa838881..ecad3e6d7 100644 --- a/src/WaveClip.cpp +++ b/src/WaveClip.cpp @@ -1515,6 +1515,7 @@ XMLTagHandler *WaveClip::HandleXMLChild(const wxChar *tag) } void WaveClip::WriteXML(XMLWriter &xmlFile) const +// may throw { xmlFile.StartTag(wxT("waveclip")); xmlFile.WriteAttr(wxT("offset"), mOffset, 8); diff --git a/src/WaveTrack.cpp b/src/WaveTrack.cpp index b03781900..01ae05eab 100644 --- a/src/WaveTrack.cpp +++ b/src/WaveTrack.cpp @@ -1777,6 +1777,7 @@ XMLTagHandler *WaveTrack::HandleXMLChild(const wxChar *tag) } void WaveTrack::WriteXML(XMLWriter &xmlFile) const +// may throw { xmlFile.StartTag(wxT("wavetrack")); if (mAutoSaveIdent) diff --git a/src/blockfile/LegacyAliasBlockFile.cpp b/src/blockfile/LegacyAliasBlockFile.cpp index 8c20bc06c..0739cedcd 100644 --- a/src/blockfile/LegacyAliasBlockFile.cpp +++ b/src/blockfile/LegacyAliasBlockFile.cpp @@ -62,6 +62,7 @@ BlockFilePtr LegacyAliasBlockFile::Copy(wxFileNameWrapper &&newFileName) } void LegacyAliasBlockFile::SaveXML(XMLWriter &xmlFile) +// may throw { xmlFile.StartTag(wxT("legacyblockfile")); diff --git a/src/blockfile/LegacyBlockFile.cpp b/src/blockfile/LegacyBlockFile.cpp index 7df7422e0..7e90a7ae2 100644 --- a/src/blockfile/LegacyBlockFile.cpp +++ b/src/blockfile/LegacyBlockFile.cpp @@ -197,6 +197,7 @@ size_t LegacyBlockFile::ReadData(samplePtr data, sampleFormat format, } void LegacyBlockFile::SaveXML(XMLWriter &xmlFile) +// may throw { xmlFile.StartTag(wxT("legacyblockfile")); diff --git a/src/blockfile/ODDecodeBlockFile.cpp b/src/blockfile/ODDecodeBlockFile.cpp index eb04c676b..6788c6cef 100644 --- a/src/blockfile/ODDecodeBlockFile.cpp +++ b/src/blockfile/ODDecodeBlockFile.cpp @@ -191,6 +191,7 @@ BlockFilePtr ODDecodeBlockFile::Copy(wxFileNameWrapper &&newFileName) /// Most notably, the summaryfile attribute refers to a file that does not yet, so when the project file is read back in /// and this object reconstructed, it needs to avoid trying to open it as well as schedule itself for OD loading void ODDecodeBlockFile::SaveXML(XMLWriter &xmlFile) +// may throw { LockRead(); if(IsSummaryAvailable()) diff --git a/src/blockfile/ODPCMAliasBlockFile.cpp b/src/blockfile/ODPCMAliasBlockFile.cpp index 7db3039a8..01d93fa78 100644 --- a/src/blockfile/ODPCMAliasBlockFile.cpp +++ b/src/blockfile/ODPCMAliasBlockFile.cpp @@ -227,6 +227,7 @@ BlockFilePtr ODPCMAliasBlockFile::Copy(wxFileNameWrapper &&newFileName) /// Most notably, the summaryfile attribute refers to a file that does not yet exist, so when the project file is read back in /// and this object reconstructed, it needs to avoid trying to open it as well as schedule itself for OD loading void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile) +// may throw { //we lock this so that mAliasedFileName doesn't change. LockRead(); diff --git a/src/blockfile/PCMAliasBlockFile.cpp b/src/blockfile/PCMAliasBlockFile.cpp index da95aa8f1..8ce192ee5 100644 --- a/src/blockfile/PCMAliasBlockFile.cpp +++ b/src/blockfile/PCMAliasBlockFile.cpp @@ -101,6 +101,7 @@ BlockFilePtr PCMAliasBlockFile::Copy(wxFileNameWrapper &&newFileName) } void PCMAliasBlockFile::SaveXML(XMLWriter &xmlFile) +// may throw { xmlFile.StartTag(wxT("pcmaliasblockfile")); diff --git a/src/blockfile/SilentBlockFile.cpp b/src/blockfile/SilentBlockFile.cpp index fb7a61811..89cbc5b03 100644 --- a/src/blockfile/SilentBlockFile.cpp +++ b/src/blockfile/SilentBlockFile.cpp @@ -39,6 +39,7 @@ size_t SilentBlockFile::ReadData(samplePtr data, sampleFormat format, } void SilentBlockFile::SaveXML(XMLWriter &xmlFile) +// may throw { xmlFile.StartTag(wxT("silentblockfile")); diff --git a/src/blockfile/SimpleBlockFile.cpp b/src/blockfile/SimpleBlockFile.cpp index 8dbca4b69..14bad5ad4 100644 --- a/src/blockfile/SimpleBlockFile.cpp +++ b/src/blockfile/SimpleBlockFile.cpp @@ -404,6 +404,7 @@ size_t SimpleBlockFile::ReadData(samplePtr data, sampleFormat format, } void SimpleBlockFile::SaveXML(XMLWriter &xmlFile) +// may throw { xmlFile.StartTag(wxT("simpleblockfile")); diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 198f2091c..902cc7fb3 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -1434,6 +1434,7 @@ XMLTagHandler *CommandManager::HandleXMLChild(const wxChar * WXUNUSED(tag)) } void CommandManager::WriteXML(XMLWriter &xmlFile) const +// may throw { xmlFile.StartTag(wxT("audacitykeyboard")); xmlFile.WriteAttr(wxT("audacityversion"), AUDACITY_VERSION_STRING); diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 1685f6de6..0ec61d2e8 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -3579,6 +3579,7 @@ void EffectUIHost::OnImport(wxCommandEvent & WXUNUSED(evt)) void EffectUIHost::OnExport(wxCommandEvent & WXUNUSED(evt)) { + // may throw mClient->ExportPresets(); return; diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 7073a1af2..a62652957 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -2044,6 +2044,7 @@ XMLTagHandler *EffectEqualization::HandleXMLChild(const wxChar *tag) // Write all of the curves to the XML file // void EffectEqualization::WriteXML(XMLWriter &xmlFile) const +// may throw { // Start our heirarchy xmlFile.StartTag( wxT( "equalizationeffect" ) ); diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index 3c871c643..ad4a3ae27 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -1820,6 +1820,7 @@ void VSTEffect::ExportPresets() } else if (ext.CmpNoCase(wxT("xml")) == 0) { + // may throw SaveXML(fn); } else @@ -3559,6 +3560,7 @@ void VSTEffect::SaveFXProgram(wxMemoryBuffer & buf, int index) // Throws exceptions rather than giving error return. void VSTEffect::SaveXML(const wxFileName & fn) +// may throw { XMLFileWriter xmlFile; diff --git a/src/export/ExportFFmpegDialogs.cpp b/src/export/ExportFFmpegDialogs.cpp index 55a63414e..ae68df708 100644 --- a/src/export/ExportFFmpegDialogs.cpp +++ b/src/export/ExportFFmpegDialogs.cpp @@ -828,6 +828,7 @@ XMLTagHandler *FFmpegPresets::HandleXMLChild(const wxChar *tag) } void FFmpegPresets::WriteXMLHeader(XMLWriter &xmlFile) const +// may throw { xmlFile.Write(wxT("\n")); @@ -270,6 +283,7 @@ void XMLFileWriter::Open(const wxString &name, const wxString &mode) } void XMLFileWriter::Close() +// may throw { while (mTagstack.GetCount()) { EndTag(mTagstack[0]);