]> git.saurik.com Git - wxWidgets.git/commitdiff
error in func ConvertToStandardCommandArgs with argv[]
authorMart Raudsepp <leio@gentoo.org>
Wed, 14 Oct 1998 06:45:08 +0000 (06:45 +0000)
committerMart Raudsepp <leio@gentoo.org>
Wed, 14 Oct 1998 06:45:08 +0000 (06:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@821 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/app.cpp

index b3a40f84c392b78dc6c4fdc9a4fe7cc7370012fc..22ced1c679b9676038a975731220874016f56628 100644 (file)
@@ -348,17 +348,20 @@ bool wxApp::RegisterWindowClasses()
 void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
 {
   // Split command line into tokens, as in usual main(argc, argv)
 void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
 {
   // 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 count = 0;
+  int para,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;
-  for (i = 0; (buf[i] = lpCmdLine[i]) != 0; i++)
+  unsigned int 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
   char name[260]; // 260 is MAX_PATH value from windef.h
 
   // Get application name
   char name[260]; // 260 is MAX_PATH value from windef.h
@@ -413,11 +416,12 @@ void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
   wxTheApp->argc = count;
 
   for (i = 0; i < count; i++)
   wxTheApp->argc = count;
 
   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 [] buf;
 
   delete [] command;
   delete [] buf;