ObjFW  Diff

Differences From Artifact [78d0532385]:

To Artifact [995d1dfd33]:


189
190
191
192
193
194
195
196
197
198
199
200
201
202

203
204
205
206
207
208
209
	return self;
}

#ifdef OF_HAVE_FILES
- (instancetype)initWithContentsOfFile: (OFString *)path
{
	@try {
		of_offset_t size = [[OFFileManager defaultManager]
		    sizeOfFileAtPath: path];
		char *buffer;

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


		buffer = malloc((size_t)size);
		if (buffer == NULL)
			@throw [OFOutOfMemoryException
			    exceptionWithRequestedSize: (size_t)size];

		@try {







|
|


|
|

>







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
	return self;
}

#ifdef OF_HAVE_FILES
- (instancetype)initWithContentsOfFile: (OFString *)path
{
	@try {
		uintmax_t size = [[[OFFileManager defaultManager]
		    attributesOfItemAtPath: path] fileSize];
		char *buffer;

# if UINTMAX_MAX > SIZE_MAX
		if (size > SIZE_MAX)
			@throw [OFOutOfRangeException exception];
# endif

		buffer = malloc((size_t)size);
		if (buffer == NULL)
			@throw [OFOutOfMemoryException
			    exceptionWithRequestedSize: (size_t)size];

		@try {