From d2f125aa357be5e19b18a856e32764e58527a072 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 20 Jan 2014 14:45:08 +0000 Subject: [PATCH] Pass non-primitive types by const reference instead of value. No real changes, just avoid the unnecessary copying and also make the signatures more consistent by adding the apparently forgotten "&" in a couple of places. See #15893. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/filectrl.h | 2 +- include/wx/ipcbase.h | 4 ++-- include/wx/propgrid/propgrid.h | 2 +- include/wx/richtext/richtextctrl.h | 2 +- include/wx/webview.h | 4 ++-- src/common/filectrlcmn.cpp | 2 +- src/richtext/richtextctrl.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/wx/filectrl.h b/include/wx/filectrl.h index e4c302f7d5..82ce095f73 100644 --- a/include/wx/filectrl.h +++ b/include/wx/filectrl.h @@ -65,7 +65,7 @@ public: void GenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); -void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString ); +void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString& filename = wxEmptyString ); #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #define wxFileCtrl wxGtkFileCtrl diff --git a/include/wx/ipcbase.h b/include/wx/ipcbase.h index 4d69958e4c..1fc540e41d 100644 --- a/include/wx/ipcbase.h +++ b/include/wx/ipcbase.h @@ -91,7 +91,7 @@ public: { return DoPoke(item, ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) : size, wxIPC_UNICODETEXT); } - bool Poke(const wxString& item, const wxString s) + bool Poke(const wxString& item, const wxString& s) { const wxScopedCharBuffer buf = s.utf8_str(); return DoPoke(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); @@ -113,7 +113,7 @@ public: { return DoAdvise(item, ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) : size, wxIPC_UNICODETEXT); } - bool Advise(const wxString& item, const wxString s) + bool Advise(const wxString& item, const wxString& s) { const wxScopedCharBuffer buf = s.utf8_str(); return DoAdvise(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index f7f2f1368b..8a651306eb 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -1692,7 +1692,7 @@ public: @param text Initial text value of created wxTextCtrl. */ - void SetupTextCtrlValue( const wxString text ) { m_prevTcValue = text; } + void SetupTextCtrlValue( const wxString& text ) { m_prevTcValue = text; } /** Unfocuses or closes editor if one was open, but does not deselect diff --git a/include/wx/richtext/richtextctrl.h b/include/wx/richtext/richtextctrl.h index d9cd93fc27..74e060aa34 100644 --- a/include/wx/richtext/richtextctrl.h +++ b/include/wx/richtext/richtextctrl.h @@ -903,7 +903,7 @@ public: /** Finds the container at the given point, which is in screen coordinates. */ - wxRichTextParagraphLayoutBox* FindContainerAtPoint(const wxPoint pt, long& position, int& hit, wxRichTextObject* hitObj, int flags = 0); + wxRichTextParagraphLayoutBox* FindContainerAtPoint(const wxPoint& pt, long& position, int& hit, wxRichTextObject* hitObj, int flags = 0); //@} #if wxUSE_DRAG_AND_DROP diff --git a/include/wx/webview.h b/include/wx/webview.h index 25a235da9d..3ea2e74a32 100644 --- a/include/wx/webview.h +++ b/include/wx/webview.h @@ -237,8 +237,8 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewEvent : public wxNotifyEvent { public: wxWebViewEvent() {} - wxWebViewEvent(wxEventType type, int id, const wxString url, - const wxString target) + wxWebViewEvent(wxEventType type, int id, const wxString& url, + const wxString& target) : wxNotifyEvent(type, id), m_url(url), m_target(target) {} diff --git a/src/common/filectrlcmn.cpp b/src/common/filectrlcmn.cpp index f4c8fd27aa..eb8e054a8c 100644 --- a/src/common/filectrlcmn.cpp +++ b/src/common/filectrlcmn.cpp @@ -63,7 +63,7 @@ void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd) wnd->GetEventHandler()->ProcessEvent( event ); } -void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename ) +void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString& filename ) { wxFileCtrlEvent event( wxEVT_FILECTRL_FILEACTIVATED, wnd, wnd->GetId() ); event.SetDirectory( fileCtrl->GetDirectory() ); diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index adee519a8d..8405d395ea 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -2985,7 +2985,7 @@ wxRichTextCtrl::HitTest(const wxPoint& pt, } wxRichTextParagraphLayoutBox* -wxRichTextCtrl::FindContainerAtPoint(const wxPoint pt, long& position, int& hit, wxRichTextObject* hitObj, int flags/* = 0*/) +wxRichTextCtrl::FindContainerAtPoint(const wxPoint& pt, long& position, int& hit, wxRichTextObject* hitObj, int flags/* = 0*/) { wxClientDC dc(this); PrepareDC(dc);