Overview
| Comment: | of_string_utf8_encode(): Remove a variable |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
455caa706387150f91784d305fff1b63 |
| User & Date: | js on 2017-11-06 00:10:21 |
| Other Links: | manifest | tags |
Context
|
2017-11-06
| ||
| 23:01 | OFURL: Store the URL-encoded version internally (check-in: a15b403a11 user: js tags: trunk) | |
| 00:10 | of_string_utf8_encode(): Remove a variable (check-in: 455caa7063 user: js tags: trunk) | |
|
2017-11-05
| ||
| 21:39 | Correctly handle Unicode when URL encoding (check-in: 645ae7ac0a user: js tags: trunk) | |
Changes
Modified src/OFString.m from [42646dafbd] to [a97d47a4cf].
| ︙ | ︙ | |||
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 |
return encoding;
}
size_t
of_string_utf8_encode(of_unichar_t character, char *buffer)
{
| < < | | | | | | | | | | | 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 | } objc_autoreleasePoolPop(pool); return ret; } | < < < < < < < | 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
|
| ︙ | ︙ |