From 26d6b58889826d4334e08e87553a9b9626d9716f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 7 Dec 2014 16:40:24 +0000 Subject: [PATCH] Use int& type for argc in wxInitialize and wxInitializer Other functions that take (argc,argv) arguments (wxEntry, wxEntryStart) take argc by reference, because they may manipulate the arguments list. wxInitialize() used passing by value, so any modifications would be silently lost. Make all the functions consistent in their handling of argc by using int& everywhere. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78255 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/init.h | 8 ++++---- src/common/init.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/wx/init.h b/include/wx/init.h index 6ce8e82876..b3a9ff6a4e 100644 --- a/include/wx/init.h +++ b/include/wx/init.h @@ -67,9 +67,9 @@ extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv); // initialize the library (may be called as many times as needed, but each // call to wxInitialize() must be matched by wxUninitialize()) extern bool WXDLLIMPEXP_BASE wxInitialize(); -extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, wxChar **argv); +extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, wxChar **argv); #if wxUSE_UNICODE -extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, char **argv); +extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, char **argv); #endif // clean up -- the library can't be used any more after the last call to @@ -87,13 +87,13 @@ public: m_ok = wxInitialize(); } - wxInitializer(int argc, wxChar **argv) + wxInitializer(int& argc, wxChar **argv) { m_ok = wxInitialize(argc, argv); } #if wxUSE_UNICODE - wxInitializer(int argc, char **argv) + wxInitializer(int& argc, char **argv) { m_ok = wxInitialize(argc, argv); } diff --git a/src/common/init.cpp b/src/common/init.cpp index fc72bd1d18..1bfbaf37ae 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -523,10 +523,11 @@ int wxEntry(int& argc, char **argv) bool wxInitialize() { - return wxInitialize(0, (wxChar**)NULL); + int argc = 0; + return wxInitialize(argc, (wxChar**)NULL); } -bool wxInitialize(int argc, wxChar **argv) +bool wxInitialize(int& argc, wxChar **argv) { wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit); @@ -540,7 +541,7 @@ bool wxInitialize(int argc, wxChar **argv) } #if wxUSE_UNICODE -bool wxInitialize(int argc, char **argv) +bool wxInitialize(int& argc, char **argv) { wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);