ObjFW  Diff

Differences From Artifact [27f6116ecb]:

To Artifact [18c9b8230b]:


962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985

		@try {
			fileSize = [[OFFileManager defaultManager]
			    sizeOfFileAtPath: path];
		} @catch (OFStatItemFailedException *e) {
			@throw [OFOpenItemFailedException
			    exceptionWithPath: path
					 mode: @"rb"
					errNo: errno];
		}

		if (sizeof(of_offset_t) > sizeof(size_t) &&
		    fileSize > (of_offset_t)SIZE_MAX)
			@throw [OFOutOfRangeException exception];

		file = [[OFFile alloc] initWithPath: path
					       mode: @"rb"];

		@try {
			tmp = [self allocMemoryWithSize: (size_t)fileSize];

			[file readIntoBuffer: tmp
				 exactLength: (size_t)fileSize];
		} @finally {







|








|







962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985

		@try {
			fileSize = [[OFFileManager defaultManager]
			    sizeOfFileAtPath: path];
		} @catch (OFStatItemFailedException *e) {
			@throw [OFOpenItemFailedException
			    exceptionWithPath: path
					 mode: @"r"
					errNo: errno];
		}

		if (sizeof(of_offset_t) > sizeof(size_t) &&
		    fileSize > (of_offset_t)SIZE_MAX)
			@throw [OFOutOfRangeException exception];

		file = [[OFFile alloc] initWithPath: path
					       mode: @"r"];

		@try {
			tmp = [self allocMemoryWithSize: (size_t)fileSize];

			[file readIntoBuffer: tmp
				 exactLength: (size_t)fileSize];
		} @finally {
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
- (void)writeToFile: (OFString *)path
	   encoding: (of_string_encoding_t)encoding
{
	void *pool = objc_autoreleasePoolPush();
	OFFile *file;

	file = [OFFile fileWithPath: path
			       mode: @"wb"];
	[file writeString: self
		 encoding: encoding];

	objc_autoreleasePoolPop(pool);
}
#endif








|







2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
- (void)writeToFile: (OFString *)path
	   encoding: (of_string_encoding_t)encoding
{
	void *pool = objc_autoreleasePoolPush();
	OFFile *file;

	file = [OFFile fileWithPath: path
			       mode: @"w"];
	[file writeString: self
		 encoding: encoding];

	objc_autoreleasePoolPop(pool);
}
#endif