Overview
Comment: | OFApplication: Get Unicode arguments on Win32.
It still stores the normal argc/argv for compatibility, however, the This also makes -[OFApplication setArgumentCount:andArgumentValues:] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
fb1f29bd309e1783ec7d95dcbaff48f9 |
User & Date: | js on 2013-01-08 03:13:34 |
Original User & Date: | js on 2013-01-08 03:13:35 |
Other Links: | manifest | tags |
Context
2013-01-08
| ||
03:13 | Win32: Allow Unicode filenames in file operations. check-in: 94a9a18106 user: js tags: trunk | |
03:13 | OFApplication: Get Unicode arguments on Win32. check-in: fb1f29bd30 user: js tags: trunk | |
03:13 | OFProcess: Correctly handle Unicode env on Win32. check-in: 52f2c17f55 user: js tags: trunk | |
Changes
Modified src/OFApplication.h from [e7a89febd1] to [24a84dfbfd].
︙ | ︙ | |||
159 160 161 162 163 164 165 | /*! * @brief Terminates the application with the specified status. * * @param status The status with which the application will terminate */ + (void)terminateWithStatus: (int)status; | < < < < < < < < | | > > > > | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | /*! * @brief Terminates the application with the specified status. * * @param status The status with which the application will terminate */ + (void)terminateWithStatus: (int)status; - (void)OF_setArgumentCount: (int*)argc andArgumentValues: (char**[])argv; #ifdef _WIN32 - (void)OF_setArgumentCount: (int)argc andWideArgumentValues: (wchar_t*[])argv; #endif /*! * @brief Gets args and argv. * * @param argc A pointer where a pointer to argc should be stored * @param argv A pointer where a pointer to argv should be stored */ |
︙ | ︙ |
Modified src/OFApplication.m from [30420d2d38] to [09b9e89928].
︙ | ︙ | |||
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; } |
︙ | ︙ |