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
This commit is contained in:
Václav Slavík 2014-12-07 16:40:24 +00:00
parent 5c472ee4c6
commit 26d6b58889
2 changed files with 8 additions and 7 deletions

View File

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

View File

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