@@ -46,10 +46,11 @@ #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" @@ -496,22 +497,24 @@ 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(of_pagesize)) == NULL) + if ((buffer = malloc(pageSize)) == NULL) @throw [OFOutOfMemoryException exceptionWithClass: self - requestedSize: of_pagesize]; + requestedSize: pageSize]; @try { sourceFile = [OFFile fileWithPath: source mode: @"rb"]; destinationFile = [OFFile fileWithPath: destination @@ -519,11 +522,11 @@ while (![sourceFile isAtEndOfStream]) { size_t length; length = [sourceFile readIntoBuffer: buffer - length: of_pagesize]; + length: pageSize]; [destinationFile writeBuffer: buffer length: length]; } #if !defined(_WIN32) && !defined(_PSP)