ObjFW  Check-in [adaf5a3e6e]

Overview
Comment:A few small fixes for OS X/PPC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: adaf5a3e6e121584be3656b9d1b8e35e75ad8f537ca41981ff23ea0dbf3e02fc
User & Date: js on 2013-02-18 11:31:17
Other Links: manifest | tags
Context
2013-02-18
12:27
Add -[OFMutableArray initWithCapacity:]. check-in: e0c9168dfc user: js tags: trunk
11:31
A few small fixes for OS X/PPC. check-in: adaf5a3e6e user: js tags: trunk
11:07
Add -[OFMutableDictionary initWithCapacity:]. check-in: 4fb0f4bf66 user: js tags: trunk
Changes

Modified src/OFDataArray.m from [a9fd1ff3d3] to [49ef41686a].

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
		off_t size = [OFFile sizeOfFileAtPath: path];

		if (size > SIZE_MAX)
			@throw [OFOutOfRangeException
			    exceptionWithClass: [self class]];

		self = [self initWithItemSize: 1
				     capacity: size];

		@try {
			size_t pageSize = [OFSystemInfo pageSize];
			char *buffer = [self allocMemoryWithSize: pageSize];

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







|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
		off_t size = [OFFile sizeOfFileAtPath: path];

		if (size > SIZE_MAX)
			@throw [OFOutOfRangeException
			    exceptionWithClass: [self class]];

		self = [self initWithItemSize: 1
				     capacity: (size_t)size];

		@try {
			size_t pageSize = [OFSystemInfo pageSize];
			char *buffer = [self allocMemoryWithSize: pageSize];

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

Modified src/OFMD5Hash.m from [f6e92bc9b9] to [969e062cb6].

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

		if (length < t) {
			memcpy(p, buffer, length);
			return;
		}

		memcpy(p, buffer, t);
		BSWAP32_VEC_IF_BE(in.u32, 16);
		md5_transform(_buffer, _in.u32);

		buffer += t;
		length -= t;
	}

	/* Process data in 64-byte chunks */







|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

		if (length < t) {
			memcpy(p, buffer, length);
			return;
		}

		memcpy(p, buffer, t);
		BSWAP32_VEC_IF_BE(_in.u32, 16);
		md5_transform(_buffer, _in.u32);

		buffer += t;
		length -= t;
	}

	/* Process data in 64-byte chunks */
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261

		/* Now fill the next block with 56 bytes */
		memset(_in.u8, 0, 56);
	} else {
		/* Pad block to 56 bytes */
		memset(p, 0, count - 8);
	}
	BSWAP32_VEC_IF_BE(in.u32, 14);

	/* Append length in bits and transform */
	_in.u32[14] = _bits[0];
	_in.u32[15] = _bits[1];

	md5_transform(_buffer, _in.u32);
	BSWAP32_VEC_IF_BE(_buffer, 4);

	_calculated = YES;

	return (uint8_t*)_buffer;
}
@end







|













241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261

		/* Now fill the next block with 56 bytes */
		memset(_in.u8, 0, 56);
	} else {
		/* Pad block to 56 bytes */
		memset(p, 0, count - 8);
	}
	BSWAP32_VEC_IF_BE(_in.u32, 14);

	/* Append length in bits and transform */
	_in.u32[14] = _bits[0];
	_in.u32[15] = _bits[1];

	md5_transform(_buffer, _in.u32);
	BSWAP32_VEC_IF_BE(_buffer, 4);

	_calculated = YES;

	return (uint8_t*)_buffer;
}
@end

Modified src/OFMutableDictionary.m from [3f243b3679] to [0f0750039f].

143
144
145
146
147
148
149
150
151
152
153
154


155
156
157
158
159
160
161
162
163
164
165
166
167
168


169
170
171
172
173
174
175
}

- init
{
	if (object_getClass(self) == [OFMutableDictionary class]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
			abort();
		} @catch (id e) {
			[self release];
			@throw e;
		}


	}

	return [super init];
}

- initWithCapacity: (size_t)capacity
{
	@try {
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
	}


}

- (void)setObject: (id)object
	   forKey: (id)key
{
	[self doesNotRecognizeSelector: _cmd];
	abort();







<




>
>









<




>
>







143
144
145
146
147
148
149

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

165
166
167
168
169
170
171
172
173
174
175
176
177
}

- init
{
	if (object_getClass(self) == [OFMutableDictionary class]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];

		} @catch (id e) {
			[self release];
			@throw e;
		}

		abort();
	}

	return [super init];
}

- initWithCapacity: (size_t)capacity
{
	@try {
		[self doesNotRecognizeSelector: _cmd];

	} @catch (id e) {
		[self release];
		@throw e;
	}

	abort();
}

- (void)setObject: (id)object
	   forKey: (id)key
{
	[self doesNotRecognizeSelector: _cmd];
	abort();