From 06b3b427941794f4c0b14d8ebef7ca16505f6054 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 15 Mar 2019 14:41:21 -0400 Subject: [PATCH] Remove unnecessary initializers for empty wxString --- src/AboutDialog.cpp | 2 +- src/AudacityApp.cpp | 2 +- src/BatchCommands.cpp | 1 - src/Dependencies.cpp | 2 +- src/PluginManager.cpp | 4 ++-- src/Project.cpp | 11 +++++------ src/Shuttle.h | 4 ++-- src/TimerRecordDialog.cpp | 8 ++++---- src/commands/CommandManager.cpp | 4 ++-- src/commands/CommandTargets.cpp | 2 +- src/commands/Keyboard.cpp | 2 +- src/effects/Equalization.cpp | 6 +++--- src/effects/nyquist/Nyquist.cpp | 8 +++----- src/export/Export.cpp | 1 - src/export/ExportMP3.cpp | 2 +- src/import/Import.cpp | 2 +- src/import/ImportFFmpeg.cpp | 2 +- src/import/ImportQT.cpp | 2 +- src/menus/FileMenus.cpp | 2 +- src/menus/PluginMenus.cpp | 2 +- src/tracks/ui/Scrubbing.cpp | 1 - src/widgets/NumericTextCtrl.cpp | 5 ----- src/widgets/Ruler.cpp | 1 - src/xml/XMLFileReader.cpp | 1 - 24 files changed, 32 insertions(+), 45 deletions(-) diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 8dac7ed34..f9a54cb6a 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -450,7 +450,7 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S ) // create a html pane in it to put the content in. wxString enabled = _("Enabled"); wxString disabled = _("Disabled"); - wxString blank = wxT(""); + wxString blank; /* this builds up the list of information to go in the window in the string * informationStr */ diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 4f170f7ae..18e5c0e4d 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1753,7 +1753,7 @@ bool AudacityApp::InitTempDir() wxString tempFromPrefs = gPrefs->Read(wxT("/Directories/TempDir"), wxT("")); wxString tempDefaultLoc = wxGetApp().defaultTempDir; - wxString temp = wxT(""); + wxString temp; #ifdef __WXGTK__ if (tempFromPrefs.length() > 0 && tempFromPrefs[0] != wxT('/')) diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index 03d6b72da..58a090d2c 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -90,7 +90,6 @@ static const std::pair SpecialCommands[] = { MacroCommands::MacroCommands() { - mMessage = ""; ResetMacro(); auto names = GetNames(); diff --git a/src/Dependencies.cpp b/src/Dependencies.cpp index 9507cbd76..bc9529d04 100644 --- a/src/Dependencies.cpp +++ b/src/Dependencies.cpp @@ -533,7 +533,7 @@ void DependencyDialog::OnRightClick( wxListEvent& event) void DependencyDialog::OnCopyToClipboard( wxCommandEvent& evt ) { static_cast(evt); - wxString Files = ""; + wxString Files; for (const auto &aliasedFile : mAliasedFiles) { const wxFileName & fileName = aliasedFile.mFileName; wxLongLong byteCount = (aliasedFile.mByteCount * 124) / 100; diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index 5bd2e0948..874eaba34 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -2799,7 +2799,7 @@ bool PluginManager::GetSubgroups(const wxString & group, wxArrayString & subgrou wxString path = GetSettings()->GetPath(); GetSettings()->SetPath(group); - wxString name = wxEmptyString; + wxString name; long index = 0; if (GetSettings()->GetFirstGroup(name, index)) { @@ -2832,7 +2832,7 @@ bool PluginManager::GetConfig(const wxString & key, wxString & value, const wxSt if (!key.empty()) { - wxString wxval = wxEmptyString; + wxString wxval; result = GetSettings()->Read(key, &wxval, defval); diff --git a/src/Project.cpp b/src/Project.cpp index 11f9851af..ef16d5cba 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -2467,7 +2467,6 @@ public: p->Raise(); // May help identifying the window on Mac // Construct this projects name and number. - sProjNumber = ""; sProjName = p->GetName(); if (sProjName.empty()){ sProjName = _(""); @@ -3873,7 +3872,7 @@ bool AudacityProject::DoSave (const bool fromSaveAs, // Always save a backup of the original project file // - wxString safetyFileName = wxT(""); + wxString safetyFileName; if (wxFileExists(mFileName)) { #ifdef __WXGTK__ @@ -4308,7 +4307,7 @@ void AudacityProject::ZoomAfterImport(Track *pTrack) bool AudacityProject::Import(const wxString &fileName, WaveTrackArray* pTrackArray /*= NULL*/) { TrackHolders newTracks; - wxString errorMessage = wxEmptyString; + wxString errorMessage; { // Backup Tags, before the import. Be prepared to roll back changes. @@ -4479,7 +4478,7 @@ For an audio file that will open in other apps, use 'Export'.\n"); } bool bPrompt = (mBatchMode == 0) || (mFileName.empty()); - wxString fName = ""; + wxString fName; if (bPrompt) { // JKC: I removed 'wxFD_OVERWRITE_PROMPT' because we are checking @@ -5436,7 +5435,7 @@ bool AudacityProject::SaveFromTimerRecording(wxFileName fnFile) { // MY: To allow SaveAs from Timer Recording we need to check what // the value of mFileName is before we change it. - wxString sOldFilename = ""; + wxString sOldFilename; if (IsProjectSaved()) { sOldFilename = mFileName; } @@ -5477,7 +5476,7 @@ bool AudacityProject::ProjectHasTracks() { wxString AudacityProject::GetHoursMinsString(int iMinutes) { - wxString sFormatted = wxEmptyString; + wxString sFormatted; if (iMinutes < 1) { // Less than a minute... diff --git a/src/Shuttle.h b/src/Shuttle.h index 8992fc91b..ad9ad0971 100644 --- a/src/Shuttle.h +++ b/src/Shuttle.h @@ -47,7 +47,7 @@ class ShuttleCli final : public Shuttle { public: wxString mParams; - ShuttleCli(){ mParams = wxT("") ;} + ShuttleCli() {} virtual ~ShuttleCli() {} bool ExchangeWithMaster(const wxString & Name) override; }; @@ -63,7 +63,7 @@ public: wxString mParams; bool *pOptionalFlag; CommandParameters * mpEap; - ShuttleParams(){ mParams = wxT("") ;mpEap=NULL;pOptionalFlag=NULL;} + ShuttleParams() { mpEap = NULL; pOptionalFlag = NULL; } virtual ~ShuttleParams() {} bool ExchangeWithMaster(const wxString & Name) override; bool ShouldSet(); diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index 8d69183ba..a57627a89 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -416,13 +416,13 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event)) if (iMinsRecording >= iMinsLeft) { // Format the strings - wxString sRemainingTime = ""; + wxString sRemainingTime; sRemainingTime = pProject->GetHoursMinsString(iMinsLeft); - wxString sPlannedTime = ""; + wxString sPlannedTime; sPlannedTime = pProject->GetHoursMinsString(iMinsRecording); // Create the message string - wxString sMessage = ""; + wxString sMessage; sMessage.Printf(_("You may not have enough free disk space to complete this Timer Recording, based on your current settings.\n\nDo you wish to continue?\n\nPlanned recording duration: %s\nRecording time remaining on disk: %s"), sPlannedTime, sRemainingTime); @@ -890,7 +890,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) (bAutoSave ? "true" : "false")); S.StartMultiColumn(3, wxEXPAND); { - wxString sInitialValue = wxT(""); + wxString sInitialValue; AudacityProject* pProject = GetActiveProject(); wxString sSaveValue = pProject->GetFileName(); if (!sSaveValue.empty()) { diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 2cd3b63d8..0070f3f06 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -1080,7 +1080,7 @@ wxString CommandManager::GetLabelWithDisabledAccel(const CommandListEntry *entry { wxString label = entry->label; #if 1 - wxString Accel = ""; + wxString Accel; do{ if (!entry->key.empty()) { @@ -1253,7 +1253,7 @@ void CommandManager::TellUserWhyDisallowed( const wxString & Name, CommandFlag f wxString reason = _("There was a problem with your last action. If you think\nthis is a bug, please tell us exactly where it occurred."); // The default title string is 'Disallowed'. wxString title = _("Disallowed"); - wxString helpPage =""; + wxString helpPage; auto missingFlags = flagsRequired & (~flagsGot ); if( missingFlags & AudioIONotBusyFlag ) diff --git a/src/commands/CommandTargets.cpp b/src/commands/CommandTargets.cpp index 49e0fa162..9f3e9167d 100644 --- a/src/commands/CommandTargets.cpp +++ b/src/commands/CommandTargets.cpp @@ -136,7 +136,7 @@ void LispyCommandMessageTarget::EndStruct(){ Update( ")" ); } void LispyCommandMessageTarget::AddItem(const wxString &value, const wxString &name){ - wxString Padding = ""; + wxString Padding; if( name.empty() ) Update( wxString::Format( "%s%s\"%s\"", (mCounts.back()>0)?" ":"", Padding, Escaped(value))); else diff --git a/src/commands/Keyboard.cpp b/src/commands/Keyboard.cpp index 8072d7731..18f7bfb56 100644 --- a/src/commands/Keyboard.cpp +++ b/src/commands/Keyboard.cpp @@ -77,7 +77,7 @@ wxString NormalizedKeyString::Display(bool usesSpecialChars) const NormalizedKeyString KeyEventToKeyString(const wxKeyEvent & event) { - wxString newStr = wxT(""); + wxString newStr; long key = event.GetKeyCode(); diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index e6c286403..6d1e8291b 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -1345,7 +1345,7 @@ void EffectEqualization::LoadCurves(const wxString &fileName, bool append) if(fileName.empty()) { // Check if presets are up to date. wxString eqCurvesCurrentVersion = wxString::Format(wxT("%d.%d"), EQCURVES_VERSION, EQCURVES_REVISION); - wxString eqCurvesInstalledVersion = wxT(""); + wxString eqCurvesInstalledVersion; gPrefs->Read(wxT("/Effects/Equalization/PresetVersion"), &eqCurvesInstalledVersion, wxT("")); bool needUpdate = (eqCurvesCurrentVersion != eqCurvesInstalledVersion); @@ -3490,7 +3490,7 @@ void EditCurvesDialog::OnDelete(wxCommandEvent & WXUNUSED(event)) void EditCurvesDialog::OnImport( wxCommandEvent & WXUNUSED(event)) { FileDialogWrapper filePicker(this, _("Choose an EQ curve file"), FileNames::DataDir(), wxT(""), _("xml files (*.xml;*.XML)|*.xml;*.XML")); - wxString fileName = wxT(""); + wxString fileName; if( filePicker.ShowModal() == wxID_CANCEL) return; else @@ -3510,7 +3510,7 @@ void EditCurvesDialog::OnImport( wxCommandEvent & WXUNUSED(event)) void EditCurvesDialog::OnExport( wxCommandEvent & WXUNUSED(event)) { FileDialogWrapper filePicker(this, _("Export EQ curves as..."), FileNames::DataDir(), wxT(""), wxT("*.XML"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER); // wxFD_CHANGE_DIR? - wxString fileName = wxT(""); + wxString fileName; if( filePicker.ShowModal() == wxID_CANCEL) return; else diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 512c15e29..7d34e7dd1 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -129,8 +129,6 @@ NyquistEffect::NyquistEffect(const wxString &fName) mOutputTrack[0] = mOutputTrack[1] = nullptr; mAction = XO("Applying Nyquist Effect..."); - mInputCmd = wxEmptyString; - mCmd = wxEmptyString; mIsPrompt = false; mExternal = false; mCompiler = false; @@ -706,7 +704,7 @@ bool NyquistEffect::Process() int numLabel = 0; int numMidi = 0; int numTime = 0; - wxString waveTrackList = wxT(""); // track positions of selected audio tracks. + wxString waveTrackList; // track positions of selected audio tracks. { auto countRange = project->GetTracks()->Leaders(); @@ -2637,7 +2635,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S) S.AddSpace(10, 10); // Get default file extension if specified in wildcards - wxString defaultExtension = ""; + wxString defaultExtension; size_t len = ctrl.lowStr.length(); int characters = ctrl.lowStr.Find("*"); @@ -2949,7 +2947,7 @@ void NyquistEffect::OnFileButton(wxCommandEvent& evt) return; } - wxString path = ""; + wxString path; // When multiple files selected, return file paths as a list of quoted strings. if (flags & wxFD_MULTIPLE) { diff --git a/src/export/Export.cpp b/src/export/Export.cpp index 58edbb944..56a64b297 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -282,7 +282,6 @@ Exporter::Exporter() { mMixerSpec = NULL; mBook = NULL; - mFormatName = ""; SetFileDialogTitle( _("Export Audio") ); diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index 2d75d3104..99e50e36c 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -2002,7 +2002,7 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate) S.EndHorizontalLay(); wxArrayString choices; - wxString selected = wxT(""); + wxString selected; for (size_t i = 0; i < WXSIZEOF(sampRates); i++) { int label = sampRates[i].label; if (label >= lowrate && label <= highrate) { diff --git a/src/import/Import.cpp b/src/import/Import.cpp index 831e6367f..85b949686 100644 --- a/src/import/Import.cpp +++ b/src/import/Import.cpp @@ -152,7 +152,7 @@ void Importer::ReadImportItems() */ for (item_counter = 0; true; item_counter++) { - wxString condition, filters, used_filters, unused_filters = wxEmptyString, extensions, mime_types = wxEmptyString; + wxString condition, filters, used_filters, unused_filters, extensions, mime_types; item_name.Printf (wxT("/ExtImportItems/Item%d"), item_counter); /* Break at first non-existent item */ if (!gPrefs->Read(item_name, &item_value)) diff --git a/src/import/ImportFFmpeg.cpp b/src/import/ImportFFmpeg.cpp index 73fe93fae..cde5cdd6f 100644 --- a/src/import/ImportFFmpeg.cpp +++ b/src/import/ImportFFmpeg.cpp @@ -439,7 +439,7 @@ bool FFmpegImportFileHandle::InitCodecs() duration = sc->m_stream->duration * sc->m_stream->time_base.num / sc->m_stream->time_base.den; else duration = mFormatContext->duration / AV_TIME_BASE; - wxString bitrate = wxT(""); + wxString bitrate; if (sc->m_codecCtx->bit_rate > 0) bitrate.Printf(wxT("%d"),(int)sc->m_codecCtx->bit_rate); else diff --git a/src/import/ImportQT.cpp b/src/import/ImportQT.cpp index 75e6d2645..fa3c1fd21 100644 --- a/src/import/ImportQT.cpp +++ b/src/import/ImportQT.cpp @@ -511,7 +511,7 @@ void QTImportFileHandle::AddMetadata(Tags *tags) if (err != noErr) continue; - wxString v = wxT(""); + wxString v; switch (dataType) { diff --git a/src/menus/FileMenus.cpp b/src/menus/FileMenus.cpp index 910318244..d51f7331c 100644 --- a/src/menus/FileMenus.cpp +++ b/src/menus/FileMenus.cpp @@ -332,7 +332,7 @@ void OnExportMIDI(const CommandContext &context) while(true) { - wxString fName = wxT(""); + wxString fName; fName = FileNames::SelectFile(FileNames::Operation::Export, _("Export MIDI As:"), diff --git a/src/menus/PluginMenus.cpp b/src/menus/PluginMenus.cpp index f3db0c9de..6d849d0d5 100644 --- a/src/menus/PluginMenus.cpp +++ b/src/menus/PluginMenus.cpp @@ -265,7 +265,7 @@ void AddEffectMenuItems( name += wxT("..."); } - wxString group = wxEmptyString; + wxString group; if (groupBy == wxT("sortby:publisher:name")) { group = EffectManager::Get().GetVendorName(plug->GetID()); diff --git a/src/tracks/ui/Scrubbing.cpp b/src/tracks/ui/Scrubbing.cpp index 86ff77b82..6b839b292 100644 --- a/src/tracks/ui/Scrubbing.cpp +++ b/src/tracks/ui/Scrubbing.cpp @@ -1121,7 +1121,6 @@ const wxString &Scrubber::GetUntranslatedStateString() const wxString Scrubber::StatusMessageForWave() const { wxString result; - result = ""; if( Seeks() ) result = _("Move mouse pointer to Seek"); diff --git a/src/widgets/NumericTextCtrl.cpp b/src/widgets/NumericTextCtrl.cpp index 9d48837db..1e12564a9 100644 --- a/src/widgets/NumericTextCtrl.cpp +++ b/src/widgets/NumericTextCtrl.cpp @@ -607,11 +607,6 @@ NumericConverter::NumericConverter(Type type, if (type == NumericConverter::TIME ) mDefaultNdx = 4; // Default to "hh:mm:ss + milliseconds". - mPrefix = wxT(""); - mValueTemplate = wxT(""); - mValueMask = wxT(""); - mValueString = wxT(""); - mScalingFactor = 1.0f; mSampleRate = 1.0f; mNtscDrop = false; diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index 197e3bd9d..2114970fe 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -85,7 +85,6 @@ Ruler::Ruler() mFlip = false; mLog = false; mLabelEdges = false; - mUnits = wxT(""); mLeft = -1; mTop = -1; diff --git a/src/xml/XMLFileReader.cpp b/src/xml/XMLFileReader.cpp index 177857754..520c9d626 100644 --- a/src/xml/XMLFileReader.cpp +++ b/src/xml/XMLFileReader.cpp @@ -29,7 +29,6 @@ XMLFileReader::XMLFileReader() XML_SetElementHandler(mParser, startElement, endElement); XML_SetCharacterDataHandler(mParser, charHandler); mBaseHandler = NULL; - mErrorStr = wxT(""); mHandler.reserve(128); }