From 9bf098c7d94cf9fa4b1c49da4132cc18f6b96f74 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 22 Feb 2016 21:18:11 -0500 Subject: [PATCH] Sweep unnecessary wxString copies: rest --- src/AboutDialog.cpp | 2 +- src/AboutDialog.h | 2 +- src/AudacityApp.cpp | 13 +++++++------ src/AudacityApp.h | 8 ++++---- src/AudioIO.cpp | 8 +++++--- src/AudioIO.h | 6 +++--- src/BatchCommands.cpp | 2 +- src/BatchCommands.h | 2 +- src/DirManager.cpp | 18 +++++++++--------- src/DirManager.h | 20 ++++++++++---------- src/FFmpeg.cpp | 2 +- src/FFmpeg.h | 2 +- src/LabelDialog.cpp | 2 +- src/LabelDialog.h | 2 +- src/Lyrics.cpp | 2 +- src/Lyrics.h | 2 +- src/MixerBoard.cpp | 2 +- src/MixerBoard.h | 2 +- src/ModuleManager.cpp | 2 +- src/ModuleManager.h | 2 +- src/NoteTrack.cpp | 4 ++-- src/NoteTrack.h | 4 ++-- src/PluginManager.cpp | 2 +- src/PluginManager.h | 2 +- src/Printing.cpp | 2 +- src/Printing.h | 2 +- src/Project.cpp | 18 ++++++++++-------- src/Project.h | 18 +++++++++--------- src/Sequence.cpp | 4 ++-- src/Sequence.h | 4 ++-- src/Tags.cpp | 4 ++-- src/Tags.h | 4 ++-- src/TimeDialog.cpp | 2 +- src/TimeDialog.h | 2 +- src/Track.h | 4 ++-- src/TrackPanel.cpp | 2 +- src/TrackPanel.h | 2 +- src/TrackPanelListener.h | 4 ++-- src/UndoManager.cpp | 6 +++--- src/UndoManager.h | 4 ++-- src/WaveClip.cpp | 4 ++-- src/WaveClip.h | 4 ++-- src/WaveTrack.cpp | 4 ++-- src/WaveTrack.h | 4 ++-- 44 files changed, 108 insertions(+), 103 deletions(-) diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 9a52c40d9..7031d728e 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -892,7 +892,7 @@ wxString AboutDialog::GetCreditsByRole(AboutDialog::Role role) * * Used when creating the build information tab to show if each optional * library is enabled or not, and what it does */ -void AboutDialog::AddBuildinfoRow( wxString* htmlstring, const wxChar * libname, const wxChar * libdesc, wxString status) +void AboutDialog::AddBuildinfoRow( wxString* htmlstring, const wxChar * libname, const wxChar * libdesc, const wxString &status) { *htmlstring += wxT(""); *htmlstring += libname; diff --git a/src/AboutDialog.h b/src/AboutDialog.h index 06aeb30a3..20b2cb464 100644 --- a/src/AboutDialog.h +++ b/src/AboutDialog.h @@ -76,7 +76,7 @@ class AboutDialog:public wxDialog { void AddCredit(wxString &&description, Role role); wxString GetCreditsByRole(AboutDialog::Role role); - void AddBuildinfoRow( wxString* htmlstring, const wxChar * libname, const wxChar * libdesc, wxString status); + void AddBuildinfoRow( wxString* htmlstring, const wxChar * libname, const wxChar * libdesc, const wxString &status); void AddBuildinfoRow( wxString* htmlstring, const wxChar * libname, const wxChar * libdesc); }; diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 337fd79ae..e960e27c5 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -769,7 +769,7 @@ END_EVENT_TABLE() // TODO: Would be nice to make this handle not opening a file with more panache. // - Inform the user if DefaultOpenPath not set. // - Switch focus to correct instance of project window, if already open. -bool AudacityApp::MRUOpen(wxString fullPathStr) { +bool AudacityApp::MRUOpen(const wxString &fullPathStr) { // Most of the checks below are copied from AudacityProject::OpenFiles. // - some rationalisation might be possible. @@ -1630,7 +1630,7 @@ bool AudacityApp::InitTempDir() // // Use "dir" for creating lockfiles (on OS X and Unix). -bool AudacityApp::CreateSingleInstanceChecker(wxString dir) +bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir) { wxString name = wxString::Format(wxT("audacity-lock-%s"), wxGetUserId().c_str()); mChecker = new wxSingleInstanceChecker(); @@ -1868,12 +1868,12 @@ wxCmdLineParser *AudacityApp::ParseCommandLine() } // static -void AudacityApp::AddUniquePathToPathList(wxString path, +void AudacityApp::AddUniquePathToPathList(const wxString &pathArg, wxArrayString &pathList) { - wxFileName pathNorm = path; + wxFileName pathNorm = pathArg; pathNorm.Normalize(); - path = pathNorm.GetFullPath(); + wxString path = pathNorm.GetFullPath(); for(unsigned int i=0; isecond == b; } -bool DirManager::ContainsBlockFile(wxString filepath) const +bool DirManager::ContainsBlockFile(const wxString &filepath) const { // check what the hash returns in case the blockfile is from a different project BlockHash::const_iterator it = mBlockFileHash.find(filepath); diff --git a/src/DirManager.h b/src/DirManager.h index 9ba6fbf8a..986322590 100644 --- a/src/DirManager.h +++ b/src/DirManager.h @@ -43,7 +43,7 @@ class DirManager: public XMLTagHandler { // MM: Only called by Deref() when refcount reaches zero. virtual ~DirManager(); - static void SetTempDir(wxString _temp) { globaltemp = _temp; } + static void SetTempDir(const wxString &_temp) { globaltemp = _temp; } // MM: Ref count mechanism for the DirManager itself void Ref(); @@ -64,19 +64,19 @@ class DirManager: public XMLTagHandler { sampleFormat format, bool allowDeferredWrite = false); - BlockFile *NewAliasBlockFile( wxString aliasedFile, sampleCount aliasStart, + BlockFile *NewAliasBlockFile( const wxString &aliasedFile, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel); - BlockFile *NewODAliasBlockFile( wxString aliasedFile, sampleCount aliasStart, + BlockFile *NewODAliasBlockFile( const wxString &aliasedFile, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel); - BlockFile *NewODDecodeBlockFile( wxString aliasedFile, sampleCount aliasStart, + BlockFile *NewODDecodeBlockFile( const wxString &aliasedFile, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel, int decodeType); /// Returns true if the blockfile pointed to by b is contained by the DirManager bool ContainsBlockFile(BlockFile *b) const; /// Check for existing using filename using complete filename - bool ContainsBlockFile(wxString filepath) const; + bool ContainsBlockFile(const wxString &filepath) const; // Adds one to the reference count of the block file, // UNLESS it is "locked", then it makes a NEW copy of @@ -116,7 +116,7 @@ class DirManager: public XMLTagHandler { bool HandleXMLTag(const wxChar *tag, const wxChar **attrs); XMLTagHandler *HandleXMLChild(const wxChar * WXUNUSED(tag)) { return NULL; } void WriteXML(XMLWriter & WXUNUSED(xmlFile)) { wxASSERT(false); } // This class only reads tags. - bool AssignFile(wxFileName &filename,wxString value,bool check); + bool AssignFile(wxFileName &filename, const wxString &value, bool check); // Clean the temp dir. Note that now where we have auto recovery the temp // dir is not cleaned at start up anymore. But it is cleaned when the @@ -154,7 +154,7 @@ class DirManager: public XMLTagHandler { wxString GetDataFilesDir() const; // This should only be used by the auto save functionality - void SetLocalTempDir(wxString path); + void SetLocalTempDir(const wxString &path); // Do not DELETE any temporary files on exit. This is only called if // auto recovery is cancelled and should be retried later @@ -169,7 +169,7 @@ class DirManager: public XMLTagHandler { private: wxFileName MakeBlockFileName(); - wxFileName MakeBlockFilePath(wxString value); + wxFileName MakeBlockFilePath(const wxString &value); bool MoveOrCopyToNewProjectDirectory(BlockFile *f, bool copy); @@ -181,8 +181,8 @@ class DirManager: public XMLTagHandler { DirHash dirMidPool; // available two-level dirs DirHash dirMidFull; // full two-level dirs - void BalanceInfoDel(wxString); - void BalanceInfoAdd(wxString); + void BalanceInfoDel(const wxString&); + void BalanceInfoAdd(const wxString&); void BalanceFileAdd(int); int BalanceMidAdd(int, int); diff --git a/src/FFmpeg.cpp b/src/FFmpeg.cpp index 741dd53e2..21ca9e5fe 100644 --- a/src/FFmpeg.cpp +++ b/src/FFmpeg.cpp @@ -715,7 +715,7 @@ bool FFmpegLibs::ValidLibsLoaded() return mLibsLoaded; } -bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr)) +bool FFmpegLibs::InitLibs(const wxString &libpath_format, bool WXUNUSED(showerr)) { #if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) FreeLibs(); diff --git a/src/FFmpeg.h b/src/FFmpeg.h index aef40ae8b..92c690bc4 100644 --- a/src/FFmpeg.h +++ b/src/FFmpeg.h @@ -256,7 +256,7 @@ public: ///\param showerr - controls whether or not to show an error dialog if libraries cannot be loaded ///\return true if initialization completed without errors, false otherwise /// do not call (it is called by FindLibs automatically) - bool InitLibs(wxString libpath_codec, bool showerr); + bool InitLibs(const wxString &libpath_codec, bool showerr); ///! Frees (unloads) loaded libraries void FreeLibs(); diff --git a/src/LabelDialog.cpp b/src/LabelDialog.cpp index 8689ae7a8..5463a0e19 100644 --- a/src/LabelDialog.cpp +++ b/src/LabelDialog.cpp @@ -358,7 +358,7 @@ bool LabelDialog::Validate() return true; } -wxString LabelDialog::TrackName(int & index, wxString dflt) +wxString LabelDialog::TrackName(int & index, const wxString &dflt) { // Generate a NEW track name if the passed index is out of range if (index < 1 || index >= (int)mTrackNames.GetCount()) { diff --git a/src/LabelDialog.h b/src/LabelDialog.h index 46cdb13f6..05010e4e5 100644 --- a/src/LabelDialog.h +++ b/src/LabelDialog.h @@ -52,7 +52,7 @@ class LabelDialog:public wxDialog void FindAllLabels(); void AddLabels(LabelTrack *t); void FindInitialRow(); - wxString TrackName(int & index, wxString dflt = _("Label Track")); + wxString TrackName(int & index, const wxString &dflt = _("Label Track")); void OnUpdate(wxCommandEvent &event); void OnInsert(wxCommandEvent &event); diff --git a/src/Lyrics.cpp b/src/Lyrics.cpp index 90ae34887..3c465e96b 100644 --- a/src/Lyrics.cpp +++ b/src/Lyrics.cpp @@ -143,7 +143,7 @@ void Lyrics::AddLabels(const LabelTrack *pLT) mHighlightTextCtrl->AppendText(highlightText); } -void Lyrics::Add(double t, wxString syllable, wxString &highlightText) +void Lyrics::Add(double t, const wxString &syllable, wxString &highlightText) { int i = mSyllables.GetCount(); diff --git a/src/Lyrics.h b/src/Lyrics.h index 4ca9bd7f8..26c09503d 100644 --- a/src/Lyrics.h +++ b/src/Lyrics.h @@ -105,7 +105,7 @@ class Lyrics : public wxPanel void HandleLayout(); private: - void Add(double t, wxString syllable, wxString &highlightText); + void Add(double t, const wxString &syllable, wxString &highlightText); unsigned int GetDefaultFontSize() const; // Depends on mLyricsStyle. Call only after mLyricsStyle is set. diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index a4eaf1f19..22c1eff28 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -53,7 +53,7 @@ END_EVENT_TABLE() MixerTrackSlider::MixerTrackSlider(wxWindow * parent, wxWindowID id, - wxString name, + const wxString &name, const wxPoint & pos, const wxSize & size, int style /*= FRAC_SLIDER*/, diff --git a/src/MixerBoard.h b/src/MixerBoard.h index d87d23a6a..4ff923cba 100644 --- a/src/MixerBoard.h +++ b/src/MixerBoard.h @@ -36,7 +36,7 @@ class MixerTrackSlider : public ASlider public: MixerTrackSlider(wxWindow * parent, wxWindowID id, - wxString name, + const wxString &name, const wxPoint & pos, const wxSize & size, int style = FRAC_SLIDER, diff --git a/src/ModuleManager.cpp b/src/ModuleManager.cpp index 477bc8e07..7e66d21a5 100755 --- a/src/ModuleManager.cpp +++ b/src/ModuleManager.cpp @@ -168,7 +168,7 @@ int Module::Dispatch(ModuleDispatchTypes type) return 0; } -void * Module::GetSymbol(wxString name) +void * Module::GetSymbol(const wxString &name) { return mLib->GetSymbol(name); } diff --git a/src/ModuleManager.h b/src/ModuleManager.h index 18dab66c1..d26499381 100644 --- a/src/ModuleManager.h +++ b/src/ModuleManager.h @@ -53,7 +53,7 @@ public: bool Load(); void Unload(); int Dispatch(ModuleDispatchTypes type); - void * GetSymbol(wxString name); + void * GetSymbol(const wxString &name); private: wxString mName; diff --git a/src/NoteTrack.cpp b/src/NoteTrack.cpp index 795126871..44fcaec8f 100644 --- a/src/NoteTrack.cpp +++ b/src/NoteTrack.cpp @@ -724,7 +724,7 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq() } -bool NoteTrack::ExportMIDI(wxString f) +bool NoteTrack::ExportMIDI(const wxString &f) { Alg_seq_ptr seq = MakeExportableSeq(); bool rslt = seq->smf_write(f.mb_str()); @@ -732,7 +732,7 @@ bool NoteTrack::ExportMIDI(wxString f) return rslt; } -bool NoteTrack::ExportAllegro(wxString f) +bool NoteTrack::ExportAllegro(const wxString &f) { double offset = GetOffset(); bool in_seconds; diff --git a/src/NoteTrack.h b/src/NoteTrack.h index 90f9b7e77..d77c74d08 100644 --- a/src/NoteTrack.h +++ b/src/NoteTrack.h @@ -78,8 +78,8 @@ class AUDACITY_DLL_API NoteTrack:public Track { int GetVisibleChannels(); Alg_seq_ptr MakeExportableSeq(); - bool ExportMIDI(wxString f); - bool ExportAllegro(wxString f); + bool ExportMIDI(const wxString &f); + bool ExportAllegro(const wxString &f); /* REQUIRES PORTMIDI */ // int GetLastMidiPosition() const { return mLastMidiPosition; } diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index 1c4b38cd2..ceb85ee8a 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -2896,7 +2896,7 @@ wxString PluginManager::b64encode(const void *in, int len) return out; } -int PluginManager::b64decode(wxString in, void *out) +int PluginManager::b64decode(const wxString &in, void *out) { int len = in.length(); unsigned char *p = (unsigned char *) out; diff --git a/src/PluginManager.h b/src/PluginManager.h index 5b7b61f83..a79b3d85c 100644 --- a/src/PluginManager.h +++ b/src/PluginManager.h @@ -301,7 +301,7 @@ private: // case, we use base64 encoding. wxString ConvertID(const PluginID & ID); wxString b64encode(const void *in, int len); - int b64decode(wxString in, void *out); + int b64decode(const wxString &in, void *out); private: static PluginManager *mInstance; diff --git a/src/Printing.cpp b/src/Printing.cpp index 5f382828d..2b4155d5a 100644 --- a/src/Printing.cpp +++ b/src/Printing.cpp @@ -153,7 +153,7 @@ void HandlePageSetup(wxWindow *parent) (*gPageSetupData) = pageSetupDialog.GetPageSetupData(); } -void HandlePrint(wxWindow *parent, wxString name, TrackList *tracks) +void HandlePrint(wxWindow *parent, const wxString &name, TrackList *tracks) { if (gPageSetupData == NULL) gPageSetupData = new wxPageSetupDialogData(); diff --git a/src/Printing.h b/src/Printing.h index ddc1805fe..e481ca67c 100644 --- a/src/Printing.h +++ b/src/Printing.h @@ -18,7 +18,7 @@ class wxWindow; class TrackList; void HandlePageSetup(wxWindow *parent); -void HandlePrint(wxWindow *parent, wxString name, TrackList *tracks); +void HandlePrint(wxWindow *parent, const wxString &name, TrackList *tracks); #endif // __AUDACITY_PRINTING__ diff --git a/src/Project.cpp b/src/Project.cpp index 8fb76ad31..211b1afdd 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -2397,7 +2397,7 @@ void AudacityProject::OnOpenAudioFile(wxCommandEvent & event) } // static method, can be called outside of a project -wxArrayString AudacityProject::ShowOpenDialog(wxString extraformat, wxString extrafilter) +wxArrayString AudacityProject::ShowOpenDialog(const wxString &extraformat, const wxString &extrafilter) { FormatList l; wxString filter; ///< List of file format names and extensions, separated @@ -2605,8 +2605,10 @@ bool AudacityProject::WarnOfLegacyFile( ) // FIXME? This should return a result that is checked. // See comment in AudacityApp::MRUOpen(). -void AudacityProject::OpenFile(wxString fileName, bool addtohistory) +void AudacityProject::OpenFile(const wxString &fileNameArg, bool addtohistory) { + wxString fileName(fileNameArg); + // On Win32, we may be given a short (DOS-compatible) file name on rare // occassions (e.g. stuff like "C:\PROGRA~1\AUDACI~1\PROJEC~1.AUP"). We // convert these to long file name first. @@ -3704,7 +3706,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ , #endif -void AudacityProject::AddImportedTracks(wxString fileName, +void AudacityProject::AddImportedTracks(const wxString &fileName, Track **newTracks, int numTracks) { SelectNone(); @@ -3784,7 +3786,7 @@ void AudacityProject::AddImportedTracks(wxString fileName, } // If pNewTrackList is passed in non-NULL, it gets filled with the pointers to NEW tracks. -bool AudacityProject::Import(wxString fileName, WaveTrackArray* pTrackArray /*= NULL*/) +bool AudacityProject::Import(const wxString &fileName, WaveTrackArray* pTrackArray /*= NULL*/) { Track **newTracks; int numTracks; @@ -3994,8 +3996,8 @@ void AudacityProject::InitialState() this->UpdateMixerBoard(); } -void AudacityProject::PushState(wxString desc, - wxString shortDesc, +void AudacityProject::PushState(const wxString &desc, + const wxString &shortDesc, int flags ) { mUndoManager.PushState(mTracks, mViewInfo.selectedRegion, @@ -4627,7 +4629,7 @@ void AudacityProject::EditClipboardByLabel( EditDestFunction action ) // TrackPanel callback method -void AudacityProject::TP_DisplayStatusMessage(wxString msg) +void AudacityProject::TP_DisplayStatusMessage(const wxString &msg) { mStatusBar->SetStatusText(msg, mainStatusBarField); mLastStatusUpdateTime = ::wxGetUTCTime(); @@ -4696,7 +4698,7 @@ void AudacityProject::RefreshTPTrack(Track* pTrk, bool refreshbacking /*= true*/ // TrackPanel callback method -void AudacityProject::TP_PushState(wxString desc, wxString shortDesc, +void AudacityProject::TP_PushState(const wxString &desc, const wxString &shortDesc, int flags) { PushState(desc, shortDesc, flags); diff --git a/src/Project.h b/src/Project.h index e5dc7b830..81397fad4 100644 --- a/src/Project.h +++ b/src/Project.h @@ -219,17 +219,17 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, * @return Array of file paths which the user selected to open (multiple * selections allowed). */ - static wxArrayString ShowOpenDialog(wxString extraformat = wxEmptyString, - wxString extrafilter = wxEmptyString); + static wxArrayString ShowOpenDialog(const wxString &extraformat = wxEmptyString, + const wxString &extrafilter = wxEmptyString); static bool IsAlreadyOpen(const wxString & projPathName); static void OpenFiles(AudacityProject *proj); - void OpenFile(wxString fileName, bool addtohistory = true); + void OpenFile(const wxString &fileName, bool addtohistory = true); bool WarnOfLegacyFile( ); // If pNewTrackList is passed in non-NULL, it gets filled with the pointers to NEW tracks. - bool Import(wxString fileName, WaveTrackArray *pTrackArray = NULL); + bool Import(const wxString &fileName, WaveTrackArray *pTrackArray = NULL); - void AddImportedTracks(wxString fileName, + void AddImportedTracks(const wxString &fileName, Track **newTracks, int numTracks); void LockAllBlocks(); void UnlockAllBlocks(); @@ -394,12 +394,12 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, // TrackPanel callback methods, overrides of TrackPanelListener virtual void TP_DisplaySelection(); - virtual void TP_DisplayStatusMessage(wxString msg); + virtual void TP_DisplayStatusMessage(const wxString &msg) override; virtual ToolsToolBar * TP_GetToolsToolBar(); - virtual void TP_PushState(wxString longDesc, wxString shortDesc, - int flags); + virtual void TP_PushState(const wxString &longDesc, const wxString &shortDesc, + int flags) override; virtual void TP_ModifyState(bool bWantsAutoSave); // if true, writes auto-save file. Should set only if you really want the state change restored after // a crash, as it can take many seconds for large (eg. 10 track-hours) projects virtual void TP_RedrawScrollbars(); @@ -486,7 +486,7 @@ public: static void AllProjectsDeleteLock(); static void AllProjectsDeleteUnlock(); - void PushState(wxString desc, wxString shortDesc, + void PushState(const wxString &desc, const wxString &shortDesc, int flags = PUSH_AUTOSAVE); void RollbackState(); diff --git a/src/Sequence.cpp b/src/Sequence.cpp index 6765a66b5..3a8ba1afd 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -708,7 +708,7 @@ bool Sequence::InsertSilence(sampleCount s0, sampleCount len) return bResult && ConsistencyCheck(wxT("InsertSilence")); } -bool Sequence::AppendAlias(wxString fullPath, +bool Sequence::AppendAlias(const wxString &fullPath, sampleCount start, sampleCount len, int channel, bool useOD) { @@ -728,7 +728,7 @@ bool Sequence::AppendAlias(wxString fullPath, return true; } -bool Sequence::AppendCoded(wxString fName, sampleCount start, +bool Sequence::AppendCoded(const wxString &fName, sampleCount start, sampleCount len, int channel, int decodeType) { // Quick check to make sure that it doesn't overflow diff --git a/src/Sequence.h b/src/Sequence.h index 26238e12d..f18ff857e 100644 --- a/src/Sequence.h +++ b/src/Sequence.h @@ -109,11 +109,11 @@ class Sequence: public XMLTagHandler { bool Append(samplePtr buffer, sampleFormat format, sampleCount len, XMLWriter* blockFileLog=NULL); bool Delete(sampleCount start, sampleCount len); - bool AppendAlias(wxString fullPath, + bool AppendAlias(const wxString &fullPath, sampleCount start, sampleCount len, int channel, bool useOD); - bool AppendCoded(wxString fName, sampleCount start, + bool AppendCoded(const wxString &fName, sampleCount start, sampleCount len, int channel, int decodeType); ///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc. diff --git a/src/Tags.cpp b/src/Tags.cpp index deeb6c0d4..591d7c4c6 100644 --- a/src/Tags.cpp +++ b/src/Tags.cpp @@ -521,7 +521,7 @@ void Tags::WriteXML(XMLWriter &xmlFile) xmlFile.EndTag(wxT("tags")); } -bool Tags::ShowEditDialog(wxWindow *parent, wxString title, bool force) +bool Tags::ShowEditDialog(wxWindow *parent, const wxString &title, bool force) { if (force) { TagsEditor dlg(parent, title, this, mEditTitle, mEditTrackNumber); @@ -639,7 +639,7 @@ BEGIN_EVENT_TABLE(TagsEditor, wxDialog) END_EVENT_TABLE() TagsEditor::TagsEditor(wxWindow * parent, - wxString title, + const wxString &title, Tags * tags, bool editTitle, bool editTrack) diff --git a/src/Tags.h b/src/Tags.h index 873a60470..7edb1b2e2 100644 --- a/src/Tags.h +++ b/src/Tags.h @@ -78,7 +78,7 @@ class AUDACITY_DLL_API Tags: public XMLTagHandler { Tags & operator= (const Tags & src ); - bool ShowEditDialog(wxWindow *parent, wxString title, bool force = false); + bool ShowEditDialog(wxWindow *parent, const wxString &title, bool force = false); virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs); virtual XMLTagHandler *HandleXMLChild(const wxChar *tag); @@ -126,7 +126,7 @@ class TagsEditor: public wxDialog public: // constructors and destructors TagsEditor(wxWindow * parent, - wxString title, + const wxString &title, Tags * tags, bool editTitle, bool editTrackNumber); diff --git a/src/TimeDialog.cpp b/src/TimeDialog.cpp index 1298fb970..48de799bd 100644 --- a/src/TimeDialog.cpp +++ b/src/TimeDialog.cpp @@ -103,7 +103,7 @@ const double TimeDialog::GetTimeValue() return mTime; } -void TimeDialog::SetFormatString(wxString formatString) +void TimeDialog::SetFormatString(const wxString &formatString) { mFormat = formatString; TransferDataToWindow(); diff --git a/src/TimeDialog.h b/src/TimeDialog.h index 99f6cfb09..f464e0bde 100644 --- a/src/TimeDialog.h +++ b/src/TimeDialog.h @@ -30,7 +30,7 @@ class TimeDialog:public wxDialog double time, const wxString &prompt = _("Duration")); - void SetFormatString(wxString formatString); + void SetFormatString(const wxString &formatString); void SetSampleRate(double sampleRate); void SetTimeValue(double newTime); const double GetTimeValue(); diff --git a/src/Track.h b/src/Track.h index 9098b4fc8..64e4ff4f4 100644 --- a/src/Track.h +++ b/src/Track.h @@ -153,9 +153,9 @@ class AUDACITY_DLL_API Track: public XMLTagHandler virtual void Merge(const Track &orig); wxString GetName() const { return mName; } - void SetName( wxString n ) { mName = n; } + void SetName( const wxString &n ) { mName = n; } wxString GetDefaultName() const { return mDefaultName; } - void SetDefaultName( wxString n ) { mDefaultName = n; } + void SetDefaultName( const wxString &n ) { mDefaultName = n; } bool GetSelected() const { return mSelected; } bool GetMute () const { return mMute; } diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 91ca75e21..3d7e2edbb 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -1491,7 +1491,7 @@ void TrackPanel::OnPaint(wxPaintEvent & /* event */) /// Makes our Parent (well, whoever is listening to us) push their state. /// this causes application state to be preserved on a stack for undo ops. -void TrackPanel::MakeParentPushState(wxString desc, wxString shortDesc, +void TrackPanel::MakeParentPushState(const wxString &desc, const wxString &shortDesc, int flags) { mListener->TP_PushState(desc, shortDesc, flags); diff --git a/src/TrackPanel.h b/src/TrackPanel.h index df8547d3d..dbe95eac2 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -457,7 +457,7 @@ protected: virtual void MakeParentRedrawScrollbars(); // AS: Pushing the state preserves state for Undo operations. - virtual void MakeParentPushState(wxString desc, wxString shortDesc, + virtual void MakeParentPushState(const wxString &desc, const wxString &shortDesc, int flags = PUSH_AUTOSAVE); virtual void MakeParentModifyState(bool bWantsAutoSave); // if true, writes auto-save file. Should set only if you really want the state change restored after // a crash, as it can take many seconds for large (eg. 10 track-hours) projects diff --git a/src/TrackPanelListener.h b/src/TrackPanelListener.h index fd147d720..15385957e 100644 --- a/src/TrackPanelListener.h +++ b/src/TrackPanelListener.h @@ -21,11 +21,11 @@ class AUDACITY_DLL_API TrackPanelListener { virtual ~TrackPanelListener(){}; virtual void TP_DisplaySelection() = 0; - virtual void TP_DisplayStatusMessage(wxString msg) = 0; + virtual void TP_DisplayStatusMessage(const wxString &msg) = 0; virtual ToolsToolBar * TP_GetToolsToolBar() = 0; - virtual void TP_PushState(wxString shortDesc, wxString longDesc, + virtual void TP_PushState(const wxString &shortDesc, const wxString &longDesc, int flags = PUSH_AUTOSAVE) = 0; virtual void TP_ModifyState(bool bWantsAutoSave) = 0; // if true, writes auto-save file. Should set only if you really want the state change restored after // a crash, as it can take many seconds for large (eg. 10 track-hours) projects diff --git a/src/UndoManager.cpp b/src/UndoManager.cpp index 36a68e33c..30524974e 100644 --- a/src/UndoManager.cpp +++ b/src/UndoManager.cpp @@ -128,7 +128,7 @@ void UndoManager::GetShortDescription(unsigned int n, wxString *desc) *desc = stack[n]->shortDescription; } -void UndoManager::SetLongDescription(unsigned int n, wxString desc) +void UndoManager::SetLongDescription(unsigned int n, const wxString &desc) { n -= 1; @@ -212,8 +212,8 @@ void UndoManager::ModifyState(TrackList * l, void UndoManager::PushState(TrackList * l, const SelectedRegion &selectedRegion, - wxString longDescription, - wxString shortDescription, + const wxString &longDescription, + const wxString &shortDescription, int flags) { unsigned int i; diff --git a/src/UndoManager.h b/src/UndoManager.h index d28bd9c04..f42b8e2f4 100644 --- a/src/UndoManager.h +++ b/src/UndoManager.h @@ -82,7 +82,7 @@ class AUDACITY_DLL_API UndoManager { void PushState(TrackList * l, const SelectedRegion &selectedRegion, - wxString longDescription, wxString shortDescription, + const wxString &longDescription, const wxString &shortDescription, int flags = PUSH_AUTOSAVE); void ModifyState(TrackList * l, const SelectedRegion &selectedRegion); @@ -94,7 +94,7 @@ class AUDACITY_DLL_API UndoManager { void GetShortDescription(unsigned int n, wxString *desc); wxLongLong_t GetLongDescription(unsigned int n, wxString *desc, wxString *size); - void SetLongDescription(unsigned int n, wxString desc); + void SetLongDescription(unsigned int n, const wxString &desc); TrackList *SetStateTo(unsigned int n, SelectedRegion *selectedRegion); TrackList *Undo(SelectedRegion *selectedRegion); diff --git a/src/WaveClip.cpp b/src/WaveClip.cpp index 6e0b17c0b..fa35e4a2f 100644 --- a/src/WaveClip.cpp +++ b/src/WaveClip.cpp @@ -1297,7 +1297,7 @@ bool WaveClip::Append(samplePtr buffer, sampleFormat format, return true; } -bool WaveClip::AppendAlias(wxString fName, sampleCount start, +bool WaveClip::AppendAlias(const wxString &fName, sampleCount start, sampleCount len, int channel,bool useOD) { bool result = mSequence->AppendAlias(fName, start, len, channel,useOD); @@ -1309,7 +1309,7 @@ bool WaveClip::AppendAlias(wxString fName, sampleCount start, return result; } -bool WaveClip::AppendCoded(wxString fName, sampleCount start, +bool WaveClip::AppendCoded(const wxString &fName, sampleCount start, sampleCount len, int channel, int decodeType) { bool result = mSequence->AppendCoded(fName, start, len, channel, decodeType); diff --git a/src/WaveClip.h b/src/WaveClip.h index 507634c40..5ddbfb961 100644 --- a/src/WaveClip.h +++ b/src/WaveClip.h @@ -309,10 +309,10 @@ public: /// Flush must be called after last Append bool Flush(); - bool AppendAlias(wxString fName, sampleCount start, + bool AppendAlias(const wxString &fName, sampleCount start, sampleCount len, int channel,bool useOD); - bool AppendCoded(wxString fName, sampleCount start, + bool AppendCoded(const wxString &fName, sampleCount start, sampleCount len, int channel, int decodeType); /// This name is consistent with WaveTrack::Clear. It performs a "Cut" diff --git a/src/WaveTrack.cpp b/src/WaveTrack.cpp index 60e97d581..0a78fd175 100644 --- a/src/WaveTrack.cpp +++ b/src/WaveTrack.cpp @@ -1566,14 +1566,14 @@ bool WaveTrack::Append(samplePtr buffer, sampleFormat format, blockFileLog); } -bool WaveTrack::AppendAlias(wxString fName, sampleCount start, +bool WaveTrack::AppendAlias(const wxString &fName, sampleCount start, sampleCount len, int channel,bool useOD) { return RightmostOrNewClip()->AppendAlias(fName, start, len, channel, useOD); } -bool WaveTrack::AppendCoded(wxString fName, sampleCount start, +bool WaveTrack::AppendCoded(const wxString &fName, sampleCount start, sampleCount len, int channel, int decodeType) { return RightmostOrNewClip()->AppendCoded(fName, start, len, channel, decodeType); diff --git a/src/WaveTrack.h b/src/WaveTrack.h index 1a51bdb8f..0c6476e30 100644 --- a/src/WaveTrack.h +++ b/src/WaveTrack.h @@ -202,14 +202,14 @@ class AUDACITY_DLL_API WaveTrack : public Track { /// Flush must be called after last Append bool Flush(); - bool AppendAlias(wxString fName, sampleCount start, + bool AppendAlias(const wxString &fName, sampleCount start, sampleCount len, int channel,bool useOD); ///for use with On-Demand decoding of compressed files. ///decodeType should be an enum from ODDecodeTask that specifies what ///Type of encoded file this is, such as eODFLAC //vvv Why not use the ODTypeEnum typedef to enforce that for the parameter? - bool AppendCoded(wxString fName, sampleCount start, + bool AppendCoded(const wxString &fName, sampleCount start, sampleCount len, int channel, int decodeType); ///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc.