ObjFW  Diff

Differences From Artifact [b3c8f30967]:

To Artifact [61775ac9b0]:


44
45
46
47
48
49
50

51
52
53
54
55
56
57
#import "OFString.h"
#import "OFArray.h"
#ifdef OF_THREADS
# import "threading.h"
#endif
#import "OFDate.h"
#import "OFApplication.h"


#import "OFChangeDirectoryFailedException.h"
#import "OFChangeFileModeFailedException.h"
#import "OFChangeFileOwnerFailedException.h"
#import "OFCreateDirectoryFailedException.h"
#import "OFDeleteDirectoryFailedException.h"
#import "OFDeleteFileFailedException.h"







>







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#import "OFString.h"
#import "OFArray.h"
#ifdef OF_THREADS
# import "threading.h"
#endif
#import "OFDate.h"
#import "OFApplication.h"
#import "OFSystemInfo.h"

#import "OFChangeDirectoryFailedException.h"
#import "OFChangeFileModeFailedException.h"
#import "OFChangeFileOwnerFailedException.h"
#import "OFCreateDirectoryFailedException.h"
#import "OFDeleteDirectoryFailedException.h"
#import "OFDeleteFileFailedException.h"
494
495
496
497
498
499
500

501
502
503
504
505
506
507
508

509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
		toPath: (OFString*)destination
{
	void *pool = objc_autoreleasePoolPush();
	BOOL override;
	OFFile *sourceFile = nil;
	OFFile *destinationFile = nil;
	char *buffer;


	if ([self directoryExistsAtPath: destination]) {
		OFString *filename = [source lastPathComponent];
		destination = [OFString stringWithPath: destination, filename,
							nil];
	}

	override = [self fileExistsAtPath: destination];


	if ((buffer = malloc(of_pagesize)) == NULL)
		@throw [OFOutOfMemoryException exceptionWithClass: self
						    requestedSize: of_pagesize];

	@try {
		sourceFile = [OFFile fileWithPath: source
					     mode: @"rb"];
		destinationFile = [OFFile fileWithPath: destination
						  mode: @"wb"];

		while (![sourceFile isAtEndOfStream]) {
			size_t length;

			length = [sourceFile readIntoBuffer: buffer
						     length: of_pagesize];
			[destinationFile writeBuffer: buffer
					      length: length];
		}

#if !defined(_WIN32) && !defined(_PSP)
		if (!override) {
			struct stat s;







>








>

|

|











|







495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
		toPath: (OFString*)destination
{
	void *pool = objc_autoreleasePoolPush();
	BOOL override;
	OFFile *sourceFile = nil;
	OFFile *destinationFile = nil;
	char *buffer;
	size_t pageSize;

	if ([self directoryExistsAtPath: destination]) {
		OFString *filename = [source lastPathComponent];
		destination = [OFString stringWithPath: destination, filename,
							nil];
	}

	override = [self fileExistsAtPath: destination];
	pageSize = [OFSystemInfo pageSize];

	if ((buffer = malloc(pageSize)) == NULL)
		@throw [OFOutOfMemoryException exceptionWithClass: self
						    requestedSize: pageSize];

	@try {
		sourceFile = [OFFile fileWithPath: source
					     mode: @"rb"];
		destinationFile = [OFFile fileWithPath: destination
						  mode: @"wb"];

		while (![sourceFile isAtEndOfStream]) {
			size_t length;

			length = [sourceFile readIntoBuffer: buffer
						     length: pageSize];
			[destinationFile writeBuffer: buffer
					      length: length];
		}

#if !defined(_WIN32) && !defined(_PSP)
		if (!override) {
			struct stat s;