ObjFW  Diff

Differences From Artifact [3404c5b7b6]:

To Artifact [0c0cd023b8]:


85
86
87
88
89
90
91


92
93
94
95
96
97
98
		  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_15(const of_unichar_t*, unsigned char*,
    size_t, bool);
extern bool of_unicode_to_windows_1251(const of_unichar_t*, unsigned char*,
    size_t, bool);
extern bool of_unicode_to_windows_1252(const of_unichar_t*, unsigned char*,
    size_t, bool);
extern bool of_unicode_to_codepage_437(const of_unichar_t*, unsigned char*,







>
>







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
		  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_15(const of_unichar_t*, unsigned char*,
    size_t, bool);
extern bool of_unicode_to_windows_1251(const of_unichar_t*, unsigned char*,
    size_t, bool);
extern bool of_unicode_to_windows_1252(const of_unichar_t*, unsigned char*,
    size_t, bool);
extern bool of_unicode_to_codepage_437(const of_unichar_t*, unsigned char*,
1060
1061
1062
1063
1064
1065
1066











1067
1068
1069
1070
1071
1072
1073
					    exception];
			} else
				cString[i] = (unsigned char)characters[i];
		}

		cString[i] = '\0';












		return length;
	case OF_STRING_ENCODING_ISO_8859_15:
		if (length + 1 > maxLength)
			@throw [OFOutOfRangeException exception];

		if (!of_unicode_to_iso_8859_15(characters,
		    (unsigned char*)cString, length, lossy))







>
>
>
>
>
>
>
>
>
>
>







1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
					    exception];
			} else
				cString[i] = (unsigned char)characters[i];
		}

		cString[i] = '\0';

		return length;
	case OF_STRING_ENCODING_ISO_8859_2:
		if (length + 1 > maxLength)
			@throw [OFOutOfRangeException exception];

		if (!of_unicode_to_iso_8859_2(characters,
		    (unsigned char*)cString, length, lossy))
			@throw [OFInvalidEncodingException exception];

		cString[length] = '\0';

		return length;
	case OF_STRING_ENCODING_ISO_8859_15:
		if (length + 1 > maxLength)
			@throw [OFOutOfRangeException exception];

		if (!of_unicode_to_iso_8859_15(characters,
		    (unsigned char*)cString, length, lossy))
1192
1193
1194
1195
1196
1197
1198

1199
1200
1201
1202
1203
1204
1205
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}

		break;
	case OF_STRING_ENCODING_ASCII:
	case OF_STRING_ENCODING_ISO_8859_1:

	case OF_STRING_ENCODING_ISO_8859_15:
	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:







>







1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}

		break;
	case OF_STRING_ENCODING_ASCII:
	case OF_STRING_ENCODING_ISO_8859_1:
	case OF_STRING_ENCODING_ISO_8859_2:
	case OF_STRING_ENCODING_ISO_8859_15:
	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:
1260
1261
1262
1263
1264
1265
1266

1267
1268
1269
1270
1271
1272
1273

			UTF8StringLength += len;
		}

		return UTF8StringLength;
	case OF_STRING_ENCODING_ASCII:
	case OF_STRING_ENCODING_ISO_8859_1:

	case OF_STRING_ENCODING_ISO_8859_15:
	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:







>







1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288

			UTF8StringLength += len;
		}

		return UTF8StringLength;
	case OF_STRING_ENCODING_ASCII:
	case OF_STRING_ENCODING_ISO_8859_1:
	case OF_STRING_ENCODING_ISO_8859_2:
	case OF_STRING_ENCODING_ISO_8859_15:
	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: