ObjFW  Diff

Differences From Artifact [aa5a117197]:

To Artifact [2ecf3b040e]:


10
11
12
13
14
15
16

17
18
19
20
21
22
23
 */

#import "config.h"

#define _GNU_SOURCE
#import <stdio.h>
#import <stdlib.h>


#import <objc/objc-api.h>

#import "OFExceptions.h"

#if defined HAVE_SEL_GET_NAME
#define SEL_NAME(x) sel_get_name(x)







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 */

#import "config.h"

#define _GNU_SOURCE
#import <stdio.h>
#import <stdlib.h>
#import <string.h>

#import <objc/objc-api.h>

#import "OFExceptions.h"

#if defined HAVE_SEL_GET_NAME
#define SEL_NAME(x) sel_get_name(x)
65
66
67
68
69
70
71
72

73
74




75
76
77
78
79
80
81
	return [[OFNoMemException alloc] initWithObject: obj
						andSize: size];
}

- initWithObject: (id)obj
	 andSize: (size_t)size
{
	if ((self = [super init]))

		asprintf(&errstr, "ERROR: Could not allocate %zu bytes for "
		    "object of class %s!\n", size, [obj name]);





	return self;
}
@end

@implementation OFNotImplementedException
+ newWithObject: (id)obj







|
>
|
|
>
>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	return [[OFNoMemException alloc] initWithObject: obj
						andSize: size];
}

- initWithObject: (id)obj
	 andSize: (size_t)size
{
	if ((self = [super init])) {
		if (obj != nil)
			asprintf(&errstr, "ERROR: Could not allocate %zu bytes "
			    "for object of class %s!\n", size, [obj name]);
		else
			asprintf(&errstr, "ERROR: Could not allocate %zu bytes "
			    "for object of class (null)!\n", size);
	}

	return self;
}
@end

@implementation OFNotImplementedException
+ newWithObject: (id)obj
123
124
125
126
127
128
129
130

131
132




133
134
135
136
137
138
139
+ newWithObject: (id)obj
{
	return [[OFOverflowException alloc] initWithObject: obj];
}

- initWithObject: (id)obj
{
	if ((self = [super init]))

		asprintf(&errstr, "ERROR: Overflow in object of class %s!\n",
		    [obj name]);





	return self;
}
@end

@implementation OFOpenFileFailedException
+ newWithObject: (id)obj







|
>
|
|
>
>
>
>







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
+ newWithObject: (id)obj
{
	return [[OFOverflowException alloc] initWithObject: obj];
}

- initWithObject: (id)obj
{
	if ((self = [super init])) {
		if (obj != nil)
			asprintf(&errstr, "ERROR: Overflow in object of class "
			    "%s!\n", [obj name]);
		else
			errstr = strdup("ERROR: Overflow in object of class "
			    "(null)!\n");
	}

	return self;
}
@end

@implementation OFOpenFileFailedException
+ newWithObject: (id)obj