1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-08 16:37:44 +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 // returns number of tracks imported
int Importer::Import(wxString fName, int Importer::Import(const wxString &fName,
TrackFactory *trackFactory, TrackFactory *trackFactory,
Track *** tracks, Track *** tracks,
Tags *tags, Tags *tags,

View File

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

View File

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

View File

@ -138,7 +138,7 @@ class FLACImportPlugin : public ImportPlugin
wxString GetPluginStringID() { return wxT("libflac"); } wxString GetPluginStringID() { return wxT("libflac"); }
wxString GetPluginFormatDescription(); 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 // First check if it really is a FLAC file

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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