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
|
/*
* It seems strtod is buggy on Win32.
* However, the MinGW version __strtod seems to be ok.
*/
#ifdef __MINGW32__
# define strtod __strtod
#endif
#if defined(HAVE_STRTOF_L) || defined(HAVE_STRTOD_L)
static locale_t cLocale;
#endif
@interface OFString ()
- (size_t)of_getCString: (char *)cString
maxLength: (size_t)maxLength
encoding: (of_string_encoding_t)encoding
lossy: (bool)lossy;
- (const char *)of_cStringWithEncoding: (of_string_encoding_t)encoding
lossy: (bool)lossy;
- (OFString *)of_JSONRepresentationWithOptions: (int)options
depth: (size_t)depth;
@end
extern bool of_unicode_to_iso_8859_2(const of_unichar_t *, unsigned char *,
size_t, bool);
extern bool of_unicode_to_iso_8859_3(const of_unichar_t *, unsigned char *,
size_t, bool);
extern bool of_unicode_to_iso_8859_15(const of_unichar_t *, unsigned char *,
size_t, bool);
|
>
>
>
>
>
>
>
|
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
|
/*
* It seems strtod is buggy on Win32.
* However, the MinGW version __strtod seems to be ok.
*/
#ifdef __MINGW32__
# define strtod __strtod
#endif
static struct {
Class isa;
} placeholder;
#if defined(HAVE_STRTOF_L) || defined(HAVE_STRTOD_L)
static locale_t cLocale;
#endif
@interface OFString ()
- (size_t)of_getCString: (char *)cString
maxLength: (size_t)maxLength
encoding: (of_string_encoding_t)encoding
lossy: (bool)lossy;
- (const char *)of_cStringWithEncoding: (of_string_encoding_t)encoding
lossy: (bool)lossy;
- (OFString *)of_JSONRepresentationWithOptions: (int)options
depth: (size_t)depth;
@end
@interface OFString_placeholder: OFString
@end
extern bool of_unicode_to_iso_8859_2(const of_unichar_t *, unsigned char *,
size_t, bool);
extern bool of_unicode_to_iso_8859_3(const of_unichar_t *, unsigned char *,
size_t, bool);
extern bool of_unicode_to_iso_8859_15(const of_unichar_t *, unsigned char *,
size_t, bool);
|
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
|
return encoding;
}
size_t
of_string_utf8_encode(of_unichar_t character, char *buffer)
{
size_t i = 0;
if (character < 0x80) {
buffer[i] = character;
return 1;
} else if (character < 0x800) {
buffer[i++] = 0xC0 | (character >> 6);
buffer[i] = 0x80 | (character & 0x3F);
return 2;
} else if (character < 0x10000) {
buffer[i++] = 0xE0 | (character >> 12);
buffer[i++] = 0x80 | (character >> 6 & 0x3F);
buffer[i] = 0x80 | (character & 0x3F);
return 3;
} else if (character < 0x110000) {
buffer[i++] = 0xF0 | (character >> 18);
buffer[i++] = 0x80 | (character >> 12 & 0x3F);
buffer[i++] = 0x80 | (character >> 6 & 0x3F);
buffer[i] = 0x80 | (character & 0x3F);
return 4;
}
return 0;
}
ssize_t
|
<
<
|
|
|
|
|
|
|
|
|
|
|
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
211
212
213
|
return encoding;
}
size_t
of_string_utf8_encode(of_unichar_t character, char *buffer)
{
if (character < 0x80) {
buffer[0] = character;
return 1;
} else if (character < 0x800) {
buffer[0] = 0xC0 | (character >> 6);
buffer[1] = 0x80 | (character & 0x3F);
return 2;
} else if (character < 0x10000) {
buffer[0] = 0xE0 | (character >> 12);
buffer[1] = 0x80 | (character >> 6 & 0x3F);
buffer[2] = 0x80 | (character & 0x3F);
return 3;
} else if (character < 0x110000) {
buffer[0] = 0xF0 | (character >> 18);
buffer[1] = 0x80 | (character >> 12 & 0x3F);
buffer[2] = 0x80 | (character >> 6 & 0x3F);
buffer[3] = 0x80 | (character & 0x3F);
return 4;
}
return 0;
}
ssize_t
|
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
}
objc_autoreleasePoolPop(pool);
return ret;
}
static struct {
Class isa;
} placeholder;
@interface OFString_placeholder: OFString
@end
@implementation OFString_placeholder
- (instancetype)init
{
return (id)[[OFString_UTF8 alloc] init];
}
- (instancetype)initWithUTF8String: (const char *)UTF8String
|
<
<
<
<
<
<
<
|
371
372
373
374
375
376
377
378
379
380
381
382
383
384
|
}
objc_autoreleasePoolPop(pool);
return ret;
}
@implementation OFString_placeholder
- (instancetype)init
{
return (id)[[OFString_UTF8 alloc] init];
}
- (instancetype)initWithUTF8String: (const char *)UTF8String
|