error in func ConvertToStandardCommandArgs with argv[]
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@821 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
387a3b02e0
commit
0ed9fce61a
@ -348,17 +348,20 @@ bool wxApp::RegisterWindowClasses()
|
|||||||
void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
|
void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
|
||||||
{
|
{
|
||||||
// Split command line into tokens, as in usual main(argc, argv)
|
// Split command line into tokens, as in usual main(argc, argv)
|
||||||
char **command = new char*[50]; // VZ: sure? why not 25 or 73 and a half??
|
int para,count = 0;
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
char *buf = new char[strlen(lpCmdLine) + 1];
|
char *buf = new char[strlen(lpCmdLine) + 1];
|
||||||
|
|
||||||
|
para=0;
|
||||||
/* Model independent strcpy */
|
/* Model independent strcpy */
|
||||||
int i;
|
unsigned int i;
|
||||||
for (i = 0; (buf[i] = lpCmdLine[i]) != 0; i++)
|
for (i = 0; i<strlen(lpCmdLine); i++)
|
||||||
{
|
{
|
||||||
/* loop */;
|
buf[i]=lpCmdLine[i];
|
||||||
|
if (isspace(lpCmdLine[i]))
|
||||||
|
para++;
|
||||||
}
|
}
|
||||||
|
buf[i]=0;
|
||||||
|
char **command = new char*[para+2];
|
||||||
|
|
||||||
// Get application name
|
// Get application name
|
||||||
char name[260]; // 260 is MAX_PATH value from windef.h
|
char name[260]; // 260 is MAX_PATH value from windef.h
|
||||||
@ -413,11 +416,12 @@ void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
|
|||||||
wxTheApp->argc = count;
|
wxTheApp->argc = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
|
||||||
wxTheApp->argv[i] = copystring(command[i]);
|
wxTheApp->argv[i] = copystring(command[i]);
|
||||||
|
|
||||||
delete [] command[i];
|
#if !defined(__GNUWIN32__)
|
||||||
}
|
// use copystring than delete this pointer
|
||||||
|
delete [] command[0];
|
||||||
|
#endif
|
||||||
|
|
||||||
delete [] command;
|
delete [] command;
|
||||||
delete [] buf;
|
delete [] buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user