ObjFW  Check-in [89d53f2a9a]

Overview
Comment:Add a few "const" where they make sense.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 89d53f2a9a4fb0ad4aab6df029facdf72ca2fa8b0235b134ea2256f20b063234
User & Date: js on 2012-03-29 07:57:34
Other Links: manifest | tags
Context
2012-04-03
15:30
Don't compare blocks to nil. check-in: c223ace803 user: js tags: trunk
2012-03-29
07:57
Add a few "const" where they make sense. check-in: 89d53f2a9a user: js tags: trunk
2012-03-28
09:25
Add +[OFSet setWithObjects:count:]. check-in: 5e98e61531 user: js tags: trunk
Changes

Modified src/OFArray.h from [1778f85d38] to [bde628b396].

83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97







-
+







 * \brief Creates a new OFArray with the objects from the specified C array of
 *	  the specified length.
 *
 * \param objects A C array of objects
 * \param length The length of the C array
 * \return A new autoreleased OFArray
 */
+ arrayWithObjects: (id*)objects
+ arrayWithObjects: (id const*)objects
	     count: (size_t)count;

/**
 * \brief Initializes an OFArray with the specified object.
 *
 * \param object An object
 * \return An initialized OFArray
128
129
130
131
132
133
134
135

136
137
138
139
140
141
142
128
129
130
131
132
133
134

135
136
137
138
139
140
141
142







-
+







 * \brief Initializes an OFArray with the objects from the specified C array of
 *	  the specified length.
 *
 * \param objects A C array of objects
 * \param length The length of the C array
 * \return An initialized OFArray
 */
- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count;

/**
 * \brief Returns a specified object of the array.
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!

Modified src/OFArray.m from [652b854188] to [006ecd6265].

71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85







-
+







}

- initWithArray: (OFArray*)array
{
	return (id)[[OFArray_adjacent alloc] initWithArray: array];
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	return (id)[[OFArray_adjacent alloc] initWithObjects: objects
						       count: count];
}

- initWithSerialization: (OFXMLElement*)element
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
148
149
150
151
152
153
154

155
156
157
158
159
160
161
162







-
+







}

+ arrayWithArray: (OFArray*)array
{
	return [[[self alloc] initWithArray: array] autorelease];
}

+ arrayWithObjects: (id*)objects
+ arrayWithObjects: (id const*)objects
	     count: (size_t)count
{
	return [[[self alloc] initWithObjects: objects
					count: count] autorelease];
}

- init
202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
202
203
204
205
206
207
208

209
210
211
212
213
214
215
216







-
+







{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];
}

Modified src/OFArray_adjacent.m from [0afb4e2882] to [c8a1da4bf7].

117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
117
118
119
120
121
122
123

124
125
126
127
128
129
130
131







-
+







		[self release];
		@throw e;
	}

	return self;
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	self = [self init];

	@try {
		size_t i;

Modified src/OFCountedSet.m from [6fbc6bd897] to [1ffb5da144].

57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71







-
+







	ret = [[OFCountedSet_hashtable alloc] initWithObject: firstObject
						   arguments: arguments];
	va_end(arguments);

	return ret;
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	return (id)[[OFCountedSet_hashtable alloc] initWithObjects: objects
							     count: count];
}

- initWithObject: (id)firstObject

Modified src/OFCountedSet_hashtable.m from [1e8e3d5e5e] to [18146f1db1].

90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
90
91
92
93
94
95
96

97
98
99
100
101
102
103
104







-
+







		[self release];
		@throw e;
	}

	return self;
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	self = [self init];

	@try {
		size_t i;

Modified src/OFDictionary.h from [03d734b6a0] to [4adf9b615c].

87
88
89
90
91
92
93
94
95


96
97
98
99
100
101
102
87
88
89
90
91
92
93


94
95
96
97
98
99
100
101
102







-
-
+
+







 * \brief Creates a new OFDictionary with the specified keys and objects.
 *
 * \param keys An array of keys
 * \param objects An array of objects
 * \param count The number of objects in the arrays
 * \return A new autoreleased OFDictionary
 */
+ dictionaryWithObjects: (id*)objects
		forKeys: (id*)keys
+ dictionaryWithObjects: (id const*)objects
		forKeys: (id const*)keys
		  count: (size_t)count;

/**
 * \brief Creates a new OFDictionary with the specified keys objects.
 *
 * \param firstKey The first key
 * \return A new autoreleased OFDictionary
146
147
148
149
150
151
152
153
154


155
156
157
158
159
160
161
146
147
148
149
150
151
152


153
154
155
156
157
158
159
160
161







-
-
+
+







 *	  and objects.
 *
 * \param keys An array of keys
 * \param objects An array of objects
 * \param count The number of objects in the arrays
 * \return A new initialized OFDictionary
 */
- initWithObjects: (id*)objects
	  forKeys: (id*)keys
- initWithObjects: (id const*)objects
	  forKeys: (id const*)keys
	    count: (size_t)count;

/**
 * \brief Initializes an already allocated OFDictionary with the specified keys
 *	  and objects.
 *
 * \param firstKey The first key

Modified src/OFDictionary.m from [e60712dc03] to [7004ce02ac].

56
57
58
59
60
61
62
63
64


65
66
67
68
69
70
71
56
57
58
59
60
61
62


63
64
65
66
67
68
69
70
71







-
-
+
+







- initWithObjects: (OFArray*)objects
	  forKeys: (OFArray*)keys
{
	return (id)[[OFDictionary_hashtable alloc] initWithObjects: objects
							   forKeys: keys];
}

- initWithObjects: (id*)objects
	  forKeys: (id*)keys
- initWithObjects: (id const*)objects
	  forKeys: (id const*)keys
	    count: (size_t)count
{
	return (id)[[OFDictionary_hashtable alloc] initWithObjects: objects
							   forKeys: keys
							     count: count];
}

152
153
154
155
156
157
158
159
160


161
162
163
164
165
166
167
152
153
154
155
156
157
158


159
160
161
162
163
164
165
166
167







-
-
+
+







+ dictionaryWithObjects: (OFArray*)objects
		forKeys: (OFArray*)keys
{
	return [[[self alloc] initWithObjects: objects
				      forKeys: keys] autorelease];
}

+ dictionaryWithObjects: (id*)objects
		forKeys: (id*)keys
+ dictionaryWithObjects: (id const*)objects
		forKeys: (id const*)keys
		  count: (size_t)count
{
	return [[[self alloc] initWithObjects: objects
				      forKeys: keys
					count: count] autorelease];
}

209
210
211
212
213
214
215
216
217


218
219
220
221
222
223
224
209
210
211
212
213
214
215


216
217
218
219
220
221
222
223
224







-
-
+
+







{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];
}

- initWithObjects: (id*)objects
	  forKeys: (id*)keys
- initWithObjects: (id const*)objects
	  forKeys: (id const*)keys
	    count: (size_t)count
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];
}

Modified src/OFDictionary_hashtable.m from [fd15d2ff3e] to [2511a02b50].

249
250
251
252
253
254
255
256
257


258
259
260
261
262
263
264
249
250
251
252
253
254
255


256
257
258
259
260
261
262
263
264







-
-
+
+







		[self release];
		@throw e;
	}

	return ret;
}

- initWithObjects: (id*)objects
	  forKeys: (id*)keys
- initWithObjects: (id const*)objects
	  forKeys: (id const*)keys
	    count: (size_t)count_
{
	self = [super init];

	@try {
		uint32_t i, j, newSize;

Modified src/OFMutableArray.m from [ef22d34f56] to [833d3b17ca].

104
105
106
107
108
109
110
111

112
113
114
115
116
117
118
104
105
106
107
108
109
110

111
112
113
114
115
116
117
118







-
+







}

- initWithArray: (OFArray*)array
{
	return (id)[[OFMutableArray_adjacent alloc] initWithArray: array];
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	return (id)[[OFMutableArray_adjacent alloc] initWithObjects: objects
							      count: count];
}

- initWithSerialization: (OFXMLElement*)element

Modified src/OFMutableDictionary.m from [9331cf055e] to [3637b5fc69].

51
52
53
54
55
56
57
58
59


60
61
62
63
64
65
66
51
52
53
54
55
56
57


58
59
60
61
62
63
64
65
66







-
-
+
+







	  forKeys: (OFArray*)keys
{
	return (id)[[OFMutableDictionary_hashtable alloc]
	    initWithObjects: objects
		    forKeys: keys];
}

- initWithObjects: (id*)objects
	  forKeys: (id*)keys
- initWithObjects: (id const*)objects
	  forKeys: (id const*)keys
	    count: (size_t)count
{
	return (id)[[OFMutableDictionary_hashtable alloc]
	    initWithObjects: objects
		    forKeys: keys
		      count: count];
}

Modified src/OFMutableSet.m from [be374057b2] to [112af5c677].

56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70







-
+







	ret = [[OFMutableSet_hashtable alloc] initWithObject: firstObject
						   arguments: arguments];
	va_end(arguments);

	return ret;
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	return (id)[[OFMutableSet_hashtable alloc] initWithObjects: objects
							     count: count];
}

- initWithObject: (id)firstObject

Modified src/OFSet.h from [3339e4633d] to [ec53fbdca5].

73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87







-
+







/**
 * \brief Creates a new set with the specified objects.
 *
 * \param objects An array of objects for the set
 * \param count The number of objects in the specified array
 * \return A new, autoreleased set with the specified objects
 */
+ setWithObjects: (id*)objects
+ setWithObjects: (id const*)objects
	   count: (size_t)count;

/**
 * \brief Initializes an already allocated set with the specified set.
 *
 * \param set The set to initialize the set with
 * \return An initialized set with the specified set
107
108
109
110
111
112
113
114

115
116
117
118
119
120
121
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121







-
+







/**
 * \brief Initializes an already allocated set with the specified objects.
 *
 * \param objects An array of objects for the set
 * \param count The number of objects in the specified array
 * \return An initialized set with the specified objects
 */
- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count;

/**
 * \brief Initializes an already allocated set with the specified object and
 *	  va_list.
 *
 * \param firstObject The first object for the set

Modified src/OFSet.m from [98a694fc77] to [fdc2275c3d].

56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70







-
+







	ret = [[OFSet_hashtable alloc] initWithObject: firstObject
					    arguments: arguments];
	va_end(arguments);

	return ret;
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	return (id)[[OFSet_hashtable alloc] initWithObjects: objects
						      count: count];
}

- initWithObject: (id)firstObject
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154
140
141
142
143
144
145
146

147
148
149
150
151
152
153
154







-
+







	ret = [[[self alloc] initWithObject: firstObject
				  arguments: arguments] autorelease];
	va_end(arguments);

	return ret;
}

+ setWithObjects: (id*)objects
+ setWithObjects: (id const*)objects
	   count: (size_t)count
{
	return [[[self alloc] initWithObjects: objects
					count: count] autorelease];
}

- init
188
189
190
191
192
193
194
195

196
197
198
199
200
201
202
188
189
190
191
192
193
194

195
196
197
198
199
200
201
202







-
+







	ret = [self initWithObject: firstObject
			 arguments: arguments];
	va_end(arguments);

	return ret;
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];
}

Modified src/OFSet_hashtable.m from [79c7f9b45c] to [bf071b8c76].

93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107







-
+







		[self release];
		@throw e;
	}

	return self;
}

- initWithObjects: (id*)objects
- initWithObjects: (id const*)objects
	    count: (size_t)count
{
	self = [self init];

	@try {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
		OFNumber *one = [OFNumber numberWithSize: 1];