Replace comparisons against wxEmptyString with empty()

This commit is contained in:
Paul Licameli 2019-03-14 16:20:18 -04:00
parent 50074f2cfe
commit b8c0125143
17 changed files with 29 additions and 29 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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"),

View File

@ -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()))),

View File

@ -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("|");
}

View File

@ -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");
}

View File

@ -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;

View File

@ -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 ){

View File

@ -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(""));
}

View File

@ -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;
}

View File

@ -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());
}

View File

@ -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

View File

@ -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());
}
}

View File

@ -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 );

View File

@ -115,7 +115,7 @@ int wxTreebookExt::SetSelection(size_t n)
static_cast<wxDialog*>(GetParent())->SetName( Temp );
PrefsPanel *const panel = static_cast<PrefsPanel *>(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());

View File

@ -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;

View File

@ -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:");
}