ObjFW  Diff

Differences From Artifact [494018f979]:

To Artifact [69877c8b33]:


368
369
370
371
372
373
374
375
376
377
378
379
380


381
382
383
384





385
386
387

388
389
390
391
392
393
394
		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);








|
<
<
<
<
|
>
>




>
>
>
>
>

<

>







368
369
370
371
372
373
374
375




376
377
378
379
380
381
382
383
384
385
386
387
388

389
390
391
392
393
394
395
396
397
		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);