backout changeset ce8fbd7d222e from bug 455381 to fix windows unit test bustage

This commit is contained in:
Gavin Sharp 2008-12-03 18:49:54 -05:00
Родитель df47c3ecc5
Коммит 5bea591d0a
1 изменённых файлов: 19 добавлений и 24 удалений

Просмотреть файл

@ -106,11 +106,10 @@ nsProcess::Init(nsIFile* executable)
#if defined(XP_WIN)
// out param must be freed by caller
static int assembleCmdLine(char *const *argv, PRUnichar **wideCmdLine)
static int assembleCmdLine(char *const *argv, char **cmdLine)
{
char *const *arg;
char *p, *q, **cmdLine;
char *p, *q;
int cmdLineSize;
int numBackslashes;
int i;
@ -132,7 +131,7 @@ static int assembleCmdLine(char *const *argv, PRUnichar **wideCmdLine)
+ 2 /* we quote every argument */
+ 1; /* space in between, or final null */
}
p = *cmdLine = (char *) PR_MALLOC(cmdLineSize*sizeof(char));
p = *cmdLine = (char *) PR_MALLOC(cmdLineSize);
if (p == NULL) {
return -1;
}
@ -206,10 +205,6 @@ static int assembleCmdLine(char *const *argv, PRUnichar **wideCmdLine)
}
*p = '\0';
PRInt32 numChars = MultiByteToWideChar(CP_ACP, 0, *cmdLine, -1, NULL, 0);
*wideCmdLine = (PRUnichar *) PR_MALLOC(numChars*sizeof(PRUnichar));
MultiByteToWideChar(CP_ACP, 0, *cmdLine, -1, *wideCmdLine, numChars);
PR_Free(cmdLine);
return 0;
}
#endif
@ -242,10 +237,10 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count,
my_argv[count+1] = NULL;
#if defined(XP_WIN) && !defined (WINCE) /* wince uses nspr */
STARTUPINFOW startupInfo;
STARTUPINFO startupInfo;
PROCESS_INFORMATION procInfo;
BOOL retVal;
PRUnichar *cmdLine;
char *cmdLine;
if (assembleCmdLine(my_argv, &cmdLine) == -1) {
nsMemory::Free(my_argv);
@ -261,20 +256,20 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count,
* not have any effect on non-console applications.
*/
retVal = CreateProcessW(NULL,
// const_cast<char*>(mTargetPath.get()),
cmdLine,
NULL, /* security attributes for the new
* process */
NULL, /* security attributes for the primary
* thread in the new process */
FALSE, /* inherit handles */
CREATE_NO_WINDOW, /* creation flags */
NULL, /* env */
NULL, /* current drive and directory */
&startupInfo,
&procInfo
);
retVal = CreateProcess(NULL,
// const_cast<char*>(mTargetPath.get()),
cmdLine,
NULL, /* security attributes for the new
* process */
NULL, /* security attributes for the primary
* thread in the new process */
FALSE, /* inherit handles */
CREATE_NO_WINDOW, /* creation flags */
NULL, /* env */
NULL, /* current drive and directory */
&startupInfo,
&procInfo
);
PR_Free( cmdLine );
if (blocking) {