From 291b0f5b14b62be240ae5cb1ec2ade3d8db6a776 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 22 Jun 2007 18:22:20 +0000 Subject: [PATCH] fix warnings about parameters shadowing member variables git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46648 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/app.cpp | 37 +++++++++++++++++++------------------ src/stc/ScintillaWX.cpp | 20 ++++++++++---------- src/stc/ScintillaWX.h | 4 ++-- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 14b556b2e5..ad027a0232 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -346,9 +346,10 @@ GdkVisual *wxApp::GetGdkVisual() return visual; } -bool wxApp::Initialize(int& argc, wxChar **argv) +// use unusual names for the parameters to avoid conflict with wxApp::arg[cv] +bool wxApp::Initialize(int& argc_, wxChar **argv_) { - if ( !wxAppBase::Initialize(argc, argv) ) + if ( !wxAppBase::Initialize(argc_, argv_) ) return false; #if wxUSE_THREADS @@ -407,15 +408,15 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #if wxUSE_UNICODE // gtk_init() wants UTF-8, not wchar_t, so convert int i; - char **argvGTK = new char *[argc + 1]; - for ( i = 0; i < argc; i++ ) + char **argvGTK = new char *[argc_ + 1]; + for ( i = 0; i < argc_; i++ ) { - argvGTK[i] = wxStrdupA(wxConvUTF8.cWX2MB(argv[i])); + argvGTK[i] = wxStrdupA(wxConvUTF8.cWX2MB(argv_[i])); } - argvGTK[argc] = NULL; + argvGTK[argc_] = NULL; - int argcGTK = argc; + int argcGTK = argc_; #ifdef __WXGPE__ init_result = true; // is there a _check() version of this? @@ -425,18 +426,18 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #endif wxUpdateLocaleIsUtf8(); - if ( argcGTK != argc ) + if ( argcGTK != argc_ ) { // we have to drop the parameters which were consumed by GTK+ for ( i = 0; i < argcGTK; i++ ) { - while ( strcmp(wxConvUTF8.cWX2MB(argv[i]), argvGTK[i]) != 0 ) + while ( strcmp(wxConvUTF8.cWX2MB(argv_[i]), argvGTK[i]) != 0 ) { - memmove(argv + i, argv + i + 1, (argc - i)*sizeof(*argv)); + memmove(argv_ + i, argv_ + i + 1, (argc_ - i)*sizeof(*argv_)); } } - argc = argcGTK; + argc_ = argcGTK; } //else: gtk_init() didn't modify our parameters @@ -448,14 +449,14 @@ bool wxApp::Initialize(int& argc, wxChar **argv) delete [] argvGTK; #else // !wxUSE_UNICODE - // gtk_init() shouldn't actually change argv itself (just its contents) so + // gtk_init() shouldn't actually change argv_ itself (just its contents) so // it's ok to pass pointer to it - init_result = gtk_init_check( &argc, &argv ); + init_result = gtk_init_check( &argc_, &argv_ ); #endif // wxUSE_UNICODE/!wxUSE_UNICODE // update internal arg[cv] as GTK+ may have removed processed options: - this->argc = argc; - this->argv = argv; + this->argc = argc_; + this->argv = argv_; if ( m_traits ) { @@ -466,10 +467,10 @@ bool wxApp::Initialize(int& argc, wxChar **argv) wxArrayString opt, desc; m_traits->GetStandardCmdLineOptions(opt, desc); - for ( int i = 0; i < argc; i++ ) + for ( int i = 0; i < argc_; i++ ) { // leave just the names of the options with values - const wxString str = wxString(argv[i]).BeforeFirst('='); + const wxString str = wxString(argv_[i]).BeforeFirst('='); for ( size_t j = 0; j < opt.size(); j++ ) { @@ -482,7 +483,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) // options) it, so abort, just as we do if incorrect // program option is given wxLogError(_("Invalid GTK+ command line option, use \"%s --help\""), - argv[0]); + argv_[0]); return false; } } diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index a45fc33fcd..5f613664d8 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -49,15 +49,15 @@ class wxSTCTimer : public wxTimer { public: wxSTCTimer(ScintillaWX* swx) { - this->swx = swx; + m_swx = swx; } void Notify() { - swx->DoTick(); + m_swx->DoTick(); } private: - ScintillaWX* swx; + ScintillaWX* m_swx; }; @@ -65,32 +65,32 @@ private: class wxStartDragTimer : public wxTimer { public: wxStartDragTimer(ScintillaWX* swx) { - this->swx = swx; + m_swx = swx; } void Notify() { - swx->DoStartDrag(); + m_swx->DoStartDrag(); } private: - ScintillaWX* swx; + ScintillaWX* m_swx; }; bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data) { - return swx->DoDropText(x, y, data); + return m_swx->DoDropText(x, y, data); } wxDragResult wxSTCDropTarget::OnEnter(wxCoord x, wxCoord y, wxDragResult def) { - return swx->DoDragEnter(x, y, def); + return m_swx->DoDragEnter(x, y, def); } wxDragResult wxSTCDropTarget::OnDragOver(wxCoord x, wxCoord y, wxDragResult def) { - return swx->DoDragOver(x, y, def); + return m_swx->DoDragOver(x, y, def); } void wxSTCDropTarget::OnLeave() { - swx->DoDragLeave(); + m_swx->DoDragLeave(); } #endif // wxUSE_DRAG_AND_DROP diff --git a/src/stc/ScintillaWX.h b/src/stc/ScintillaWX.h index cdad2be175..cba7248983 100644 --- a/src/stc/ScintillaWX.h +++ b/src/stc/ScintillaWX.h @@ -72,7 +72,7 @@ class ScintillaWX; class wxSTCDropTarget : public wxTextDropTarget { public: void SetScintilla(ScintillaWX* swx) { - this->swx = swx; + m_swx = swx; } bool OnDropText(wxCoord x, wxCoord y, const wxString& data); @@ -81,7 +81,7 @@ public: void OnLeave(); private: - ScintillaWX* swx; + ScintillaWX* m_swx; }; #endif