Differences From Artifact [30420d2d38]:
- File src/OFApplication.m — part of check-in [1fb00cc3b4] at 2013-01-07 23:42:59 on branch trunk — Win32: Correctly handle Unicode in environment. (user: js, size: 7711) [annotate] [blame] [check-ins using]
To Artifact [09b9e89928]:
- File
src/OFApplication.m
— part of check-in
[fb1f29bd30]
at
2013-01-08 03:13:34
on branch trunk
— OFApplication: Get Unicode arguments on Win32.
It still stores the normal argc/argv for compatibility, however, the
argument array is created from the Unicode arguments instead.This also makes -[OFApplication setArgumentCount:andArgumentValues:]
private. (user: js, size: 8473) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "autorelease.h" #if defined(__MACH__) && !defined(OF_IOS) # include <crt_externs.h> #elif defined(_WIN32) # include <windows.h> #elif !defined(OF_IOS) extern char **environ; #endif static OFApplication *app = nil; static void | > > > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #import "autorelease.h" #if defined(__MACH__) && !defined(OF_IOS) # include <crt_externs.h> #elif defined(_WIN32) # include <windows.h> extern int _CRT_glob; extern void __wgetmainargs(int*, wchar_t***, wchar_t***, int, int*); #elif !defined(OF_IOS) extern char **environ; #endif static OFApplication *app = nil; static void |
︙ | ︙ | |||
68 69 70 71 72 73 74 75 | #undef SIGNAL_HANDLER int of_application_main(int *argc, char **argv[], Class cls) { OFApplication *app = [OFApplication sharedApplication]; id <OFApplicationDelegate> delegate = [[cls alloc] init]; | > > > > | | > > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #undef SIGNAL_HANDLER int of_application_main(int *argc, char **argv[], Class cls) { OFApplication *app = [OFApplication sharedApplication]; id <OFApplicationDelegate> delegate = [[cls alloc] init]; #ifdef _WIN32 wchar_t **wargv, **wenvp; int wargc, si = 0; #endif [app OF_setArgumentCount: argc andArgumentValues: argv]; #ifdef _WIN32 __wgetmainargs(&wargc, &wargv, &wenvp, _CRT_glob, &si); [app OF_setArgumentCount: wargc andWideArgumentValues: wargv]; #endif [app setDelegate: delegate]; [app run]; return 0; } |
︙ | ︙ | |||
257 258 259 260 261 262 263 | [self release]; @throw e; } return self; } | | | > < < < > > > > > > > > > > > > > > > > > > > > > > > > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | [self release]; @throw e; } return self; } - (void)OF_setArgumentCount: (int*)argc_ andArgumentValues: (char***)argv_ { #ifndef _WIN32 void *pool = objc_autoreleasePoolPush(); int i; argc = argc_; argv = argv_; programName = [[OFString alloc] initWithCString: (*argv)[0] encoding: OF_STRING_ENCODING_NATIVE]; arguments = [[OFMutableArray alloc] init]; for (i = 1; i < *argc; i++) [arguments addObject: [OFString stringWithCString: (*argv)[i] encoding: OF_STRING_ENCODING_NATIVE]]; [arguments makeImmutable]; objc_autoreleasePoolPop(pool); #else argc = argc_; argv = argv_; #endif } #ifdef _WIN32 - (void)OF_setArgumentCount: (int)argc_ andWideArgumentValues: (wchar_t**)argv_ { void *pool = objc_autoreleasePoolPush(); int i; programName = [[OFString alloc] initWithUTF16String: argv_[0]]; arguments = [[OFMutableArray alloc] init]; for (i = 1; i < argc_; i++) [arguments addObject: [OFString stringWithUTF16String: argv_[i]]]; [arguments makeImmutable]; objc_autoreleasePoolPop(pool); } #endif - (void)getArgumentCount: (int**)argc_ andArgumentValues: (char****)argv_ { *argc_ = argc; *argv_ = argv; } |
︙ | ︙ |