From b8c01251430afcac87408b3ebfae339af6e220fa Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 14 Mar 2019 16:20:18 -0400 Subject: [PATCH] Replace comparisons against wxEmptyString with empty() --- src/AudacityLogger.cpp | 2 +- src/DirManager.cpp | 2 +- src/LyricsWindow.cpp | 2 +- src/MixerBoard.cpp | 2 +- src/Project.cpp | 4 ++-- src/TimerRecordDialog.cpp | 2 +- src/commands/CommandBuilder.cpp | 4 ++-- src/commands/OpenSaveCommands.cpp | 2 +- src/effects/Distortion.cpp | 4 ++-- src/effects/EffectManager.cpp | 4 ++-- src/effects/nyquist/Nyquist.cpp | 14 +++++++------- src/import/Import.cpp | 4 ++-- src/prefs/KeyConfigPrefs.cpp | 2 +- src/prefs/ModulePrefs.cpp | 2 +- src/prefs/PrefsDialog.cpp | 2 +- src/widgets/KeyView.cpp | 4 ++-- src/widgets/ProgressDialog.cpp | 2 +- 17 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/AudacityLogger.cpp b/src/AudacityLogger.cpp index 7b19f43ae..e96ed9f5e 100644 --- a/src/AudacityLogger.cpp +++ b/src/AudacityLogger.cpp @@ -240,7 +240,7 @@ void AudacityLogger::OnSave(wxCommandEvent & WXUNUSED(e)) wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, mFrame.get()); - if (fName == wxEmptyString) { + if (fName.empty()) { return; } diff --git a/src/DirManager.cpp b/src/DirManager.cpp index a1dfee0a0..54a1fe829 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -2032,7 +2032,7 @@ void DirManager::FindMissingAliasedFiles( static_cast< AliasBlockFile* > ( &*b )->GetAliasedFileName(); wxString aliasedFileFullPath = aliasedFileName.GetFullPath(); // wxEmptyString can happen if user already chose to "replace... with silence". - if ((aliasedFileFullPath != wxEmptyString) && + if ((!aliasedFileFullPath.empty()) && !aliasedFileName.FileExists()) { missingAliasedFileAUFHash[key] = b; diff --git a/src/LyricsWindow.cpp b/src/LyricsWindow.cpp index 8b32ea73f..211c26662 100644 --- a/src/LyricsWindow.cpp +++ b/src/LyricsWindow.cpp @@ -46,7 +46,7 @@ const wxSize gSize = wxSize(LYRICS_DEFAULT_WIDTH, LYRICS_DEFAULT_HEIGHT); LyricsWindow::LyricsWindow(AudacityProject *parent): wxFrame(parent, -1, wxString::Format(_("Audacity Karaoke%s"), - ((parent->GetName() == wxEmptyString) ? + ((parent->GetName().empty()) ? wxT("") : wxString::Format( wxT(" - %s"), diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index 39265065d..28e7e15d2 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -1399,7 +1399,7 @@ const wxSize kDefaultSize = MixerBoardFrame::MixerBoardFrame(AudacityProject* parent) : wxFrame(parent, -1, wxString::Format(_("Audacity Mixer Board%s"), - ((parent->GetName() == wxEmptyString) ? + ((parent->GetName().empty()) ? wxT("") : wxString::Format(wxT(" - %s"), parent->GetName()))), diff --git a/src/Project.cpp b/src/Project.cpp index c9934beff..ec6fc3982 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -2757,7 +2757,7 @@ wxArrayString AudacityProject::ShowOpenDialog(const wxString &extraformat, const wxString all; ///< One long list of all supported file extensions, /// semicolon separated - if (extraformat != wxEmptyString) + if (!extraformat.empty()) { // additional format specified all = extrafilter + wxT(';'); // add it to the "all supported files" filter string @@ -2799,7 +2799,7 @@ wxArrayString AudacityProject::ShowOpenDialog(const wxString &extraformat, const /* i18n-hint: The vertical bars and * are essential here.*/ wxString mask = _("All files|*|All supported files|") + all + wxT("|"); // "all" and "all supported" entries - if (extraformat != wxEmptyString) + if (!extraformat.empty()) { // append caller-defined format if supplied mask += extraformat + wxT("|") + extrafilter + wxT("|"); } diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index f42103d17..8d69183ba 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -893,7 +893,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) wxString sInitialValue = wxT(""); AudacityProject* pProject = GetActiveProject(); wxString sSaveValue = pProject->GetFileName(); - if (sSaveValue != wxEmptyString) { + if (!sSaveValue.empty()) { m_fnAutoSaveFile.Assign(sSaveValue); sInitialValue = _("Current Project"); } diff --git a/src/commands/CommandBuilder.cpp b/src/commands/CommandBuilder.cpp index f76c6188d..5758ca18d 100644 --- a/src/commands/CommandBuilder.cpp +++ b/src/commands/CommandBuilder.cpp @@ -139,12 +139,12 @@ void CommandBuilder::BuildCommand(const wxString &cmdName, wxString cmdParams(cmdParamsArg); - while (cmdParams != wxEmptyString) + while (!cmdParams.empty()) { cmdParams.Trim(true); cmdParams.Trim(false); int splitAt = cmdParams.Find(wxT('=')); - if (splitAt < 0 && cmdParams != wxEmptyString) + if (splitAt < 0 && !cmdParams.empty()) { Failure(wxT("Parameter string is missing '='")); return; diff --git a/src/commands/OpenSaveCommands.cpp b/src/commands/OpenSaveCommands.cpp index 11e9e7ced..a26032934 100644 --- a/src/commands/OpenSaveCommands.cpp +++ b/src/commands/OpenSaveCommands.cpp @@ -58,7 +58,7 @@ bool OpenProjectCommand::Apply(const CommandContext & context){ // Because Open does not return a success or failure, we have to guess // at this point, based on whether the project file name has // changed and what to... - return newFileName != wxEmptyString && newFileName != oldFileName; + return !newFileName.empty() && newFileName != oldFileName; } bool SaveProjectCommand::DefineParams( ShuttleParams & S ){ diff --git a/src/effects/Distortion.cpp b/src/effects/Distortion.cpp index d93247a9b..1edfef304 100644 --- a/src/effects/Distortion.cpp +++ b/src/effects/Distortion.cpp @@ -937,13 +937,13 @@ void EffectDistortion::UpdateControl(control id, bool enabled, wxString name) void EffectDistortion::UpdateControlText(wxTextCtrl* textCtrl, wxString& string, bool enabled) { if (enabled) { - if (textCtrl->GetValue() == wxEmptyString) + if (textCtrl->GetValue().empty()) textCtrl->SetValue(string); else string = textCtrl->GetValue(); } else { - if (textCtrl->GetValue() != wxEmptyString) + if (!textCtrl->GetValue().empty()) string = textCtrl->GetValue(); textCtrl->SetValue(wxT("")); } diff --git a/src/effects/EffectManager.cpp b/src/effects/EffectManager.cpp index 1619ca3dd..48f15682d 100644 --- a/src/effects/EffectManager.cpp +++ b/src/effects/EffectManager.cpp @@ -175,7 +175,7 @@ wxString EffectManager::GetCommandIdentifier(const PluginID & ID) // Get rid of leading and trailing white space name.Trim(true).Trim(false); - if (name == wxEmptyString) + if (name.empty()) { return name; } @@ -947,7 +947,7 @@ AudacityCommand *EffectManager::GetAudacityCommand(const PluginID & ID) const PluginID & EffectManager::GetEffectByIdentifier(const wxString & strTarget) { static PluginID empty; - if (strTarget == wxEmptyString) // set GetCommandIdentifier to wxT("") to not show an effect in Batch mode + if (strTarget.empty()) // set GetCommandIdentifier to wxT("") to not show an effect in Batch mode { return empty; } diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index ec51b90ce..821a40e38 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -649,7 +649,7 @@ bool NyquistEffect::Process() mProps += wxString::Format(wxT("(putprop '*AUDACITY* (list %d %d %d) 'VERSION)\n"), AUDACITY_VERSION, AUDACITY_RELEASE, AUDACITY_REVISION); wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT("")); - lang = (lang == wxEmptyString)? wxGetApp().InitLang(lang) : lang; + lang = (lang.empty())? wxGetApp().InitLang(lang) : lang; mProps += wxString::Format(wxT("(putprop '*AUDACITY* \"%s\" 'LANGUAGE)\n"), lang); mProps += wxString::Format(wxT("(setf *DECIMAL-SEPARATOR* #\\%c)\n"), wxNumberFormatter::GetDecimalSeparator()); @@ -2656,7 +2656,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S) item->SetValidator(wxGenericValidator(&ctrl.valStr)); item->SetName(prompt); - if (ctrl.label == wxEmptyString) + if (ctrl.label.empty()) // We'd expect wxFileSelectorPromptStr to already be translated, but apparently not. ctrl.label = wxGetTranslation( wxFileSelectorPromptStr ); S.Id(ID_FILE + i).AddButton(ctrl.label, wxALIGN_LEFT); @@ -2863,7 +2863,7 @@ void NyquistEffect::OnFileButton(wxCommandEvent& evt) // Basic sanity check of wildcard flags so that we // don't show scary wxFAIL_MSG from wxParseCommonDialogsFilter. - if (ctrl.lowStr != wxEmptyString) + if (!ctrl.lowStr.empty()) { bool validWildcards = true; size_t wildcards = 0; @@ -2871,7 +2871,7 @@ void NyquistEffect::OnFileButton(wxCommandEvent& evt) while (tokenizer.HasMoreTokens()) { wxString token = tokenizer.GetNextToken().Trim(true).Trim(false); - if (token == wxEmptyString) + if (token.empty()) { validWildcards = false; break; @@ -2891,7 +2891,7 @@ void NyquistEffect::OnFileButton(wxCommandEvent& evt) // Get style flags: // Ensure legal combinations so that wxWidgets does not throw an assert error. unsigned int flags = 0; - if (ctrl.highStr != wxEmptyString) + if (!ctrl.highStr.empty()) { wxStringTokenizer tokenizer(ctrl.highStr, ","); while ( tokenizer.HasMoreTokens() ) @@ -3020,7 +3020,7 @@ void NyquistEffect::resolveFilePath(wxString& path, wxString extension /* empty // If the directory is invalid, better to leave it as is (invalid) so that // the user sees the error rather than an unexpected file path. - if (fname.wxFileName::IsOk() && fname.GetFullName() == wxEmptyString) + if (fname.wxFileName::IsOk() && fname.GetFullName().empty()) { path = fname.GetPathWithSep() + _("untitled"); if (!extension.empty()) @@ -3036,7 +3036,7 @@ bool NyquistEffect::validatePath(wxString path) return (fname.wxFileName::IsOk() && wxFileName::DirExists(dir) && - fname.GetFullName() != wxEmptyString); + !fname.GetFullName().empty()); } diff --git a/src/import/Import.cpp b/src/import/Import.cpp index 42e3ec73f..831e6367f 100644 --- a/src/import/Import.cpp +++ b/src/import/Import.cpp @@ -179,7 +179,7 @@ void Importer::ReadImportItems() wxString delims(wxT(":")); StringToList (extensions, delims, new_item->extensions); - if (mime_types != wxEmptyString) + if (!mime_types.empty()) StringToList (mime_types, delims, new_item->mime_types); /* Filter token consists of used and unused filter lists */ @@ -190,7 +190,7 @@ void Importer::ReadImportItems() StringToList (used_filters, delims, new_item->filters); - if (unused_filters != wxEmptyString) + if (!unused_filters.empty()) { /* Filters are stored in one list, but the position at which * unused filters start is remembered diff --git a/src/prefs/KeyConfigPrefs.cpp b/src/prefs/KeyConfigPrefs.cpp index 56de93a0a..47f7ac179 100644 --- a/src/prefs/KeyConfigPrefs.cpp +++ b/src/prefs/KeyConfigPrefs.cpp @@ -472,7 +472,7 @@ void KeyConfigPrefs::OnFilterKeyDown(wxKeyEvent & e) wxString key = KeyEventToKeyString(e).Display(); t->SetValue(key); - if (key != wxEmptyString) { + if (!key.empty()) { mView->SetFilter(t->GetValue()); } } diff --git a/src/prefs/ModulePrefs.cpp b/src/prefs/ModulePrefs.cpp index 117511137..cb32eec5f 100644 --- a/src/prefs/ModulePrefs.cpp +++ b/src/prefs/ModulePrefs.cpp @@ -66,7 +66,7 @@ void ModulePrefs::GetAllModuleStatuses(){ gPrefs->Read( str, &iStatus, kModuleDisabled ); wxString fname; gPrefs->Read( wxString( wxT("/ModulePath/") ) + str, &fname, wxEmptyString ); - if( fname != wxEmptyString && wxFileExists( fname ) ){ + if( !fname.empty() && wxFileExists( fname ) ){ if( iStatus > kModuleNew ){ iStatus = kModuleNew; gPrefs->Write( str, iStatus ); diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index b5d4804b1..365100690 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -115,7 +115,7 @@ int wxTreebookExt::SetSelection(size_t n) static_cast(GetParent())->SetName( Temp ); PrefsPanel *const panel = static_cast(GetPage(n)); - const bool showHelp = (panel->HelpPageName() != wxEmptyString); + const bool showHelp = (!panel->HelpPageName().empty()); const bool showPreview = panel->ShowsPreviewButton(); wxWindow *const helpButton = wxWindow::FindWindowById(wxID_HELP, GetParent()); wxWindow *const previewButton = wxWindow::FindWindowById(wxID_PREVIEW, GetParent()); diff --git a/src/widgets/KeyView.cpp b/src/widgets/KeyView.cpp index 520263d77..157a45f1b 100644 --- a/src/widgets/KeyView.cpp +++ b/src/widgets/KeyView.cpp @@ -582,7 +582,7 @@ KeyView::RefreshBindings(const wxArrayString & names, lastcat = cat; // Add a NEW category node - if (cat != wxEmptyString) + if (!cat.empty()) { KeyNode node; @@ -622,7 +622,7 @@ KeyView::RefreshBindings(const wxArrayString & names, lastpfx = pfx; // Add a NEW prefix node - if (pfx != wxEmptyString) + if (!pfx.empty()) { KeyNode node; diff --git a/src/widgets/ProgressDialog.cpp b/src/widgets/ProgressDialog.cpp index 930a2bb85..323043262 100644 --- a/src/widgets/ProgressDialog.cpp +++ b/src/widgets/ProgressDialog.cpp @@ -1240,7 +1240,7 @@ bool ProgressDialog::Create(const wxString & title, // Customised "Remaining" label text wxString sRemainingText = sRemainingLabelText; - if (sRemainingText == wxEmptyString) { + if (sRemainingText.empty()) { sRemainingText = _("Remaining Time:"); }