ObjFW  Diff

Differences From Artifact [97ab3896de]:

To Artifact [2832b02ca4]:


356
357
358
359
360
361
362
363
364
365
366
367
368


369
370
371
372





373
374
375

376
377
378
379
380
381
382
		j = 0;
		for (size_t i = 0; i < cStringLength; i++) {
			unsigned char character = (unsigned char)cString[i];
			OFUnichar unichar;
			char buffer[4];
			size_t byteLength;

			if (character < tableOffset) {
				_s->cString[j++] = cString[i];
				continue;
			}

			unichar = table[character - tableOffset];



			if (unichar == 0xFFFF)
				@throw [OFInvalidEncodingException exception];






			_s->isUTF8 = true;
			byteLength = _OFUTF8StringEncode(unichar, buffer);


			if (byteLength == 0)
				@throw [OFInvalidEncodingException exception];

			_s->cStringLength += byteLength - 1;
			_s->cString = OFResizeMemory(_s->cString,
			    _s->cStringLength + 1, 1);








|
<
<
<
<
|
>
>




>
>
>
>
>

<

>







356
357
358
359
360
361
362
363




364
365
366
367
368
369
370
371
372
373
374
375
376

377
378
379
380
381
382
383
384
385
		j = 0;
		for (size_t i = 0; i < cStringLength; i++) {
			unsigned char character = (unsigned char)cString[i];
			OFUnichar unichar;
			char buffer[4];
			size_t byteLength;

			if (character >= tableOffset)




				unichar = table[character - tableOffset];
			else
				unichar = character;

			if (unichar == 0xFFFF)
				@throw [OFInvalidEncodingException exception];

			if (unichar < 0x7F) {
				_s->cString[j++] = (char)unichar;
				continue;
			}

			_s->isUTF8 = true;


			byteLength = _OFUTF8StringEncode(unichar, buffer);
			if (byteLength == 0)
				@throw [OFInvalidEncodingException exception];

			_s->cStringLength += byteLength - 1;
			_s->cString = OFResizeMemory(_s->cString,
			    _s->cStringLength + 1, 1);