Fix extraction of standard command line arguments in wxX11.

The original number of arguments should be used when checking the argument
index for validity. Additionally, memmove() wasn't moving the correct number
of bytes because of forgotten sizeof().

See #11124.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-08-20 00:44:11 +00:00
parent 0055cc0e4a
commit 995a95737a

View File

@ -100,7 +100,7 @@ bool wxApp::Initialize(int& argC, wxChar **argV)
{
if (wxStrcmp( argV[i], wxT("-display") ) == 0)
{
if (i < (argC - 1))
if (i < (argCOrig - 1))
{
argV[i++] = NULL;
@ -112,7 +112,7 @@ bool wxApp::Initialize(int& argC, wxChar **argV)
}
else if (wxStrcmp( argV[i], wxT("-geometry") ) == 0)
{
if (i < (argC - 1))
if (i < (argCOrig - 1))
{
argV[i++] = NULL;
@ -149,12 +149,12 @@ bool wxApp::Initialize(int& argC, wxChar **argV)
if ( argC != argCOrig )
{
// remove the argumens we consumed
// remove the arguments we consumed
for ( int i = 0; i < argC; i++ )
{
while ( !argV[i] )
{
memmove(argV + i, argV + i + 1, argCOrig - i);
memmove(argV + i, argV + i + 1, (argCOrig - i)*sizeof(wxChar *));
}
}
}