ObjFW  Diff

Differences From Artifact [f6358fc52b]:

To Artifact [9f7f197b86]:


83
84
85
86
87
88
89










90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
						ofSize: sizeof(wchar_t)];
			wmemcpy(string, str, length + 1);
		}
	}

	return self;
}











- (char*)getCString
{
	char *str;
	size_t len;

	if ((len = wcstombs(NULL, string, 0)) == (size_t)-1)
		@throw [OFCharsetConversionFailedException newWithObject: self];

	str = [self getMemWithSize: len + 1];

	if (wcstombs(str, string, len + 1) != len) {
		[self freeMem: str];
		@throw [OFCharsetConversionFailedException newWithObject: self];
	}

	return str;
}

- (wchar_t*)wideCString
{
	return string;
}

- (size_t)length
{
	return length;
}

- (OFString*)clone
{
	return [OFString newFromWideCString: string];
}

- (OFString*)setTo: (OFString*)str
{







>
>
>
>
>
>
>
>
>
>



















<
<
<
<
<
<
<
<
<
<







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118










119
120
121
122
123
124
125
						ofSize: sizeof(wchar_t)];
			wmemcpy(string, str, length + 1);
		}
	}

	return self;
}

- (const wchar_t*)wideCString
{
	return string;
}

- (size_t)length
{
	return length;
}

- (char*)getCString
{
	char *str;
	size_t len;

	if ((len = wcstombs(NULL, string, 0)) == (size_t)-1)
		@throw [OFCharsetConversionFailedException newWithObject: self];

	str = [self getMemWithSize: len + 1];

	if (wcstombs(str, string, len + 1) != len) {
		[self freeMem: str];
		@throw [OFCharsetConversionFailedException newWithObject: self];
	}

	return str;
}











- (OFString*)clone
{
	return [OFString newFromWideCString: string];
}

- (OFString*)setTo: (OFString*)str
{