ObjFW  Diff

Differences From Artifact [4ac6f2f10b]:

To Artifact [47e102896c]:


47
48
49
50
51
52
53





54
55
56
57
58
59
60
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65







+
+
+
+
+







- free
{
	if (string != NULL)
		free(string);

	return [super free];
}

- (id)object
{
	return object;
}

- (char*)cString
{
	return string;
}
@end

76
77
78
79
80
81
82
83
84


85
86
87
88
89
90
91
81
82
83
84
85
86
87


88
89
90
91
92
93
94
95
96







-
-
+
+







}

- (char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "ERROR: Could not allocate %zu bytes for object of "
	    "class %s!\n", req_size, object != nil ? [object name] : "(null)");
	asprintf(&string, "Could not allocate %zu bytes for object of class "
	    "%s!", req_size, object != nil ? [object name] : "(null)");

	return string;
}

- (size_t)requestedSize
{
	return req_size;
110
111
112
113
114
115
116
117

118
119
120
121
122



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
115
116
117
118
119
120
121

122





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










137
138
139
140
141

142
143
144
145
146
147
148
149







-
+
-
-
-
-
-
+
+
+











-
-
-
-
-
-
-
-
-
-





-
+







}

- (char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "ERROR: Memory at %p was not allocated as part of "
	asprintf(&string, "Memory at %p was not allocated as part of object "
	    "object of class\n"
	    "ERROR: %s!\n"
	    "ERROR: -> Not changing memory allocation!\n"
	    "ERROR: (Hint: It is also possible that you tried to free the same "
	    "memory twice!)\n", pointer, [object name]);
	    "of class %s, thus the memory allocation was not changed! It is "
	    "also possible that there was an attempt to free the same memory "
	    "twice.", pointer, [object name]);

	return string;
}

- (void*)pointer
{
	return pointer;
}
@end

@implementation OFOutOfRangeException
+ newWithObject: (id)obj
{
	return [[self alloc] initWithObject: obj];
}

- initWithObject: (id)obj
{
	return (self = [super initWithObject: obj]);
}

- (char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "ERROR: Value out of range in object of class %s!\n",
	asprintf(&string, "Value out of range in object of class %s!",
	    object != nil ? [object name] : "(null)");

	return string;
}
@end

@implementation OFOpenFileFailedException
186
187
188
189
190
191
192
193
194


195
196
197
198
199
200
201
179
180
181
182
183
184
185


186
187
188
189
190
191
192
193
194







-
-
+
+







}

- (char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "ERROR: Failed to open file %s with mode %s "
	    "in object of class %s!\n", path, mode, [self name]);
	asprintf(&string, "Failed to open file %s with mode %s in object of "
	    "class %s!", path, mode, [self name]);

	return string;
}

- (char*)path
{
	return path;
242
243
244
245
246
247
248
249
250


251
252
253
254
255
256
257
258
259
260
261
262
263




























264
265
266
267
235
236
237
238
239
240
241


242
243
244
245
246
247
248
249
250
251
252
253
254


255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286







-
-
+
+











-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+





@implementation OFReadFailedException
- (char*)cString
{
	if (string != NULL)
		return string;;

	asprintf(&string, "ERROR: Failed to read %zu items of size %zu in "
	    "object of class %s!\n", req_items, req_size, [object name]);
	asprintf(&string, "Failed to read %zu items of size %zu in object of "
	    "class %s!", req_items, req_size, [object name]);

	return string;
}
@end

@implementation OFWriteFailedException
- (char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "ERROR: Failed to write %zu items of size %zu in "
	    "object of class %s!\n", req_items, req_size, [object name]);
	asprintf(&string, "Failed to write %zu items of size %zu in object of "
	    "class %s!", req_items, req_size, [object name]);

	return string;
}
@end

@implementation OFNotConnectedException
- (char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The socket of type %s is not connected or bound!",
	    [object name]);

	return string;
}
@end

@implementation OFAlreadyConnectedException
- (char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The socket of type %s is already connected or bound "
	    "and thus can't be connected or bound again!", [object name]);

	return string;
}
@end