ObjFW  Diff

Differences From Artifact [752c197aa2]:

To Artifact [10eb8531ab]:


476
477
478
479
480
481
482
483

484
485
486
487
488
489
490
491
492
493
494
495
496

497
498
499
500
501
502
503
476
477
478
479
480
481
482

483
484
485
486
487
488
489
490
491
492
493
494


495
496
497
498
499
500
501
502







-
+











-
-
+







#else
	if (_wchdir([path UTF16String]) != 0)
#endif
		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithPath: path];
}

+ (off_t)sizeOfFileAtPath: (OFString*)path
+ (of_offset_t)sizeOfFileAtPath: (OFString*)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

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

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

+ (OFDate*)modificationDateOfFileAtPath: (OFString*)path
{
	of_stat_t s;

	if (path == nil)
971
972
973
974
975
976
977
978
979


980
981

982
983
984
985
986
987
988
970
971
972
973
974
975
976


977
978
979

980
981
982
983
984
985
986
987







-
-
+
+

-
+







	if (_fd == -1 || _atEndOfStream ||
	    write(_fd, buffer, (unsigned int)length) < length)
		@throw [OFWriteFailedException exceptionWithObject: self
						   requestedLength: length];
#endif
}

- (off_t)lowlevelSeekToOffset: (off_t)offset
		       whence: (int)whence
- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset
			     whence: (int)whence
{
	off_t ret = lseek(_fd, offset, whence);
	of_offset_t ret = lseek(_fd, offset, whence);

	if (ret == -1)
		@throw [OFSeekFailedException exceptionWithStream: self
							   offset: offset
							   whence: whence];

	_atEndOfStream = false;