diff --git a/src/export/ExportFFmpeg.cpp b/src/export/ExportFFmpeg.cpp index 0cd942cf0..b777577ec 100644 --- a/src/export/ExportFFmpeg.cpp +++ b/src/export/ExportFFmpeg.cpp @@ -98,7 +98,7 @@ public: ~ExportFFmpeg() override; /// Callback, called from GetFilename - bool CheckFileName(wxFileName &filename, int format = 0); + bool CheckFileName(wxFileName &filename, int format = 0) override; /// Format intialization bool Init(const char *shortname, AudacityProject *project, const Tags *metadata, int subformat); diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 509d19289..6226b2ba1 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -920,24 +920,28 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, } int ExportMultiple::DoExport(int channels, - wxFileName name, + const wxFileName &inName, bool selectedOnly, double t0, double t1, const Tags &tags) { - wxLogDebug(wxT("Doing multiple Export: File name \"%s\""), (name.GetFullName()).c_str()); + wxFileName name; + + wxLogDebug(wxT("Doing multiple Export: File name \"%s\""), (inName.GetFullName()).c_str()); wxLogDebug(wxT("Channels: %i, Start: %lf, End: %lf "), channels, t0, t1); if (selectedOnly) wxLogDebug(wxT("Selected Region Only")); else wxLogDebug(wxT("Whole Project")); if (mOverwrite->GetValue()) { // Make sure we don't overwrite (corrupt) alias files - if (!mProject->GetDirManager()->EnsureSafeFilename(name)) { + if (!mProject->GetDirManager()->EnsureSafeFilename(inName)) { return false; } + name = inName; } else { + name = inName; int i = 2; wxString base(name.GetName()); while (name.FileExists()) { @@ -946,9 +950,10 @@ int ExportMultiple::DoExport(int channels, } // Call the format export routine + const wxString fullPath{name.GetFullPath()}; int success = mPlugins[mPluginIndex]->Export(mProject, channels, - name.GetFullPath(), + fullPath, selectedOnly, t0, t1, @@ -957,7 +962,7 @@ int ExportMultiple::DoExport(int channels, mSubFormatIndex); if (success == eProgressSuccess || success == eProgressStopped) { - mExported.Add(name.GetFullPath()); + mExported.Add(fullPath); } Refresh(); diff --git a/src/export/ExportMultiple.h b/src/export/ExportMultiple.h index 1fa654501..6660b67b9 100644 --- a/src/export/ExportMultiple.h +++ b/src/export/ExportMultiple.h @@ -74,7 +74,7 @@ private: * @param tags Metadata to include in the file (if possible). */ int DoExport(int channels, - wxFileName name, + const wxFileName &name, bool selectedOnly, double t0, double t1, diff --git a/src/import/ImportLOF.cpp b/src/import/ImportLOF.cpp index 99a2652ad..54d4a63c5 100644 --- a/src/import/ImportLOF.cpp +++ b/src/import/ImportLOF.cpp @@ -145,7 +145,7 @@ private: void doScrollOffset(); wxTextFile *mTextFile; - wxFileName *mLOFFileName; /**< The name of the LOF file, which is used to + wxFileName mLOFFileName; /**< The name of the LOF file, which is used to interpret relative paths in it */ AudacityProject *mProject; @@ -164,9 +164,9 @@ private: LOFImportFileHandle::LOFImportFileHandle(const wxString & name, wxTextFile *file) : ImportFileHandle(name), mTextFile(file) + , mLOFFileName{name} { mProject = GetActiveProject(); - mLOFFileName = new wxFileName(name); windowCalledOnce = false; callDurationFactor = false; durationFactor = 1; @@ -374,7 +374,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln) // If path is relative, make absolute path from LOF path if(!wxIsAbsolutePath(targetfile)) { wxFileName fName(targetfile); - fName.Normalize(wxPATH_NORM_ALL, mLOFFileName->GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR)); + fName.Normalize(wxPATH_NORM_ALL, mLOFFileName.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR)); if(fName.FileExists()) { targetfile = fName.GetFullPath(); } @@ -507,7 +507,4 @@ LOFImportFileHandle::~LOFImportFileHandle() mTextFile->Close(); delete mTextFile; } - if(mLOFFileName) { - delete mLOFFileName; - } } diff --git a/src/import/ImportOGG.cpp b/src/import/ImportOGG.cpp index 406c535ac..7d3348a9a 100644 --- a/src/import/ImportOGG.cpp +++ b/src/import/ImportOGG.cpp @@ -326,9 +326,9 @@ int OggImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTra &bitstream); if (bytesRead == OV_HOLE) { - wxFileName f(mFilename); + wxFileName ff(mFilename); wxLogError(wxT("Ogg Vorbis importer: file %s is malformed, ov_read() reported a hole"), - f.GetFullName().c_str()); + ff.GetFullName().c_str()); /* http://lists.xiph.org/pipermail/vorbis-dev/2001-February/003223.html * is the justification for doing this - best effort for malformed file, * hence the message. diff --git a/src/import/ImportPlugin.h b/src/import/ImportPlugin.h index 818031418..c8baf758c 100644 --- a/src/import/ImportPlugin.h +++ b/src/import/ImportPlugin.h @@ -135,11 +135,11 @@ public: // identify the filename being imported. void CreateProgress() { - wxFileName f(mFilename); + wxFileName ff(mFilename); wxString title; title.Printf(_("Importing %s"), GetFileDescription().c_str()); - mProgress.create(title, f.GetFullName()); + mProgress.create(title, ff.GetFullName()); } // This is similar to GetImporterDescription, but if possible the