1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-20 15:41:18 +01:00

Avoid some wxString copies

This commit is contained in:
Paul Licameli
2016-04-17 09:38:08 -04:00
parent 3e6f0bed78
commit 185d5e132d
4 changed files with 6 additions and 6 deletions

View File

@@ -247,7 +247,7 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
#endif
void Clear();
wxString GetFileName() { return mFileName; }
const wxString &GetFileName() { return mFileName; }
bool GetDirty() { return mDirty; }
void SetProjectTitle();

View File

@@ -48,9 +48,9 @@ bool OpenProjectCommand::Apply(CommandExecutionContext context)
}
else
{
context.GetProject()->OpenFile(fileName,addToHistory);
context.GetProject()->OpenFile(fileName, addToHistory);
}
wxString newFileName = context.GetProject()->GetFileName();
const wxString &newFileName = context.GetProject()->GetFileName();
// Because Open does not return a success or failure, we have to guess
// at this point, based on whether the project file name has

View File

@@ -290,8 +290,8 @@ int ODDecodeTask::GetNumFileDecoders()
///This should handle unicode converted to UTF-8 on mac/linux, but OD TODO:check on windows
ODFileDecoder::ODFileDecoder(const wxString & fName)
: mFName{ fName }
{
mFName = fName;
mInited = false;
}

View File

@@ -120,7 +120,7 @@ public:
///returns negative value for failure, 0 or positive value for success.
virtual int Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel)=0;
wxString GetFileName(){return mFName;}
const wxString &GetFileName(){return mFName;}
bool IsInitialized();
@@ -131,7 +131,7 @@ protected:
bool mInited;
ODLock mInitedLock;
wxString mFName;
const wxString mFName;
unsigned int mSampleRate;
unsigned int mNumSamples;//this may depend on the channel - so TODO: we should probably let the decoder create/modify the track info directly.