25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifdef HAVE_MADVISE
# include <sys/mman.h>
#else
# define madvise(addr, len, advise)
#endif
#import "OFString.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
|
>
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#ifdef HAVE_MADVISE
# include <sys/mman.h>
#else
# define madvise(addr, len, advise)
#endif
#import "OFString.h"
#import "OFAutoreleasePool.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
string = [self resizeMemory: string
toSize: length + length_ + 1];
memcpy(string + length, string_, length_);
length += length_;
string[length] = 0;
}
- (void)appendCStringWithoutUTF8Checking: (const char*)string_
{
size_t len;
len = strlen(string_);
string = [self resizeMemory: string
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
string = [self resizeMemory: string
toSize: length + length_ + 1];
memcpy(string + length, string_, length_);
length += length_;
string[length] = 0;
}
- (void)appendCString: (const char*)string_
withEncoding: (of_string_encoding_t)encoding
length: (size_t)length_
{
if (encoding == OF_STRING_ENCODING_UTF_8)
[self appendCString: string_
withLength: length_];
else {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
[self appendString: [OFString stringWithCString: string_
encoding: encoding
length: length_]];
[pool release];
}
}
- (void)appendCStringWithoutUTF8Checking: (const char*)string_
{
size_t len;
len = strlen(string_);
string = [self resizeMemory: string
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
{
string = [self resizeMemory: string
toSize: length + length_ + 1];
memcpy(string + length, string_, length_);
length += length_;
string[length] = 0;
}
- (void)appendString: (OFString*)string_
{
if (string_ == nil)
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
230
231
232
233
234
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
|
{
string = [self resizeMemory: string
toSize: length + length_ + 1];
memcpy(string + length, string_, length_);
length += length_;
string[length] = 0;
}
- (void)appendCStringWithoutUTF8Checking: (const char*)string_
encoding: (of_string_encoding_t)encoding
length: (size_t)length_
{
if (encoding == OF_STRING_ENCODING_UTF_8)
[self appendCStringWithoutUTF8Checking: string_
length: length_];
else {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
[self appendString: [OFString stringWithCString: string_
encoding: encoding
length: length_]];
[pool release];
}
}
- (void)appendString: (OFString*)string_
{
if (string_ == nil)
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
|