From 6636ef8ddf9eda0d0352c29d98cb141676a51a2d Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Sat, 22 Jan 2011 14:38:36 +0000 Subject: [PATCH] Use wxString's empty() when checking if the string is (non-)empty throughout wx. Instead of constructs such as if "( s.length() )" and "if (s.length() > 0)" use "if ( !s.empty() )" instead. Similarly for "if (s.length() == 0)" or "if ( s.IsNull() )", use "if ( s.empty() )". No code changes intended except for a few instances where a construct like "if ( s.length() && wxFileExists(s) )" was changed to not check the length of the string and let wxFileExists handle such cases. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- demos/forty/canvas.cpp | 12 ++++++------ demos/forty/playerdg.cpp | 2 +- include/wx/propgrid/props.h | 2 +- samples/aui/auidemo.cpp | 2 +- samples/propgrid/propgrid.cpp | 2 +- samples/propgrid/sampleprops.cpp | 2 +- samples/widgets/bmpcombobox.cpp | 2 +- src/common/bmpcboxcmn.cpp | 2 +- src/common/combocmn.cpp | 2 +- src/common/dcgraph.cpp | 4 ++-- src/common/filesys.cpp | 2 +- src/common/fs_arc.cpp | 2 +- src/common/http.cpp | 6 +++--- src/common/imaggif.cpp | 2 +- src/common/stringimpl.cpp | 6 +++--- src/common/translation.cpp | 2 +- src/common/url.cpp | 2 +- src/common/xtixml.cpp | 2 +- src/generic/fontdlgg.cpp | 6 +++--- src/generic/helpext.cpp | 2 +- src/generic/odcombo.cpp | 2 +- src/gtk1/combobox.cpp | 2 +- src/gtk1/mdi.cpp | 2 +- src/motif/filedlg.cpp | 2 +- src/motif/textctrl.cpp | 2 +- src/msw/metafile.cpp | 8 ++++---- src/msw/ole/automtn.cpp | 4 ++-- src/os2/dialog.cpp | 2 +- src/os2/metafile.cpp | 2 +- src/os2/toolbar.cpp | 8 ++++---- src/osx/carbon/dataobj.cpp | 2 +- src/osx/carbon/filedlg.cpp | 4 ++-- src/osx/core/mimetype.cpp | 2 +- src/propgrid/advprops.cpp | 10 +++++----- src/propgrid/editors.cpp | 8 ++++---- src/propgrid/manager.cpp | 2 +- src/propgrid/property.cpp | 16 ++++++++-------- src/propgrid/propgrid.cpp | 20 ++++++++++---------- src/propgrid/propgridiface.cpp | 8 ++++---- src/propgrid/propgridpagestate.cpp | 12 ++++++------ src/propgrid/props.cpp | 30 +++++++++++++++--------------- src/richtext/richtextbuffer.cpp | 4 ++-- src/stc/ScintillaWX.cpp | 2 +- src/unix/dialup.cpp | 6 +++--- src/unix/net.cpp | 12 ++++++------ src/x11/textctrl.cpp | 2 +- utils/wxrc/wxrc.cpp | 4 ++-- 47 files changed, 121 insertions(+), 121 deletions(-) diff --git a/demos/forty/canvas.cpp b/demos/forty/canvas.cpp index 4fd11dc2fa..7667fb43ba 100644 --- a/demos/forty/canvas.cpp +++ b/demos/forty/canvas.cpp @@ -53,7 +53,7 @@ FortyCanvas::FortyCanvas(wxWindow* parent, const wxPoint& pos, const wxSize& siz m_arrowCursor = new wxCursor(wxCURSOR_ARROW); wxString name = wxTheApp->GetAppName(); - if (name.Length() <= 0) name = wxT("forty"); + if ( name.empty() ) name = wxT("forty"); m_scoreFile = new ScoreFile(name); m_game = new Game(0, 0, 0); m_game->Deal(); @@ -75,7 +75,7 @@ Write the current player's score back to the score file */ void FortyCanvas::UpdateScores() { - if (m_player.Length() > 0 && m_scoreFile && m_game) + if (!m_player.empty() && m_scoreFile && m_game) { m_scoreFile->WritePlayersScore( m_player, @@ -94,12 +94,12 @@ void FortyCanvas::OnDraw(wxDC& dc) #if 0 // if player name not set (and selection dialog is not displayed) // then ask the player for their name - if (m_player.Length() == 0 && !m_playerDialog) + if (m_player.empty() && !m_playerDialog) { m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile); m_playerDialog->ShowModal(); m_player = m_playerDialog->GetPlayersName(); - if (m_player.Length() > 0) + if ( !m_player.empty() ) { // user entered a name - lookup their score int wins, games, score; @@ -123,12 +123,12 @@ void FortyCanvas::ShowPlayerDialog() { // if player name not set (and selection dialog is not displayed) // then ask the player for their name - if (m_player.Length() == 0 && !m_playerDialog) + if (m_player.empty() && !m_playerDialog) { m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile); m_playerDialog->ShowModal(); m_player = m_playerDialog->GetPlayersName(); - if (m_player.Length() > 0) + if ( !m_player.empty() ) { // user entered a name - lookup their score int wins, games, score; diff --git a/demos/forty/playerdg.cpp b/demos/forty/playerdg.cpp index 7f5effaa32..b1b1f71e07 100644 --- a/demos/forty/playerdg.cpp +++ b/demos/forty/playerdg.cpp @@ -114,7 +114,7 @@ void PlayerSelectionDialog::ButtonCallback(wxCommandEvent& event) if (event.GetId() == wxID_OK) { wxString name = m_textField->GetValue(); - if (!name.IsNull() && name.Length() > 0) + if ( !name.empty() ) { if (name.Contains(wxT('@'))) { diff --git a/include/wx/propgrid/props.h b/include/wx/propgrid/props.h index a260605ade..77470cda2c 100644 --- a/include/wx/propgrid/props.h +++ b/include/wx/propgrid/props.h @@ -997,7 +997,7 @@ public: void SetCustomButton( const wxString& custBtText, wxArrayStringProperty* pcc ) { - if ( custBtText.length() ) + if ( !custBtText.empty() ) { EnableCustomNewAction(); m_pCallingClass = pcc; diff --git a/samples/aui/auidemo.cpp b/samples/aui/auidemo.cpp index 570138976d..ee0b86ef95 100644 --- a/samples/aui/auidemo.cpp +++ b/samples/aui/auidemo.cpp @@ -1548,7 +1548,7 @@ wxTextCtrl* MyFrame::CreateTextCtrl(const wxString& ctrl_text) static int n = 0; wxString text; - if (ctrl_text.Length() > 0) + if ( !ctrl_text.empty() ) text = ctrl_text; else text.Printf(wxT("This is text box %d"), ++n); diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 99586e6e30..bff02063b4 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -322,7 +322,7 @@ public: wxString s = ::wxGetSingleChoice(wxT("Message"), wxT("Caption"), m_choices.GetLabels()); - if ( s.length() ) + if ( !s.empty() ) { SetValue(s); return true; diff --git a/samples/propgrid/sampleprops.cpp b/samples/propgrid/sampleprops.cpp index c807e9c974..cc68db21f6 100644 --- a/samples/propgrid/sampleprops.cpp +++ b/samples/propgrid/sampleprops.cpp @@ -618,7 +618,7 @@ bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& t WX_PG_TOKENIZER1_BEGIN(text,delimiter) - if ( token.length() ) + if ( !token.empty() ) { // If token was invalid, exit the loop now diff --git a/samples/widgets/bmpcombobox.cpp b/samples/widgets/bmpcombobox.cpp index 8fa31d0568..33276957fc 100644 --- a/samples/widgets/bmpcombobox.cpp +++ b/samples/widgets/bmpcombobox.cpp @@ -884,7 +884,7 @@ wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr) ::wxSetCursor( *wxHOURGLASS_CURSOR ); - if ( filepath.length() ) + if ( !filepath.empty() ) { if ( pStr ) { diff --git a/src/common/bmpcboxcmn.cpp b/src/common/bmpcboxcmn.cpp index fc403b7135..c4c963dff4 100644 --- a/src/common/bmpcboxcmn.cpp +++ b/src/common/bmpcboxcmn.cpp @@ -222,7 +222,7 @@ void wxBitmapComboBoxBase::DrawItem(wxDC& dc, true); } - if ( text.length() ) + if ( !text.empty() ) dc.DrawText(text, rect.x + m_imgAreaWidth + 1, rect.y + (rect.height-dc.GetCharHeight())/2); diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 7d41ea207a..ccabb7277e 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -2130,7 +2130,7 @@ void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) } // This must be done after creation - if ( m_valueString.length() ) + if ( !m_valueString.empty() ) { iface->SetStringValue(m_valueString); //Refresh(); diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 9a48f94a75..49ca99e048 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -945,7 +945,7 @@ void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") ); - if ( str.length() == 0 ) + if ( str.empty() ) return; if ( !m_logicalFunctionSupported ) return; @@ -960,7 +960,7 @@ void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawText - invalid DC") ); - if ( str.length() == 0 ) + if ( str.empty() ) return; if ( !m_logicalFunctionSupported ) diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index 65fe27f61e..bf6fbc2efe 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -355,7 +355,7 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir) if (is_dir) { - if (m_Path.length() > 0 && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':')) + if (!m_Path.empty() && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':')) m_Path << wxT('/'); } diff --git a/src/common/fs_arc.cpp b/src/common/fs_arc.cpp index 7203354982..6007d08ab1 100644 --- a/src/common/fs_arc.cpp +++ b/src/common/fs_arc.cpp @@ -358,7 +358,7 @@ wxFSFile* wxArchiveFSHandler::OpenFile( right = rightPart.GetFullPath(wxPATH_UNIX); } - if (right.Length() && right.GetChar(0) == wxT('/')) right = right.Mid(1); + if (!right.empty() && right.GetChar(0) == wxT('/')) right = right.Mid(1); if (!m_cache) m_cache = new wxArchiveFSCache; diff --git a/src/common/http.cpp b/src/common/http.cpp index 4af87f6d24..e238364ece 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -225,7 +225,7 @@ bool wxHTTP::ParseHeaders() if (m_lastError != wxPROTO_NOERR) return false; - if (line.length() == 0) + if ( line.empty() ) break; wxString left_str = line.BeforeFirst(':'); @@ -312,7 +312,7 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) case wxHTTP_POST: request = wxT("POST"); - if ( GetHeader( wxT("Content-Length") ).IsNull() ) + if ( GetHeader( wxT("Content-Length") ).empty() ) SetHeader( wxT("Content-Length"), wxString::Format( wxT("%lu"), (unsigned long)m_post_buf.Len() ) ); break; @@ -323,7 +323,7 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) m_http_response = 0; // If there is no User-Agent defined, define it. - if (GetHeader(wxT("User-Agent")).IsNull()) + if ( GetHeader(wxT("User-Agent")).empty() ) SetHeader(wxT("User-Agent"), wxT("wxWidgets 2.x")); // Send authentication information diff --git a/src/common/imaggif.cpp b/src/common/imaggif.cpp index b0c4399d9c..e07eb27cb0 100644 --- a/src/common/imaggif.cpp +++ b/src/common/imaggif.cpp @@ -672,7 +672,7 @@ bool wxGIFHandler_WriteHeader(wxOutputStream *stream, int width, int height, ok = ok && wxGIFHandler_WriteLoop(stream); } - if (comment.length()) + if ( !comment.empty() ) { ok = ok && wxGIFHandler_WriteComment(stream, comment); } diff --git a/src/common/stringimpl.cpp b/src/common/stringimpl.cpp index 429f3843bd..ed9a83e476 100644 --- a/src/common/stringimpl.cpp +++ b/src/common/stringimpl.cpp @@ -395,14 +395,14 @@ bool wxStringImpl::Alloc(size_t nLen) wxStringImpl::iterator wxStringImpl::begin() { - if (length() > 0) + if ( !empty() ) CopyBeforeWrite(); return m_pchData; } wxStringImpl::iterator wxStringImpl::end() { - if (length() > 0) + if ( !empty() ) CopyBeforeWrite(); return m_pchData + length(); } @@ -528,7 +528,7 @@ size_t wxStringImpl::rfind(const wxStringImpl& str, size_t nStart) const if ( length() >= str.length() ) { // avoids a corner case later - if ( length() == 0 && str.length() == 0 ) + if ( empty() && str.empty() ) return 0; // "top" is the point where search starts from diff --git a/src/common/translation.cpp b/src/common/translation.cpp index c00339d7a5..6b54200b85 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -1741,7 +1741,7 @@ wxArrayString wxFileTranslationsLoader::GetAvailableTranslations(const wxString& i != prefixes.end(); ++i ) { - if (i->length() == 0) + if ( i->empty() ) continue; wxDir dir; if ( !dir.Open(*i) ) diff --git a/src/common/url.cpp b/src/common/url.cpp index c0fb31cac2..15b9311839 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -251,7 +251,7 @@ bool wxURL::FetchProtocol() { if (m_scheme == info->m_protoname) { - if (m_port.IsNull()) + if ( m_port.empty() ) m_port = info->m_servname; m_protoinfo = info; m_protocol = (wxProtocol *)m_protoinfo->m_cinfo->CreateObject(); diff --git a/src/common/xtixml.cpp b/src/common/xtixml.cpp index f6f2da545f..2db3aac9b2 100644 --- a/src/common/xtixml.cpp +++ b/src/common/xtixml.cpp @@ -399,7 +399,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectReaderCallback *ca // properties were written in the xml for ( size_t j = 0; j < propertyNames.size(); ++j ) { - if ( propertyNames[j].length() ) + if ( !propertyNames[j].empty() ) { PropertyNodes::iterator propiter = propertyNodes.find( propertyNames[j] ); if ( propiter != propertyNodes.end() ) diff --git a/src/generic/fontdlgg.cpp b/src/generic/fontdlgg.cpp index be55ed2c08..2a986588cf 100644 --- a/src/generic/fontdlgg.cpp +++ b/src/generic/fontdlgg.cpp @@ -506,10 +506,10 @@ void wxGenericFontDialog::CreateWidgets() if (m_colourChoice) { wxString name(wxTheColourDatabase->FindName(m_fontData.GetColour())); - if (name.length()) - m_colourChoice->SetStringSelection(name); - else + if ( name.empty() ) m_colourChoice->SetStringSelection(wxT("BLACK")); + else + m_colourChoice->SetStringSelection(name); } if (m_underLineCheckBox) diff --git a/src/generic/helpext.cpp b/src/generic/helpext.cpp index efd0df5116..63f1b4c4b8 100644 --- a/src/generic/helpext.cpp +++ b/src/generic/helpext.cpp @@ -339,7 +339,7 @@ bool wxExtHelpController::DisplayContents() file << m_helpDir << wxFILE_SEP_PATH << contents; if (file.Contains(wxT('#'))) file = file.BeforeLast(wxT('#')); - if (contents.length() && wxFileExists(file)) + if ( wxFileExists(file) ) rc = DisplaySection(WXEXTHELP_CONTENTS_ID); // if not found, open homemade toc: diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index b9818d560c..06ca2e58a5 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -865,7 +865,7 @@ void wxVListBoxComboPopup::Populate( const wxArrayString& choices ) // Find initial selection wxString strValue = m_combo->GetValue(); - if ( strValue.length() ) + if ( !strValue.empty() ) m_value = m_strings.Index(strValue); } diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 515f0c8c65..48221babd6 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -744,7 +744,7 @@ void wxComboBox::Replace( long from, long to, const wxString& value ) GtkWidget *entry = GTK_COMBO(m_widget)->entry; gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to ); - if (value.IsNull()) return; + if ( value.empty() ) return; gint pos = (gint)to; #if wxUSE_UNICODE diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index e2cb0b3765..d8c711c8a5 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -429,7 +429,7 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* child ) { wxString s = child->GetTitle(); - if (s.IsNull()) s = _("MDI child"); + if ( s.empty() ) s = _("MDI child"); GtkWidget *label_widget = gtk_label_new( s.mbc_str() ); gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); diff --git a/src/motif/filedlg.cpp b/src/motif/filedlg.cpp index 87d267cbd9..e2da28904a 100644 --- a/src/motif/filedlg.cpp +++ b/src/motif/filedlg.cpp @@ -228,7 +228,7 @@ int wxFileDialog::ShowModal() Widget shell = XtParent(fileSel); - if (!m_message.IsNull()) + if ( !m_message.empty() ) XtVaSetValues(shell, XmNtitle, (const char*)m_message.mb_str(), NULL); diff --git a/src/motif/textctrl.cpp b/src/motif/textctrl.cpp index 2da2f34990..f637e1fa42 100644 --- a/src/motif/textctrl.cpp +++ b/src/motif/textctrl.cpp @@ -161,7 +161,7 @@ bool wxTextCtrl::Create(wxWindow *parent, #if 0 // TODO: Is this relevant? What does it do? int noCols = 2; - if (!value.IsNull() && (value.length() > (unsigned int) noCols)) + if (!value.empty() && (value.length() > (unsigned int) noCols)) noCols = value.length(); XtVaSetValues((Widget) m_mainWidget, XmNcolumns, noCols, diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index e20f24a5b4..843983b43a 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -177,13 +177,13 @@ wxMetafileDCImpl::wxMetafileDCImpl(wxDC *owner, const wxString& file) m_maxY = -10000; // m_title = NULL; - if (!file.IsNull() && wxFileExists(file)) + if ( wxFileExists(file) ) wxRemoveFile(file); - if (!file.IsNull() && (file != wxEmptyString)) - m_hDC = (WXHDC) CreateMetaFile(file); - else + if ( file.empty() ) m_hDC = (WXHDC) CreateMetaFile(NULL); + else + m_hDC = (WXHDC) CreateMetaFile(file); m_ok = (m_hDC != (WXHDC) 0) ; diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index db0df28fb2..dce44ebc5a 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -109,7 +109,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, int namedArgCount = 0; int i; for (i = 0; i < noArgs; i++) - if (!INVOKEARG(i).GetName().IsNull()) + if ( !INVOKEARG(i).GetName().empty() ) { namedArgCount ++; } @@ -124,7 +124,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, int j = 0; for (i = 0; i < namedArgCount; i++) { - if (!INVOKEARG(i).GetName().IsNull()) + if ( !INVOKEARG(i).GetName().empty() ) { argNames[(namedArgCount-j)] = wxConvertStringToOle(INVOKEARG(i).GetName()); j ++; diff --git a/src/os2/dialog.cpp b/src/os2/dialog.cpp index cd8721178d..278b22752f 100644 --- a/src/os2/dialog.cpp +++ b/src/os2/dialog.cpp @@ -114,7 +114,7 @@ bool wxDialog::Create( wxWindow* pParent, // // Must defer setting the title until after dialog is created and sized // - if (!rsTitle.IsNull()) + if ( !rsTitle.empty() ) SetTitle(rsTitle); return true; } // end of wxDialog::Create diff --git a/src/os2/metafile.cpp b/src/os2/metafile.cpp index 755d4658cc..04ac44c04a 100644 --- a/src/os2/metafile.cpp +++ b/src/os2/metafile.cpp @@ -142,7 +142,7 @@ wxMetafileDCImpl::wxMetafileDCImpl(wxDC *owner, const wxString& file) m_maxY = -10000; // m_title = NULL; - if (!file.IsNull() && wxFileExists(file)) + if ( wxFileExists(file) ) wxRemoveFile(file); // TODO diff --git a/src/os2/toolbar.cpp b/src/os2/toolbar.cpp index 4bfe61fc7e..9a802aa710 100644 --- a/src/os2/toolbar.cpp +++ b/src/os2/toolbar.cpp @@ -545,7 +545,7 @@ bool wxToolBar::Realize() m_vLastY = m_yMargin; } pTool->m_vX = m_vLastX + pTool->GetWidth(); - if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull()) + if ( HasFlag(wxTB_TEXT) && !pTool->GetLabel().empty() ) pTool->m_vY = m_vLastY + (nMaxToolHeight - m_vTextY) + m_toolPacking; else pTool->m_vY = m_vLastY + (nMaxToolHeight - (int)(pTool->GetHeight()/2)); @@ -858,7 +858,7 @@ void wxToolBar::DrawTool( wxDC& rDc, wxToolBarToolBase* pToolBase ) { RaiseTool(pTool); } - if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull()) + if ( HasFlag(wxTB_TEXT) && !pTool->GetLabel().empty() ) { wxCoord vX; wxCoord vY; @@ -903,7 +903,7 @@ void wxToolBar::DrawTool( wxDC& rDc, wxToolBarToolBase* pToolBase ) ,pTool->m_vY ,bUseMask ); - if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull()) + if ( HasFlag(wxTB_TEXT) && !pTool->GetLabel().empty() ) { wxCoord vX; wxCoord vY; @@ -953,7 +953,7 @@ wxToolBarToolBase* wxToolBar::FindToolForPosition( { wxToolBarTool* pTool = (wxToolBarTool *)node->GetData(); - if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull()) + if ( HasFlag(wxTB_TEXT) && !pTool->GetLabel().empty() ) { if ((vX >= (pTool->m_vX - ((wxCoord)(pTool->GetWidth()/2) - 2))) && (vY >= (pTool->m_vY - 2)) && diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index bfb10702be..2820e47c45 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -472,7 +472,7 @@ bool wxDataObject::GetFromPasteboard( void * pb ) } CFRelease( flavorTypeArray ); } - if (filenamesPassed.length() > 0) + if ( !filenamesPassed.empty() ) { wxCharBuffer buf = filenamesPassed.fn_str(); SetData( wxDF_FILENAME, strlen( buf ), (const char*)buf ); diff --git a/src/osx/carbon/filedlg.cpp b/src/osx/carbon/filedlg.cpp index c6503c8b91..9592010d29 100644 --- a/src/osx/carbon/filedlg.cpp +++ b/src/osx/carbon/filedlg.cpp @@ -324,11 +324,11 @@ void OpenUserDataRec::MakeUserDataRec( const wxString& filter ) wxString extension = m_extensions[i]; // Remove leading '*' - if (extension.length() && (extension.GetChar(0) == '*')) + if ( !extension.empty() && (extension.GetChar(0) == '*') ) extension = extension.Mid( 1 ); // Remove leading '.' - if (extension.length() && (extension.GetChar(0) == '.')) + if ( !extension.empty() && (extension.GetChar(0) == '.') ) extension = extension.Mid( 1 ); if (wxFileName::MacFindDefaultTypeAndCreator( extension, &fileType, &creator )) diff --git a/src/osx/core/mimetype.cpp b/src/osx/core/mimetype.cpp index 5a6e534d5a..c2661e22b0 100644 --- a/src/osx/core/mimetype.cpp +++ b/src/osx/core/mimetype.cpp @@ -577,7 +577,7 @@ bool wxMimeTypesManagerImpl::GetDescription(const wxString& uti, wxString *desc) { const UtiMap::const_iterator itr = m_utiMap.find( uti ); - if( itr == m_utiMap.end() || itr->second.description.IsNull() ) + if( itr == m_utiMap.end() || itr->second.description.empty() ) { *desc = wxEmptyString; return false; diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 2d3a67f101..907eceec53 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -634,7 +634,7 @@ wxFontProperty::wxFontProperty( const wxString& label, const wxString& name, wxString faceName = font.GetFaceName(); // If font was not in there, add it now - if ( faceName.length() && + if ( !faceName.empty() && wxPGGlobalVars->m_fontFamilyChoices->Index(faceName) == wxNOT_FOUND ) wxPGGlobalVars->m_fontFamilyChoices->AddAsSorted(faceName); @@ -797,7 +797,7 @@ void wxFontProperty::OnCustomPaint(wxDC& dc, else drawFace = m_value_wxFont.GetFaceName(); - if ( drawFace.length() ) + if ( !drawFace.empty() ) { // Draw the background dc.SetBrush( wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)) ); @@ -1782,7 +1782,7 @@ void wxCursorProperty::OnCustomPaint( wxDC&, const wxRect&, wxPGPaintData& ) { } const wxString& wxPGGetDefaultImageWildcard() { // Form the wildcard, if not done yet - if ( !wxPGGlobalVars->m_pDefaultImageWildcard.length() ) + if ( wxPGGlobalVars->m_pDefaultImageWildcard.empty() ) { wxString str; @@ -2179,7 +2179,7 @@ wxString wxDateProperty::ValueToString( wxVariant& value, if ( !dateTime.IsValid() ) return wxT("Invalid"); - if ( !ms_defaultDateFormat.length() ) + if ( ms_defaultDateFormat.empty() ) { #if wxUSE_DATEPICKCTRL bool showCentury = m_dpStyle & wxDP_SHOWCENTURY ? true : false; @@ -2189,7 +2189,7 @@ wxString wxDateProperty::ValueToString( wxVariant& value, ms_defaultDateFormat = DetermineDefaultDateFormat( showCentury ); } - if ( m_format.length() && + if ( !m_format.empty() && !(argFlags & wxPG_FULL_VALUE) ) format = m_format.c_str(); diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 850016e812..ec61a88ac6 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -444,7 +444,7 @@ bool wxPGTextCtrlEditor::GetTextCtrlValueFromControl( wxVariant& variant, wxPGPr wxTextCtrl* tc = wxStaticCast(ctrl, wxTextCtrl); wxString textVal = tc->GetValue(); - if ( property->UsesAutoUnspecified() && !textVal.length() ) + if ( property->UsesAutoUnspecified() && textVal.empty() ) { variant.MakeNull(); return true; @@ -1070,10 +1070,10 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid, if ( index >= 0 && index < (int)cb->GetCount() ) { cb->SetSelection( index ); - if ( defString.length() ) + if ( !defString.empty() ) cb->SetText( defString ); } - else if ( !(extraStyle & wxCB_READONLY) && defString.length() ) + else if ( !(extraStyle & wxCB_READONLY) && !defString.empty() ) { propGrid->SetupTextCtrlValue(defString); cb->SetValue( defString ); @@ -1283,7 +1283,7 @@ bool wxPGComboBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty* wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl; wxString textVal = cb->GetValue(); - if ( property->UsesAutoUnspecified() && !textVal.length() ) + if ( property->UsesAutoUnspecified() && textVal.empty() ) { variant.MakeNull(); return true; diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index 1b4bf21bb0..2030ec2ea3 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -986,7 +986,7 @@ wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index, state->InitNonCatMode(); } - if ( label.length() ) + if ( !label.empty() ) { wxASSERT_MSG( !pageObj->m_label.length(), wxT("If page label is given in constructor, empty label must be given in AddPage")); diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 37edd533d9..4a90d9ab3b 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -206,7 +206,7 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect, { text = propertyGrid->GetCommonValueLabel(cmnVal); DrawText( dc, rect, 0, text ); - if ( text.length() ) + if ( !text.empty() ) return true; } return false; @@ -258,15 +258,15 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect, if ( propertyGrid->GetColumnCount() <= 2 ) { wxString unitsString = property->GetAttribute(wxPGGlobalVars->m_strUnits, wxEmptyString); - if ( unitsString.length() ) + if ( !unitsString.empty() ) text = wxString::Format(wxS("%s %s"), text.c_str(), unitsString.c_str() ); } } - if ( text.length() == 0 ) + if ( text.empty() ) { text = property->GetHintText(); - if ( text.length() > 0 ) + if ( !text.empty() ) { res = true; @@ -715,7 +715,7 @@ wxString wxPGProperty::GetName() const { wxPGProperty* parent = GetParent(); - if ( !m_name.length() || !parent || parent->IsCategory() || parent->IsRoot() ) + if ( m_name.empty() || !parent || parent->IsCategory() || parent->IsRoot() ) return m_name; return m_parent->GetName() + wxS(".") + m_name; @@ -924,7 +924,7 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text, (*childResults)[curChild->GetName()] = s; bool skip = false; - if ( (argFlags & wxPG_UNEDITABLE_COMPOSITE_FRAGMENT) && !s.length() ) + if ( (argFlags & wxPG_UNEDITABLE_COMPOSITE_FRAGMENT) && s.empty() ) skip = true; if ( !curChild->GetChildCount() || skip ) @@ -1172,7 +1172,7 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int token = text.substr(startPos,pos-startPos-1); - if ( !token.length() ) + if ( token.empty() ) break; const wxPGProperty* child = Item(curChild); @@ -1848,7 +1848,7 @@ wxString wxPGProperty::GetFlagsAsString( FlagType flagsMask ) const { const wxChar* fs = gs_propFlagToString[i]; wxASSERT(fs); - if ( s.length() ) + if ( !s.empty() ) s << wxS("|"); s << fs; } diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index fac6436c3b..c494ce97fa 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1688,7 +1688,7 @@ wxPoint wxPropertyGrid::GetGoodEditorDialogPosition( wxPGProperty* p, wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& src_str ) { - if ( src_str.length() == 0 ) + if ( src_str.empty() ) { dst_str = src_str; return src_str; @@ -1747,7 +1747,7 @@ wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& sr wxString& wxPropertyGrid::CreateEscapeSequences( wxString& dst_str, wxString& src_str ) { - if ( src_str.length() == 0 ) + if ( src_str.empty() ) { dst_str = src_str; return src_str; @@ -3162,7 +3162,7 @@ wxStatusBar* wxPropertyGrid::GetStatusBar() void wxPropertyGrid::DoShowPropertyError( wxPGProperty* WXUNUSED(property), const wxString& msg ) { - if ( !msg.length() ) + if ( msg.empty() ) return; #if wxUSE_STATUSBAR @@ -3290,7 +3290,7 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W { wxString msg = m_validationInfo.m_failureMessage; - if ( !msg.length() ) + if ( msg.empty() ) msg = _("You have entered invalid value. Press ESC to cancel editing."); #if wxUSE_STATUSBAR @@ -4339,7 +4339,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) wxStatusBar* statusbar = GetStatusBar(); if ( statusbar ) { - if ( pHelpString && pHelpString->length() ) + if ( pHelpString && !pHelpString->empty() ) { // Set help box text. statusbar->SetStatusText( *pHelpString ); @@ -4361,7 +4361,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) // // Show help as a tool tip on the editor control. // - if ( pHelpString && pHelpString->length() && + if ( pHelpString && !pHelpString->empty() && primaryCtrl ) { primaryCtrl->SetToolTip(*pHelpString); @@ -6020,7 +6020,7 @@ wxPGEditor* wxPropertyGrid::DoRegisterEditorClass( wxPGEditor* editorClass, RegisterDefaultEditors(); wxString name = editorName; - if ( name.length() == 0 ) + if ( name.empty() ) name = editorClass->GetName(); // Existing editor under this name? @@ -6421,7 +6421,7 @@ wxPGChoices wxPropertyGridPopulator::ParseChoices( const wxString& choicesString else { bool found = false; - if ( idString.length() ) + if ( !idString.empty() ) { wxPGHashMapS2P::iterator it = m_dictIdChoices.find(idString); if ( it != m_dictIdChoices.end() ) @@ -6497,7 +6497,7 @@ wxPGChoices wxPropertyGridPopulator::ParseChoices( const wxString& choicesString } // Assign to id - if ( idString.length() ) + if ( !idString.empty() ) m_dictIdChoices[idString] = choices.GetData(); } } @@ -6538,7 +6538,7 @@ bool wxPropertyGridPopulator::AddAttribute( const wxString& name, wxString valuel = value.Lower(); wxVariant variant; - if ( type.length() == 0 ) + if ( type.empty() ) { long v; diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index f8aab46507..5f66781a81 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -699,7 +699,7 @@ void wxPropertyGridInterface::SetPropertyCell( wxPGPropArg id, wxPG_PROP_ARG_CALL_PROLOG() wxPGCell& cell = p->GetCell(column); - if ( text.length() && text != wxPG_LABEL ) + if ( !text.empty() && text != wxPG_LABEL ) cell.SetText(text); if ( bitmap.IsOk() ) cell.SetBitmap(bitmap); @@ -932,7 +932,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const } // Remove last '|' - if ( result.length() ) + if ( !result.empty() ) result.RemoveLast(); return result; @@ -1034,13 +1034,13 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res { if ( pageState->IsDisplayed() ) { - if ( values[0].length() ) + if ( !values[0].empty() ) newSelection = GetPropertyByName(value); pgSelectionSet = true; } else { - if ( values[0].length() ) + if ( !values[0].empty() ) pageState->DoSetSelection(GetPropertyByName(value)); else pageState->DoClearSelection(); diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 8ec1e3a1a5..ec33107255 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -477,9 +477,9 @@ void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty* p, if ( parent->IsCategory() || parent->IsRoot() ) { - if ( p->GetBaseName().length() ) + if ( !p->GetBaseName().empty() ) m_dictName.erase( p->GetBaseName() ); - if ( newName.length() ) + if ( !newName.empty() ) m_dictName[newName] = (void*) p; } @@ -1498,7 +1498,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx wxASSERT( wxStrcmp(current->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 ); const wxString& name = current->GetName(); - if ( name.length() > 0 ) + if ( !name.empty() ) { // // '@' signified a special entry @@ -1557,7 +1557,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx wxVariant *current = (wxVariant*)*node; const wxString& name = current->GetName(); - if ( name.length() > 0 ) + if ( !name.empty() ) { // // '@' signified a special entry @@ -1782,7 +1782,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index } // Only add name to hashmap if parent is root or category - if ( property->m_name.length() && + if ( !property->m_name.empty() && (parentIsCategory || parentIsRoot) ) m_dictName[property->m_name] = (void*) property; @@ -1919,7 +1919,7 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete ) } } - if ( item->GetBaseName().length() && + if ( !item->GetBaseName().empty() && (parent->IsCategory() || parent->IsRoot()) ) m_dictName.erase(item->GetBaseName()); diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index c6e5d13527..c9a5a6c73e 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -210,7 +210,7 @@ bool wxNumericPropertyValidator::Validate(wxWindow* parent) wxTextCtrl* tc = static_cast(wnd); wxString text = tc->GetValue(); - if ( !text.length() ) + if ( text.empty() ) return false; return true; @@ -260,7 +260,7 @@ bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, int wxString s; long value32; - if ( text.length() == 0 ) + if ( text.empty() ) { variant.MakeNull(); return true; @@ -539,7 +539,7 @@ bool wxUIntProperty::StringToValue( wxVariant& variant, const wxString& text, in wxString variantType = variant.GetType(); bool isPrevLong = variantType == wxPG_VARIANT_TYPE_LONG; - if ( text.length() == 0 ) + if ( text.empty() ) { variant.MakeNull(); return true; @@ -682,7 +682,7 @@ const wxString& wxPropertyGrid::DoubleToString(wxString& target, if (!precTemplate) precTemplate = &text1; - if ( !precTemplate->length() ) + if ( precTemplate->empty() ) { *precTemplate = wxS("%."); *precTemplate << wxString::Format( wxS("%i"), precision ); @@ -696,7 +696,7 @@ const wxString& wxPropertyGrid::DoubleToString(wxString& target, target.Printf( wxS("%f"), value ); } - if ( removeZeroes && precision != 0 && target.length() ) + if ( removeZeroes && precision != 0 && !target.empty() ) { // Remove excess zeroes (do not remove this code just yet, // since sprintf can't do the same consistently across platforms). @@ -760,7 +760,7 @@ bool wxFloatProperty::StringToValue( wxVariant& variant, const wxString& text, i wxString s; double value; - if ( text.length() == 0 ) + if ( text.empty() ) { variant.MakeNull(); return true; @@ -914,7 +914,7 @@ bool wxBoolProperty::StringToValue( wxVariant& variant, const wxString& text, in text.CmpNoCase(m_label) == 0 ) boolValue = true; - if ( text.length() == 0 ) + if ( text.empty() ) { variant.MakeNull(); return true; @@ -1518,7 +1518,7 @@ bool wxFlagsProperty::StringToValue( wxVariant& variant, const wxString& text, i // semicolons are no longer valid delimeters WX_PG_TOKENIZER1_BEGIN(text,wxS(',')) - if ( token.length() ) + if ( !token.empty() ) { // Determine which one it is long bit = IdToBit( token ); @@ -1690,7 +1690,7 @@ bool wxPGFileDialogAdapter::DoShowDialog( wxPropertyGrid* propGrid, wxPGProperty path = filename.GetPath(); indFilter = fileProp->m_indFilter; - if ( !path.length() && fileProp->m_basePath.length() ) + if ( path.empty() && !fileProp->m_basePath.empty() ) path = fileProp->m_basePath; } else @@ -1781,7 +1781,7 @@ void wxFileProperty::OnSetValue() } // Find index for extension. - if ( m_indFilter < 0 && fnstr.length() ) + if ( m_indFilter < 0 && !fnstr.empty() ) { wxString ext = filename.GetExt(); int curind = 0; @@ -1798,7 +1798,7 @@ void wxFileProperty::OnSetValue() pos = len; wxString found_ext = m_wildcard.substr(ext_begin, pos-ext_begin); - if ( found_ext.length() > 0 ) + if ( !found_ext.empty() ) { if ( found_ext[0] == wxS('*') ) { @@ -1839,7 +1839,7 @@ wxString wxFileProperty::ValueToString( wxVariant& value, return wxEmptyString; wxString fullName = filename.GetFullName(); - if ( !fullName.length() ) + if ( fullName.empty() ) return wxEmptyString; if ( argFlags & wxPG_FULL_VALUE ) @@ -1848,7 +1848,7 @@ wxString wxFileProperty::ValueToString( wxVariant& value, } else if ( m_flags & wxPG_PROP_SHOW_FULL_FILENAME ) { - if ( m_basePath.Length() ) + if ( !m_basePath.empty() ) { wxFileName fn2(filename); fn2.MakeRelativeTo(m_basePath); @@ -2186,7 +2186,7 @@ bool wxPGArrayEditorDialog::Create( wxWindow *parent, wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL ); // Message - if ( message.length() ) + if ( !message.empty() ) topsizer->Add( new wxStaticText(this,-1,message), 0, wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL|wxALL, spacing ); @@ -2555,7 +2555,7 @@ wxArrayStringProperty::ArrayStringToString( wxString& dst, if ( flags & Escape ) { str.Replace( wxS("\\"), wxS("\\\\"), true ); - if ( pdr.length() ) + if ( !pdr.empty() ) str.Replace( preas, pdr, true ); } diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 9fb42664c4..5935ac9d43 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -6668,13 +6668,13 @@ bool wxRichTextParagraphLayoutBox::InsertTextWithUndo(long pos, const wxString& int length = action->GetNewParagraphs().GetOwnRange().GetLength(); - if (text.length() > 0 && text.Last() != wxT('\n')) + if (!text.empty() && text.Last() != wxT('\n')) { // Don't count the newline when undoing length --; action->GetNewParagraphs().SetPartialParagraph(true); } - else if (text.length() > 0 && text.Last() == wxT('\n')) + else if (!text.empty() && text.Last() == wxT('\n')) length --; action->SetPosition(pos); diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 2da03ca833..d69d494f1b 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -289,7 +289,7 @@ void ScintillaWX::StartDrag() { stc->GetEventHandler()->ProcessEvent(evt); dragText = evt.GetDragText(); - if (dragText.length()) { + if ( !dragText.empty() ) { wxDropSource source(stc); wxTextDataObject data(dragText); wxDragResult result; diff --git a/src/unix/dialup.cpp b/src/unix/dialup.cpp index edf6657b30..60f48784b4 100644 --- a/src/unix/dialup.cpp +++ b/src/unix/dialup.cpp @@ -395,7 +395,7 @@ void wxDialUpManagerImpl::DisableAutoCheckOnlineStatus() void wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) { - if(hostname.length() == 0) + if( hostname.empty() ) { m_BeaconHost = WXDIALUP_MANAGER_DEFAULT_BEACONHOST; m_BeaconPort = 80; @@ -404,7 +404,7 @@ void wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) // does hostname contain a port number? wxString port = hostname.After(wxT(':')); - if(port.length()) + if( !port.empty() ) { m_BeaconHost = hostname.Before(wxT(':')); m_BeaconPort = wxAtoi(port); @@ -667,7 +667,7 @@ wxDialUpManagerImpl::CheckIfconfig() { wxLogNull ln; // suppress all error messages - wxASSERT_MSG( m_IfconfigPath.length(), + wxASSERT_MSG( !m_IfconfigPath.empty(), wxT("can't use ifconfig if it wasn't found") ); wxString tmpfile = wxFileName::CreateTempFileName( wxT("_wxdialuptest") ); diff --git a/src/unix/net.cpp b/src/unix/net.cpp index 0516d9ef1b..2b1ea3cede 100644 --- a/src/unix/net.cpp +++ b/src/unix/net.cpp @@ -255,15 +255,15 @@ wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) { /// does hostname contain a port number? wxString port = hostname.After(':'); - if(port.Length()) + if(port.empty()) { - m_BeaconHost = hostname.Before(':'); - m_BeaconPort = atoi(port); + m_BeaconHost = hostname; + m_BeaconPort = portno; } else { - m_BeaconHost = hostname; - m_BeaconPort = portno; + m_BeaconHost = hostname.Before(':'); + m_BeaconPort = atoi(port); } } @@ -319,7 +319,7 @@ wxDialUpManagerImpl::CheckStatusInternal(void) // Let's try the ifconfig method first, should be fastest: if(m_CanUseIfconfig != 0) // unknown or yes { - wxASSERT(m_IfconfigPath.length()); + wxASSERT( !m_IfconfigPath.empty() ); wxString tmpfile = wxFileName::CreateTempFileName("_wxdialuptest"); wxString cmd = "/bin/sh -c \'"; diff --git a/src/x11/textctrl.cpp b/src/x11/textctrl.cpp index e25156a2b2..d37b667068 100644 --- a/src/x11/textctrl.cpp +++ b/src/x11/textctrl.cpp @@ -1556,7 +1556,7 @@ void wxTextCtrl::DrawLine( wxDC &dc, int x, int y, const wxString &line2, int li size_t pos = 0; wxString token( GetNextToken( line, pos ) ); - while (!token.IsNull()) + while ( !token.empty() ) { if (m_keywords.Index( token ) != wxNOT_FOUND) { diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index 9597c6e2d8..9e580866c3 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -140,7 +140,7 @@ public: { const XRCWidgetData& w = m_wdata.Item(i); if( !CanBeUsedWithXRCCTRL(w.GetClass()) ) continue; - if( w.GetName().Length() == 0 ) continue; + if( w.GetName().empty() ) continue; file.Write( wxT(" ") + w.GetClass() + wxT("* ") + w.GetName() + wxT(";\n")); @@ -155,7 +155,7 @@ public: { const XRCWidgetData& w = m_wdata.Item(i); if( !CanBeUsedWithXRCCTRL(w.GetClass()) ) continue; - if( w.GetName().Length() == 0 ) continue; + if( w.GetName().empty() ) continue; file.Write( wxT(" ") + w.GetName() + wxT(" = XRCCTRL(*this,\"") -- 2.45.2