ObjFW  Diff

Differences From Artifact [3ed2ba1cf6]:

To Artifact [3833fffedc]:


18
19
20
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

57
58
59
60
61
62
63
64
65


66
67
68
69
70
71
72

73
74
75


76
77
78
79
80

81
82
83
84
85
86
87


88
89
90
91
92

93
94
95
96
97
98

99
100
101
102
103
104
105

106
107

108
109
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
157


158
159
160
161
162
163
164
165
166
167


168
169
170
171
172
173

174
175
176
177
178
179

180
181
182
183
184
185
186
187
188

189
190
191
192
193
194

195
196
197
198
199
200
201
202
203

204
205
206
207
208
209
210
18
19
20
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
57
58
59
60
61
62


63
64
65
66
67
68
69
70

71



72
73
74
75
76
77

78
79
80
81
82
83


84
85
86
87
88
89

90
91
92
93
94
95

96
97
98
99
100
101
102

103


104
105
106
107
108
109
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
157
158
159


160
161
162
163
164
165
166

167
168
169
170
171
172

173
174
175
176
177
178
179
180
181

182
183
184
185
186
187

188
189
190
191
192
193
194
195


196
197
198
199
200
201
202
203







-
+












-
+


-
+


-
+




-
-
+





-
+







-
-
+
+






-
+
-
-
-
+
+




-
+





-
-
+
+




-
+





-
+






-
+
-
-
+






-
+
-
-
-
+
+




-
+





-
-
+
+





-
+
-
-
+






-
+
-
-
-
+
+








-
-
+
+








-
-
+
+





-
+





-
+








-
+





-
+







-
-
+







#include "config.h"

#include <stdarg.h>
#include <stdlib.h>
#include <string.h>

#import "OFString.h"
#import "OFMutableString_UTF8.h"
#import "OFMutableUTF8String.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"

#import "of_asprintf.h"
#import "unicode.h"

static struct {
	Class isa;
} placeholder;

@interface OFMutableString_placeholder: OFMutableString
@interface OFMutableStringPlaceholder: OFMutableString
@end

@implementation OFMutableString_placeholder
@implementation OFMutableStringPlaceholder
- (instancetype)init
{
	return (id)[[OFMutableString_UTF8 alloc] init];
	return (id)[[OFMutableUTF8String alloc] init];
}

- (instancetype)initWithUTF8String: (const char *)UTF8String
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF8String: UTF8String];
	return (id)[[OFMutableUTF8String alloc] initWithUTF8String: UTF8String];
}

- (instancetype)initWithUTF8String: (const char *)UTF8String
			    length: (size_t)UTF8StringLength
{
	return (id)[[OFMutableString_UTF8 alloc]
	return (id)[[OFMutableUTF8String alloc]
	    initWithUTF8String: UTF8String
			length: UTF8StringLength];
}

- (instancetype)initWithCString: (const char *)cString
		       encoding: (of_string_encoding_t)encoding
{
	return (id)[[OFMutableString_UTF8 alloc] initWithCString: cString
							encoding: encoding];
	return (id)[[OFMutableUTF8String alloc] initWithCString: cString
						       encoding: encoding];
}

- (instancetype)initWithCString: (const char *)cString
		       encoding: (of_string_encoding_t)encoding
			 length: (size_t)cStringLength
{
	return (id)[[OFMutableString_UTF8 alloc]
	return (id)[[OFMutableUTF8String alloc] initWithCString: cString
	    initWithCString: cString
		   encoding: encoding
		     length: cStringLength];
						       encoding: encoding
							 length: cStringLength];
}

- (instancetype)initWithString: (OFString *)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithString: string];
	return (id)[[OFMutableUTF8String alloc] initWithString: string];
}

- (instancetype)initWithCharacters: (const of_unichar_t *)characters
			    length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithCharacters: characters
							     length: length];
	return (id)[[OFMutableUTF8String alloc] initWithCharacters: characters
							    length: length];
}

- (instancetype)initWithUTF16String: (const of_char16_t *)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string];
	return (id)[[OFMutableUTF8String alloc] initWithUTF16String: string];
}

- (instancetype)initWithUTF16String: (const of_char16_t *)string
			     length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string
	return (id)[[OFMutableUTF8String alloc] initWithUTF16String: string
							      length: length];
}

- (instancetype)initWithUTF16String: (const of_char16_t *)string
			  byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	return (id)[[OFMutableUTF8String alloc] initWithUTF16String: string
	    initWithUTF16String: string
		      byteOrder: byteOrder];
							  byteOrder: byteOrder];
}

- (instancetype)initWithUTF16String: (const of_char16_t *)string
			     length: (size_t)length
			  byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	return (id)[[OFMutableUTF8String alloc] initWithUTF16String: string
	    initWithUTF16String: string
			 length: length
		      byteOrder: byteOrder];
							     length: length
							  byteOrder: byteOrder];
}

- (instancetype)initWithUTF32String: (const of_char32_t *)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string];
	return (id)[[OFMutableUTF8String alloc] initWithUTF32String: string];
}

- (instancetype)initWithUTF32String: (const of_char32_t *)string
			     length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string
							      length: length];
	return (id)[[OFMutableUTF8String alloc] initWithUTF32String: string
							     length: length];
}

- (instancetype)initWithUTF32String: (const of_char32_t *)string
			  byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	return (id)[[OFMutableUTF8String alloc] initWithUTF32String: string
	    initWithUTF32String: string
		      byteOrder: byteOrder];
							  byteOrder: byteOrder];
}

- (instancetype)initWithUTF32String: (const of_char32_t *)string
			     length: (size_t)length
			  byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	return (id)[[OFMutableUTF8String alloc] initWithUTF32String: string
	    initWithUTF32String: string
			 length: length
		      byteOrder: byteOrder];
							     length: length
							  byteOrder: byteOrder];
}

- (instancetype)initWithFormat: (OFConstantString *)format, ...
{
	id ret;
	va_list arguments;

	va_start(arguments, format);
	ret = [[OFMutableString_UTF8 alloc] initWithFormat: format
						 arguments: arguments];
	ret = [[OFMutableUTF8String alloc] initWithFormat: format
						arguments: arguments];
	va_end(arguments);

	return ret;
}

- (instancetype)initWithFormat: (OFConstantString *)format
		     arguments: (va_list)arguments
{
	return (id)[[OFMutableString_UTF8 alloc] initWithFormat: format
						      arguments: arguments];
	return (id)[[OFMutableUTF8String alloc] initWithFormat: format
						     arguments: arguments];
}

#ifdef OF_HAVE_FILES
- (instancetype)initWithContentsOfFile: (OFString *)path
{
	return (id)[[OFMutableString_UTF8 alloc] initWithContentsOfFile: path];
	return (id)[[OFMutableUTF8String alloc] initWithContentsOfFile: path];
}

- (instancetype)initWithContentsOfFile: (OFString *)path
			      encoding: (of_string_encoding_t)encoding
{
	return (id)[[OFMutableString_UTF8 alloc]
	return (id)[[OFMutableUTF8String alloc]
	    initWithContentsOfFile: path
			  encoding: encoding];
}
#endif

#if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS)
- (instancetype)initWithContentsOfURL: (OFURL *)URL
{
	return (id)[[OFMutableString_UTF8 alloc] initWithContentsOfURL: URL];
	return (id)[[OFMutableUTF8String alloc] initWithContentsOfURL: URL];
}

- (instancetype)initWithContentsOfURL: (OFURL *)URL
			     encoding: (of_string_encoding_t)encoding
{
	return (id)[[OFMutableString_UTF8 alloc]
	return (id)[[OFMutableUTF8String alloc]
	    initWithContentsOfURL: URL
			 encoding: encoding];
}
#endif

- (instancetype)initWithSerialization: (OFXMLElement *)element
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithSerialization: element];
	return (id)[[OFMutableUTF8String alloc] initWithSerialization: element];
}

- (instancetype)retain
{
	return self;
}

223
224
225
226
227
228
229
230

231
232
233
234
235
236
237
216
217
218
219
220
221
222

223
224
225
226
227
228
229
230







-
+







}
@end

@implementation OFMutableString
+ (void)initialize
{
	if (self == [OFMutableString class])
		placeholder.isa = [OFMutableString_placeholder class];
		placeholder.isa = [OFMutableStringPlaceholder class];
}

+ (instancetype)alloc
{
	if (self == [OFMutableString class])
		return (id)&placeholder;