1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 00:29:41 +02:00

Sweep unnecessary wxString copies: import

This commit is contained in:
Paul Licameli 2016-02-22 21:16:39 -05:00
parent 0ce4fe0b83
commit d21c0aa478
13 changed files with 23 additions and 23 deletions

View File

@ -348,7 +348,7 @@ ExtImportItem *Importer::CreateDefaultImportItem()
}
// returns number of tracks imported
int Importer::Import(wxString fName,
int Importer::Import(const wxString &fName,
TrackFactory *trackFactory,
Track *** tracks,
Tags *tags,

View File

@ -31,7 +31,7 @@ public:
wxString formatName;
wxArrayString formatExtensions;
Format(wxString _formatName, wxArrayString _formatExtensions):
Format(const wxString &_formatName, const wxArrayString &_formatExtensions):
formatName(_formatName),
formatExtensions(_formatExtensions)
{
@ -139,7 +139,7 @@ public:
// returns number of tracks imported
// if zero, the import failed and errorMessage will be set.
int Import(wxString fName,
int Import(const wxString &fName,
TrackFactory *trackFactory,
Track *** tracks,
Tags *tags,

View File

@ -182,7 +182,7 @@ public:
wxString GetPluginFormatDescription();
///! Probes the file and opens it if appropriate
ImportFileHandle *Open(wxString Filename);
ImportFileHandle *Open(const wxString &Filename) override;
};
///! Does acual import, returned by FFmpegImportPlugin::Open
@ -292,7 +292,7 @@ wxString FFmpegImportPlugin::GetPluginFormatDescription()
return DESC;
}
ImportFileHandle *FFmpegImportPlugin::Open(wxString filename)
ImportFileHandle *FFmpegImportPlugin::Open(const wxString &filename)
{
FFmpegImportFileHandle *handle = new FFmpegImportFileHandle(filename);

View File

@ -138,7 +138,7 @@ class FLACImportPlugin : public ImportPlugin
wxString GetPluginStringID() { return wxT("libflac"); }
wxString GetPluginFormatDescription();
ImportFileHandle *Open(wxString Filename);
ImportFileHandle *Open(const wxString &Filename) override;
};
@ -289,7 +289,7 @@ wxString FLACImportPlugin::GetPluginFormatDescription()
}
ImportFileHandle *FLACImportPlugin::Open(wxString filename)
ImportFileHandle *FLACImportPlugin::Open(const wxString &filename)
{
// First check if it really is a FLAC file

View File

@ -113,7 +113,7 @@ public:
wxString GetPluginStringID() { return wxT("lof"); }
wxString GetPluginFormatDescription();
ImportFileHandle *Open(wxString Filename);
ImportFileHandle *Open(const wxString &Filename) override;
};
@ -181,7 +181,7 @@ wxString LOFImportPlugin::GetPluginFormatDescription()
return DESC;
}
ImportFileHandle *LOFImportPlugin::Open(wxString filename)
ImportFileHandle *LOFImportPlugin::Open(const wxString &filename)
{
// Check if it is a binary file
wxFile binaryFile;

View File

@ -25,7 +25,7 @@
#include "../NoteTrack.h"
#include "ImportMIDI.h"
bool ImportMIDI(wxString fName, NoteTrack * dest)
bool ImportMIDI(const wxString &fName, NoteTrack * dest)
{
if (fName.Length() <= 4){
wxMessageBox( _("Could not open file ") + fName + _(": Filename too short."));

View File

@ -24,7 +24,7 @@ into a NoteTrack.
class NoteTrack;
bool ImportMIDI(wxString fName, NoteTrack * dest);
bool ImportMIDI(const wxString &fName, NoteTrack * dest);
class MIDIParser {
public:

View File

@ -114,7 +114,7 @@ public:
wxString GetPluginStringID() { return wxT("libmad"); }
wxString GetPluginFormatDescription();
ImportFileHandle *Open(wxString Filename);
ImportFileHandle *Open(const wxString &Filename) override;
};
class MP3ImportFileHandle : public ImportFileHandle
@ -176,7 +176,7 @@ wxString MP3ImportPlugin::GetPluginFormatDescription()
return DESC;
}
ImportFileHandle *MP3ImportPlugin::Open(wxString Filename)
ImportFileHandle *MP3ImportPlugin::Open(const wxString &Filename)
{
wxFile *file = new wxFile(Filename);

View File

@ -92,7 +92,7 @@ public:
wxString GetPluginStringID() { return wxT("liboggvorbis"); }
wxString GetPluginFormatDescription();
ImportFileHandle *Open(wxString Filename);
ImportFileHandle *Open(const wxString &Filename) override;
};
@ -171,7 +171,7 @@ wxString OggImportPlugin::GetPluginFormatDescription()
return DESC;
}
ImportFileHandle *OggImportPlugin::Open(wxString filename)
ImportFileHandle *OggImportPlugin::Open(const wxString &filename)
{
OggVorbis_File *vorbisFile = new OggVorbis_File;
wxFFile *file = new wxFFile(filename, wxT("rb"));

View File

@ -82,7 +82,7 @@ public:
wxString GetPluginStringID() { return wxT("libsndfile"); }
wxString GetPluginFormatDescription();
ImportFileHandle *Open(wxString Filename);
ImportFileHandle *Open(const wxString &Filename) override;
};
@ -120,7 +120,7 @@ wxString PCMImportPlugin::GetPluginFormatDescription()
return DESC;
}
ImportFileHandle *PCMImportPlugin::Open(wxString filename)
ImportFileHandle *PCMImportPlugin::Open(const wxString &filename)
{
SF_INFO info;
SNDFILE *file = NULL;

View File

@ -90,7 +90,7 @@ public:
return mExtensions;
}
bool SupportsExtension(wxString extension)
bool SupportsExtension(const wxString &extension)
{
// Case-insensitive check if extension is supported
return mExtensions.Index(extension, false) != wxNOT_FOUND;
@ -99,7 +99,7 @@ public:
// Open the given file, returning true if it is in a recognized
// format, false otherwise. This puts the importer into the open
// state.
virtual ImportFileHandle *Open(wxString Filename) = 0;
virtual ImportFileHandle *Open(const wxString &Filename) = 0;
virtual ~ImportPlugin() { }
@ -178,7 +178,7 @@ protected:
class UnusableImportPlugin
{
public:
UnusableImportPlugin(wxString formatName, wxArrayString extensions):
UnusableImportPlugin(const wxString &formatName, wxArrayString extensions):
mFormatName(formatName),
mExtensions(extensions)
{
@ -189,7 +189,7 @@ public:
return mFormatName;
}
bool SupportsExtension(wxString extension)
bool SupportsExtension(const wxString &extension)
{
return mExtensions.Index(extension, false) != wxNOT_FOUND;
}

View File

@ -93,7 +93,7 @@ class ImportRawDialog:public wxDialog {
DECLARE_EVENT_TABLE()
};
int ImportRaw(wxWindow *parent, wxString fileName,
int ImportRaw(wxWindow *parent, const wxString &fileName,
TrackFactory *trackFactory, Track ***outTracks)
{
int encoding = 0; // Guess Format

View File

@ -17,7 +17,7 @@ class WaveTrack;
class DirManager;
class wxWindow;
int ImportRaw(wxWindow *parent, wxString fileName,
int ImportRaw(wxWindow *parent, const wxString &fileName,
TrackFactory *trackFactory, Track ***outTracks);
#endif