ObjFW  Check-in [bb17c57aa1]

Overview
Comment:Make some things static so they don't get exported.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bb17c57aa1c1abe6845ca5901559fc0d6b90c180853dc1d42560c30259c51e25
User & Date: js on 2008-11-01 17:56:46
Other Links: manifest | tags
Context
2008-11-01
18:10
Rename CData -> Data in createStanza:withCloseTag:andData:,...
Actually, it can be any data, not only cdata.
check-in: 344f03e297 user: js tags: trunk
17:56
Make some things static so they don't get exported. check-in: bb17c57aa1 user: js tags: trunk
17:08
Move some macros to OFMacros.h. check-in: fa2d377c18 user: js tags: trunk
Changes

Modified src/OFHashes.m from [ee4f52853e] to [796bcf7704].

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))

/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
	(w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x)

inline void
md5_transform(uint32_t buf[4], const uint32_t in[16])
{
	register uint32_t a, b, c, d;

	a = buf[0];
	b = buf[1];
	c = buf[2];







|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))

/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
	(w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x)

static inline void
md5_transform(uint32_t buf[4], const uint32_t in[16])
{
	register uint32_t a, b, c, d;

	a = buf[0];
	b = buf[1];
	c = buf[2];
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
	w = OF_ROL(w, 30);

typedef union {
	uint8_t	 c[64];
	uint32_t l[16];
} sha1_c64l16_t;

inline void
sha1_transform(uint32_t state[5], const uint8_t buffer[64])
{
	uint32_t      a, b, c, d, e;
	uint8_t	      workspace[64];
	sha1_c64l16_t *block;

	block = (sha1_c64l16_t*)workspace;







|







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
	w = OF_ROL(w, 30);

typedef union {
	uint8_t	 c[64];
	uint32_t l[16];
} sha1_c64l16_t;

static inline void
sha1_transform(uint32_t state[5], const uint8_t buffer[64])
{
	uint32_t      a, b, c, d, e;
	uint8_t	      workspace[64];
	sha1_c64l16_t *block;

	block = (sha1_c64l16_t*)workspace;

Modified src/OFMacros.h from [de6e95837e] to [6cc9a6a558].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

#define OF_NOT_IMPLEMENTED(ret)						\
	[[OFNotImplementedException newWithObject: self			\
				      andSelector: _cmd] raise];	\
	return ret;

#ifdef OF_BIG_ENDIAN
inline void
OF_BSWAP_V(uint8_t *buf, size_t len)
{
	uint32_t t;

	while (len--) {
		t = (uint32_t)((uint32_t)buf[3] << 8 | buf[2]) << 16 |
		    ((uint32_t)buf[1] << 8 | buf[0]);







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

#define OF_NOT_IMPLEMENTED(ret)						\
	[[OFNotImplementedException newWithObject: self			\
				      andSelector: _cmd] raise];	\
	return ret;

#ifdef OF_BIG_ENDIAN
static inline void
OF_BSWAP_V(uint8_t *buf, size_t len)
{
	uint32_t t;

	while (len--) {
		t = (uint32_t)((uint32_t)buf[3] << 8 | buf[2]) << 16 |
		    ((uint32_t)buf[1] << 8 | buf[0]);

Modified src/OFXMLFactory.m from [e4ef2335c1] to [4580b46438].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 * We don't use OFString in this file for performance reasons!
 *
 * We already have a clue about how big the resulting string will get, so we
 * can prealloc and only resize when really necessary - OFString would always
 * resize when we append, which would be slow here.
 */

inline BOOL
xmlfactory_resize(char **str, size_t *len, size_t add)
{
	char *str2;
	size_t len2;

	len2 = *len + add;
	
	if ((str2 = realloc(*str, len2)) == NULL) {
		if (*str)
			free(*str);
		*str = NULL;
		return NO;
	}

	*str = str2;
	*len = len2;

	return YES;
}

inline BOOL
xmlfactory_add2str(char **str, size_t *len, size_t *pos, const char *add)
{
	size_t add_len;

	add_len = strlen(add);

	if (!xmlfactory_resize(str, len, add_len))







|




















|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 * We don't use OFString in this file for performance reasons!
 *
 * We already have a clue about how big the resulting string will get, so we
 * can prealloc and only resize when really necessary - OFString would always
 * resize when we append, which would be slow here.
 */

static inline BOOL
xmlfactory_resize(char **str, size_t *len, size_t add)
{
	char *str2;
	size_t len2;

	len2 = *len + add;
	
	if ((str2 = realloc(*str, len2)) == NULL) {
		if (*str)
			free(*str);
		*str = NULL;
		return NO;
	}

	*str = str2;
	*len = len2;

	return YES;
}

static inline BOOL
xmlfactory_add2str(char **str, size_t *len, size_t *pos, const char *add)
{
	size_t add_len;

	add_len = strlen(add);

	if (!xmlfactory_resize(str, len, add_len))