ObjFW  Diff

Differences From Artifact [0f9ae48dcf]:

  • File src/encodings/koi8-u.m — part of check-in [f16bccc7b3] at 2024-04-29 21:42:33 on branch trunk — Properly hide private symbols (user: js size: 6013) [more...]

To Artifact [ae62fae518]:

  • File src/encodings/koi8-u.m — part of check-in [6fbc3b18c7] at 2024-10-27 22:27:20 on branch trunk — Allow strings to contain \0 In order to not accidentally have C strings with \0, an OFInvalidEncodingException is thrown when trying to get a C string for a string that contains \0. In order to get a C string with \0 anyway, a new method -[insecureCStringWithEncoding:] is added. (user: js size: 6098)

124
125
126
127
128
129
130
131

132
133
134






135
136
137
138
139
140
141
124
125
126
127
128
129
130

131
132
133

134
135
136
137
138
139
140
141
142
143
144
145
146







-
+


-
+
+
+
+
+
+







	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x94
};
static const uint8_t page25Start = 0x00;

bool OF_VISIBILITY_HIDDEN
_OFUnicodeToKOI8U(const OFUnichar *input, unsigned char *output, size_t length,
    bool lossy)
    bool lossy, bool insecure)
{
	for (size_t i = 0; i < length; i++) {
		OFUnichar c = input[i];
		OFUnichar c;

		if OF_UNLIKELY (!insecure && input[i] == 0)
			return false;

		c = input[i];

		if OF_UNLIKELY (c > 0x7F) {
			uint8_t idx;

			if OF_UNLIKELY (c > 0xFFFF) {
				if (lossy) {
					output[i] = '?';