ObjFW  Check-in [e08efd62c2]

Overview
Comment:Too much was changed here from uint8_t to char. Fixed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e08efd62c2b12d0b5ebc3c31408b0a9a7239b591756461d387dc1eab9ac4ed0a
User & Date: js on 2009-04-10 01:04:49
Other Links: manifest | tags
Context
2009-04-10
01:12
-Wall was added too early to (OBJ)CFLAGS. check-in: 2477baa59a user: js tags: trunk
01:04
Too much was changed here from uint8_t to char. Fixed. check-in: e08efd62c2 user: js tags: trunk
00:52
Fix warnings on Leopard in OFConstString.
As there are no warnings anymore, reintroduce -Werror.
check-in: 72af773f72 user: js tags: trunk
Changes

Modified src/OFHashes.h from [6473ae53f6] to [1c2aa1b471].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * The OFMD5Hash class provides functions to create an MD5 hash.
 */
@interface OFMD5Hash: OFObject
{
	uint32_t buf[4];
	uint32_t bits[2];
	char	 in[64];

	BOOL	 calculated;
}

/**
 * \return A new autoreleased MD5 Hash
 */







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * The OFMD5Hash class provides functions to create an MD5 hash.
 */
@interface OFMD5Hash: OFObject
{
	uint32_t buf[4];
	uint32_t bits[2];
	uint8_t	 in[64];

	BOOL	 calculated;
}

/**
 * \return A new autoreleased MD5 Hash
 */

Modified src/OFHashes.m from [fb812c0e73] to [b4e6d30015].

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
	bits[1] += size >> 29;

	/* Bytes already in shsInfo->data */
	t = (t >> 3) & 0x3F;

	/* Handle any leading odd-sized chunks */
	if (t) {
		char *p = in + t;

		t = 64 - t;

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







|







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
	bits[1] += size >> 29;

	/* Bytes already in shsInfo->data */
	t = (t >> 3) & 0x3F;

	/* Handle any leading odd-sized chunks */
	if (t) {
		uint8_t *p = in + t;

		t = 64 - t;

		if (size < t) {
			memcpy(p, buffer, size);
			return self;
		}
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
	memcpy(in, buffer, size);

	return self;
}

- (char*)digest
{
	char	*p;
	size_t	count;

	if (calculated)
		return (char*)buf;

	/* Compute number of bytes mod 64 */
	count = (bits[0] >> 3) & 0x3F;







|







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
	memcpy(in, buffer, size);

	return self;
}

- (char*)digest
{
	uint8_t	*p;
	size_t	count;

	if (calculated)
		return (char*)buf;

	/* Compute number of bytes mod 64 */
	count = (bits[0] >> 3) & 0x3F;
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
	OF_BSWAP_V(in, 14);

	/* Append length in bits and transform */
	((uint32_t*)in)[14] = bits[0];
	((uint32_t*)in)[15] = bits[1];

	md5_transform(buf, (uint32_t*)in);
	OF_BSWAP_V((char*)buf, 4);

	calculated = YES;

	return (char*)buf;
}
@end








|







229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
	OF_BSWAP_V(in, 14);

	/* Append length in bits and transform */
	((uint32_t*)in)[14] = bits[0];
	((uint32_t*)in)[15] = bits[1];

	md5_transform(buf, (uint32_t*)in);
	OF_BSWAP_V((uint8_t*)buf, 4);

	calculated = YES;

	return (char*)buf;
}
@end