Always use UTF16 arguments on windows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22830 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-04-26 15:33:47 +00:00
parent 98f6da8323
commit aa58e8c4ca
2 changed files with 61 additions and 61 deletions

View file

@ -7,6 +7,7 @@
* Source/NSCalendarDate.m: Correction to millisecond fix ... for
bug #16426
* Resources/GNUmakefile: Fix installation of Ukrainian language.
* Source/NSProcessInfo.m: Always use UTF16 args on mingw32.
2006-04-26 Hubert Chan

View file

@ -267,69 +267,68 @@ _gnu_process_args(int argc, char *argv[], char *env[])
_gnu_processName = [arg0 lastPathComponent];
IF_NO_GC(RETAIN(_gnu_processName));
/* Copy the argument list */
if (argv)
{
NSString *str;
NSMutableSet *mySet;
id obj_argv[argc];
int added = 1;
mySet = [NSMutableSet new];
/* Copy the zero'th argument to the argument list */
obj_argv[0] = arg0;
for (i = 1; i < argc; i++)
{
str = [NSString stringWithCString: argv[i]];
if ([str hasPrefix: @"--GNU-Debug="])
[mySet addObject: [str substringFromIndex: 12]];
else
obj_argv[added++] = str;
}
IF_NO_GC(RELEASE(_gnu_arguments));
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
IF_NO_GC(RELEASE(_debug_set));
_debug_set = mySet;
RELEASE(arg0);
}
#if defined(__MINGW32__)
// It appears that in some versions of mingw32 __argv is no longer supported
// However GetCommandLine always works. Perhaps this should be the default case
// as it is unicode.
else
{
unichar **argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
NSString *str;
NSMutableSet *mySet;
id obj_argv[argc];
int added = 1;
mySet = [NSMutableSet new];
/* Copy the zero'th argument to the argument list */
obj_argv[0] = arg0;
for (i = 1; i < argc; i++)
{
str = [NSString stringWithCharacters: argvw[i] length: wcslen(argvw[i])];
if ([str hasPrefix: @"--GNU-Debug="])
[mySet addObject: [str substringFromIndex: 12]];
else
obj_argv[added++] = str;
}
IF_NO_GC(RELEASE(_gnu_arguments));
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
IF_NO_GC(RELEASE(_debug_set));
_debug_set = mySet;
RELEASE(arg0);
}
{
unichar **argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
NSString *str;
NSMutableSet *mySet;
id obj_argv[argc];
int added = 1;
mySet = [NSMutableSet new];
/* Copy the zero'th argument to the argument list */
obj_argv[0] = arg0;
for (i = 1; i < argc; i++)
{
str = [NSString stringWithCharacters: argvw[i] length: wcslen(argvw[i])];
if ([str hasPrefix: @"--GNU-Debug="])
{
[mySet addObject: [str substringFromIndex: 12]];
}
else
{
obj_argv[added++] = str;
}
}
IF_NO_GC(RELEASE(_gnu_arguments));
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
IF_NO_GC(RELEASE(_debug_set));
_debug_set = mySet;
RELEASE(arg0);
}
#else
if (argv)
{
NSString *str;
NSMutableSet *mySet;
id obj_argv[argc];
int added = 1;
mySet = [NSMutableSet new];
/* Copy the zero'th argument to the argument list */
obj_argv[0] = arg0;
for (i = 1; i < argc; i++)
{
str = [NSString stringWithCString: argv[i]];
if ([str hasPrefix: @"--GNU-Debug="])
[mySet addObject: [str substringFromIndex: 12]];
else
obj_argv[added++] = str;
}
IF_NO_GC(RELEASE(_gnu_arguments));
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
IF_NO_GC(RELEASE(_debug_set));
_debug_set = mySet;
RELEASE(arg0);
}
#endif
/* Copy the evironment list */