ObjFW  Diff

Differences From Artifact [6d3006c532]:

To Artifact [1f1aa20392]:

  • File src/OFFile.m — part of check-in [c5e7dd679b] at 2013-09-17 16:12:37 on branch trunk — Work around Android bugs.

    Includes:
    * Check environ against NULL before using it, since Android sets it to
    NULL.
    * Cast st_size of struct stat to off_t. Android uses long long for
    st_size as its off_t is only 32 bit, but st_size should be off_t
    according to POSIX.
    * Android's strtod() does not accept 0x, as specified by C99. Thus,
    the test is disabled if __ANDROID__ is defined. (user: js, size: 17848) [annotate] [blame] [check-ins using]


403
404
405
406
407
408
409

410
411
412
413
414
415
416
417

	if (_wstat([path UTF16String], &s) == -1)
#endif
		/* FIXME: Maybe use another exception? */
		@throw [OFOpenFileFailedException exceptionWithPath: path
							       mode: @"r"];


	return s.st_size;
}

+ (OFDate*)modificationDateOfFileAtPath: (OFString*)path
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];








>
|







403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418

	if (_wstat([path UTF16String], &s) == -1)
#endif
		/* FIXME: Maybe use another exception? */
		@throw [OFOpenFileFailedException exceptionWithPath: path
							       mode: @"r"];

	/* On Android, off_t is 32 bit, but st_size is long long there */
	return (off_t)s.st_size;
}

+ (OFDate*)modificationDateOfFileAtPath: (OFString*)path
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];