ObjFW  Check-in [8da165721c]

Overview
Comment:OFData: Add casts to make 32 bit Clang happy
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8da165721c40bd7f0d97b61e3b8f5b469b2e60d63b865e3cdd12337d1ae9e2be
User & Date: js on 2017-07-24 20:10:55
Other Links: manifest | tags
Context
2017-07-24
20:29
OFINIFile: Always use \r\n check-in: 1248c00475 user: js tags: trunk
20:10
OFData: Add casts to make 32 bit Clang happy check-in: 8da165721c user: js tags: trunk
2017-07-23
18:02
Add -[OFString dataWithEncoding:] check-in: db06863643 user: js tags: trunk
Changes

Modified src/OFData.m from [504d17c5e3] to [ab1e932258].

205
206
207
208
209
210
211
212

213
214
215

216
217
218
219
220
221
222

223
224
225
226
227
228

229
230
231
232
233
234
235
205
206
207
208
209
210
211

212
213
214

215
216
217
218
219
220
221

222
223
224
225
226
227

228
229
230
231
232
233
234
235







-
+


-
+






-
+





-
+







		    sizeOfFileAtPath: path];
		char *buffer;

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

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

		@try {
			OFFile *file = [[OFFile alloc] initWithPath: path
							       mode: @"r"];
			@try {
				[file readIntoBuffer: buffer
					 exactLength: size];
					 exactLength: (size_t)size];
			} @finally {
				[file release];
			}

			self = [self initWithItemsNoCopy: buffer
						   count: size
						   count: (size_t)size
					    freeWhenDone: true];
		} @catch (id e) {
			free(buffer);
			@throw e;
		}
	} @catch (id e) {
		[self release];