ObjFW  Diff

Differences From Artifact [57e4df0b5d]:

To Artifact [5369441523]:


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 */

#include "config.h"

#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#import "OFMutableUTF8String.h"
#import "OFASPrintF.h"
#import "OFString.h"
#import "OFUTF8String.h"

#import "OFInvalidArgumentException.h"







<







14
15
16
17
18
19
20

21
22
23
24
25
26
27
 */

#include "config.h"

#include <stdarg.h>
#include <stdlib.h>
#include <string.h>


#import "OFMutableUTF8String.h"
#import "OFASPrintF.h"
#import "OFString.h"
#import "OFUTF8String.h"

#import "OFInvalidArgumentException.h"
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	char *newCString;
	bool isStart = true;

	if (!_s->isUTF8) {
		uint8_t t;
		const OFUnichar *const *table;

		assert(startTableSize >= 1 && middleTableSize >= 1);

		_s->hasHash = false;

		for (i = 0; i < _s->cStringLength; i++) {
			if (isStart)
				table = startTable;
			else







|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
	char *newCString;
	bool isStart = true;

	if (!_s->isUTF8) {
		uint8_t t;
		const OFUnichar *const *table;

		OFAssert(startTableSize >= 1 && middleTableSize >= 1);

		_s->hasHash = false;

		for (i = 0; i < _s->cStringLength; i++) {
			if (isStart)
				table = startTable;
			else
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
			OFFreeMemory(unicodeString);
			OFFreeMemory(newCString);
			@throw [OFInvalidEncodingException exception];
		}
		j += d;
	}

	assert(j == newCStringLength);
	newCString[j] = 0;
	OFFreeMemory(unicodeString);

	OFFreeMemory(_s->cString);
	_s->hasHash = false;
	_s->cString = newCString;
	_s->cStringLength = newCStringLength;







|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
			OFFreeMemory(unicodeString);
			OFFreeMemory(newCString);
			@throw [OFInvalidEncodingException exception];
		}
		j += d;
	}

	OFAssert(j == newCStringLength);
	newCString[j] = 0;
	OFFreeMemory(unicodeString);

	OFFreeMemory(_s->cString);
	_s->hasHash = false;
	_s->cString = newCString;
	_s->cStringLength = newCStringLength;