103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
size_t, bool);
extern bool of_unicode_to_codepage_858(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_mac_roman(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_koi8_r(const of_unichar_t*, unsigned char*,
size_t, bool);
/* References for static linking */
void
_references_to_categories_of_OFString(void)
{
_OFString_CryptoHashing_reference = 1;
_OFString_JSONValue_reference = 1;
|
>
>
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
size_t, bool);
extern bool of_unicode_to_codepage_858(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_mac_roman(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_koi8_r(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_koi8_u(const of_unichar_t*, unsigned char*,
size_t, bool);
/* References for static linking */
void
_references_to_categories_of_OFString(void)
{
_OFString_CryptoHashing_reference = 1;
_OFString_JSONValue_reference = 1;
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
else if ([string isEqual: @"cp858"] || [string isEqual: @"cp-858"] ||
[string isEqual: @"ibm858"] || [string isEqual: @"858"])
encoding = OF_STRING_ENCODING_CODEPAGE_858;
else if ([string isEqual: @"macintosh"] || [string isEqual: @"mac"])
encoding = OF_STRING_ENCODING_MAC_ROMAN;
else if ([string isEqual: @"koi8-r"])
encoding = OF_STRING_ENCODING_KOI8_R;
else
@throw [OFInvalidEncodingException exception];
objc_autoreleasePoolPop(pool);
return encoding;
}
|
>
>
|
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
else if ([string isEqual: @"cp858"] || [string isEqual: @"cp-858"] ||
[string isEqual: @"ibm858"] || [string isEqual: @"858"])
encoding = OF_STRING_ENCODING_CODEPAGE_858;
else if ([string isEqual: @"macintosh"] || [string isEqual: @"mac"])
encoding = OF_STRING_ENCODING_MAC_ROMAN;
else if ([string isEqual: @"koi8-r"])
encoding = OF_STRING_ENCODING_KOI8_R;
else if ([string isEqual: @"koi8-u"])
encoding = OF_STRING_ENCODING_KOI8_U;
else
@throw [OFInvalidEncodingException exception];
objc_autoreleasePoolPop(pool);
return encoding;
}
|
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
|
(unsigned char*)cString, length, lossy))
@throw [OFInvalidEncodingException exception];
cString[length] = '\0';
return length;
#endif
default:
@throw [OFNotImplementedException exceptionWithSelector: _cmd
object: self];
}
}
- (size_t)getCString: (char*)cString
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
|
(unsigned char*)cString, length, lossy))
@throw [OFInvalidEncodingException exception];
cString[length] = '\0';
return length;
#endif
#ifdef HAVE_KOI8_U
case OF_STRING_ENCODING_KOI8_U:
if (length + 1 > maxLength)
@throw [OFOutOfRangeException exception];
if (!of_unicode_to_koi8_u(characters,
(unsigned char*)cString, length, lossy))
@throw [OFInvalidEncodingException exception];
cString[length] = '\0';
return length;
#endif
default:
@throw [OFNotImplementedException exceptionWithSelector: _cmd
object: self];
}
}
- (size_t)getCString: (char*)cString
|
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
|
case OF_STRING_ENCODING_WINDOWS_1251:
case OF_STRING_ENCODING_WINDOWS_1252:
case OF_STRING_ENCODING_CODEPAGE_437:
case OF_STRING_ENCODING_CODEPAGE_850:
case OF_STRING_ENCODING_CODEPAGE_858:
case OF_STRING_ENCODING_MAC_ROMAN:
case OF_STRING_ENCODING_KOI8_R:
cString = [object allocMemoryWithSize: length + 1];
[self OF_getCString: cString
maxLength: length + 1
encoding: encoding
lossy: lossy];
|
>
|
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
|
case OF_STRING_ENCODING_WINDOWS_1251:
case OF_STRING_ENCODING_WINDOWS_1252:
case OF_STRING_ENCODING_CODEPAGE_437:
case OF_STRING_ENCODING_CODEPAGE_850:
case OF_STRING_ENCODING_CODEPAGE_858:
case OF_STRING_ENCODING_MAC_ROMAN:
case OF_STRING_ENCODING_KOI8_R:
case OF_STRING_ENCODING_KOI8_U:
cString = [object allocMemoryWithSize: length + 1];
[self OF_getCString: cString
maxLength: length + 1
encoding: encoding
lossy: lossy];
|
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
|
case OF_STRING_ENCODING_WINDOWS_1251:
case OF_STRING_ENCODING_WINDOWS_1252:
case OF_STRING_ENCODING_CODEPAGE_437:
case OF_STRING_ENCODING_CODEPAGE_850:
case OF_STRING_ENCODING_CODEPAGE_858:
case OF_STRING_ENCODING_MAC_ROMAN:
case OF_STRING_ENCODING_KOI8_R:
return [self length];
default:
@throw [OFInvalidEncodingException exception];
}
}
- (size_t)UTF8StringLength
|
>
|
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
|
case OF_STRING_ENCODING_WINDOWS_1251:
case OF_STRING_ENCODING_WINDOWS_1252:
case OF_STRING_ENCODING_CODEPAGE_437:
case OF_STRING_ENCODING_CODEPAGE_850:
case OF_STRING_ENCODING_CODEPAGE_858:
case OF_STRING_ENCODING_MAC_ROMAN:
case OF_STRING_ENCODING_KOI8_R:
case OF_STRING_ENCODING_KOI8_U:
return [self length];
default:
@throw [OFInvalidEncodingException exception];
}
}
- (size_t)UTF8StringLength
|