ObjFW  Diff

Differences From Artifact [8978f6afd4]:

To Artifact [a3637e3c40]:


9
10
11
12
13
14
15

16
17
18
19
20
21
22
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23







+







 * the packaging of this file.
 */

#import <stdlib.h>
#import <string.h>
#import <wchar.h>
#import "OFWideString.h"
#import "OFExceptions.h"

@implementation OFWideString
+ new: (const wchar_t*)wstr
{
	return [[OFWideString alloc] init: wstr];
}

92
93
94
95
96
97
98
99
100
101


102
103
104
105
106
107
108
109
110
111
93
94
95
96
97
98
99



100
101

102
103
104
105
106
107
108
109
110







-
-
-
+
+
-










	if (wstr == NULL)
		return [self setTo: wstr];

	strlength = wcslen(wstr);
	newlen = length + strlength;

	/* FIXME: Add error handling */
	if ((newstr = [self resizeMem: wstring
			       toSize: (newlen + 1) * sizeof(wchar_t)]) == NULL)
	newstr = [self resizeMem: wstring
			  toSize: (newlen + 1) * sizeof(wchar_t)];
		return nil;

	memcpy(newstr + length, wstr, (strlength + 1) * sizeof(wchar_t));

	length = newlen;
	wstring = newstr;

	return self;
}
@end