ObjFW  Check-in [c1dbf3b212]

Overview
Comment:OFApplication: Only use argv if argc > 0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c1dbf3b2121137dd4aff9f3f7b6992c128f8d53c55d30623753bdf90300df772
User & Date: js on 2014-07-18 10:08:25
Other Links: manifest | tags
Context
2014-07-18
10:47
Split threading.h into threading.m and threading.h check-in: 1da2e596af user: js tags: trunk
10:08
OFApplication: Only use argv if argc > 0 check-in: c1dbf3b212 user: js tags: trunk
09:55
README.md: Update Clang + ARM instructions check-in: 4494907e3f user: js tags: trunk
Changes

Modified src/OFApplication.m from [560f80331f] to [96a35a73db].

334
335
336
337
338
339
340
341



342
343

344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374

375
376


377
378
379
380



381
382
383



384
385
386
387
388
389
390
334
335
336
337
338
339
340

341
342
343
344

345
346
347
348
349
350
351
352
353
354
355
356
357

358

359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375


376
377
378



379
380
381
382


383
384
385
386
387
388
389
390
391
392







-
+
+
+

-
+












-

-
















+
-
-
+
+

-
-
-
+
+
+

-
-
+
+
+







	of_string_encoding_t encoding;

	_argc = argc;
	_argv = argv;

	encoding = [OFString nativeOSEncoding];

# ifdef OF_NINTENDO_DS
# ifndef OF_NINTENDO_DS
	if (*argc > 0) {
# else
	if (__system_argv->argvMagic == ARGV_MAGIC &&
	    __system_argv->argc >= 1) {
	    __system_argv->argc > 0) {
# endif
		_programName = [[OFString alloc] initWithCString: (*argv)[0]
							encoding: encoding];
		arguments = [[OFMutableArray alloc] init];
		_arguments = arguments;

		for (i = 1; i < *argc; i++)
			[arguments addObject:
			    [OFString stringWithCString: (*argv)[i]
					       encoding: encoding]];

		[arguments makeImmutable];
# ifdef OF_NINTENDO_DS
	}
# endif

	objc_autoreleasePoolPop(pool);
#else
	_argc = argc;
	_argv = argv;
#endif
}

#ifdef _WIN32
- (void)OF_setArgumentCount: (int)argc
      andWideArgumentValues: (wchar_t**)argv
{
	void *pool = objc_autoreleasePoolPush();
	OFMutableArray *arguments;
	int i;

	if (argc > 0) {
	_programName = [[OFString alloc] initWithUTF16String: argv[0]];
	arguments = [[OFMutableArray alloc] init];
		_programName = [[OFString alloc] initWithUTF16String: argv[0]];
		arguments = [[OFMutableArray alloc] init];

	for (i = 1; i < argc; i++)
		[arguments addObject:
		    [OFString stringWithUTF16String: argv[i]]];
		for (i = 1; i < argc; i++)
			[arguments addObject:
			    [OFString stringWithUTF16String: argv[i]]];

	[arguments makeImmutable];
	_arguments = arguments;
		[arguments makeImmutable];
		_arguments = arguments;
	}

	objc_autoreleasePoolPop(pool);
}
#endif

- (void)getArgumentCount: (int**)argc
       andArgumentValues: (char****)argv