ObjFW  Check-in [9338313079]

Overview
Comment:There is a good reason to return id and not OFObject*.

When using OFObject*, you have to cast to get rid of a warning when
calling methods on the returned object.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9338313079064e061b2e0fe46a12cec66e603a73d7dc094f717edafb52840c2c
User & Date: js on 2009-05-05 14:00:10
Other Links: manifest | tags
Context
2009-05-05
15:04
Add - splitWithDelimiter: to OFString. check-in: 029d4af91d user: js tags: trunk
14:00
There is a good reason to return id and not OFObject*. check-in: 9338313079 user: js tags: trunk
12:05
Rename OFArray to OFDataArray and add a new OFArray which stores objects.
Additionally, change OFAutoreleasePool to use the new OFArray.
check-in: 2a4aa05a84 user: js tags: trunk
Changes

Modified src/OFArray.h from [10629d9d3f] to [bc12ad5131].

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

/**
 * Returns a specific object of the OFDataArray.
 *
 * \param index The number of the object to return
 * \return The specified object of the OFArray
 */
- (OFObject*)object: (size_t)index;

/**
 * \return The last object of the OFDataArray
 */
- (OFObject*)last;

/**
 * Adds an object to the OFDataArray.
 *
 * \param obj An object to add
 */
- add: (OFObject*)obj;







|




|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

/**
 * Returns a specific object of the OFDataArray.
 *
 * \param index The number of the object to return
 * \return The specified object of the OFArray
 */
- (id)object: (size_t)index;

/**
 * \return The last object of the OFDataArray
 */
- (id)last;

/**
 * Adds an object to the OFDataArray.
 *
 * \param obj An object to add
 */
- add: (OFObject*)obj;

Modified src/OFArray.m from [37d0e0f0dd] to [340e813c87].

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

	for (i = 0; i < len; i++)
		[objs[i] retain];

	return new;
}

- (OFObject*)object: (size_t)index
{
	return *((OFObject**)[array item: index]);
}

- (OFObject*)last
{
	return *((OFObject**)[array last]);
}

- add: (OFObject*)obj
{
	[array add: &obj];







|




|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

	for (i = 0; i < len; i++)
		[objs[i] retain];

	return new;
}

- (id)object: (size_t)index
{
	return *((OFObject**)[array item: index]);
}

- (id)last
{
	return *((OFObject**)[array last]);
}

- add: (OFObject*)obj
{
	[array add: &obj];

Modified src/OFDictionary.h from [c2545c6818] to [7c028d029d].

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- set: (OFObject*)key
   to: (OFObject*)obj;

/**
 * \param key The key whose object should be returned
 * \return The object for the given key
 */
- get: (OFObject*)key;

/**
 * Remove the object with the given key from the dictionary.
 *
 * \param key The key whose object should be removed
 */
- remove: (OFObject*)key;







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- set: (OFObject*)key
   to: (OFObject*)obj;

/**
 * \param key The key whose object should be returned
 * \return The object for the given key
 */
- (id)get: (OFObject*)key;

/**
 * Remove the object with the given key from the dictionary.
 *
 * \param key The key whose object should be removed
 */
- remove: (OFObject*)key;

Modified src/OFDictionary.m from [078e9942b2] to [8b4c9a4782].

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

	[data[hash] append: key];
	[data[hash] append: obj];

	return self;
}

- get: (OFObject*)key
{
	uint32_t hash;
	of_list_object_t *iter;

	if (key == nil)
		@throw [OFInvalidArgumentException newWithClass: isa];








|







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

	[data[hash] append: key];
	[data[hash] append: obj];

	return self;
}

- (id)get: (OFObject*)key
{
	uint32_t hash;
	of_list_object_t *iter;

	if (key == nil)
		@throw [OFInvalidArgumentException newWithClass: isa];