Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 618676
Collapse All | Expand All

(-)a/c++/io/DataInputStream.cxx (-2 / +2 lines)
Lines 201-207 String DataInputStream::readUTF() throw (IOException) Link Here
201
		jchar* buffer = new jchar[ulen+1];
201
		jchar* buffer = new jchar[ulen+1];
202
202
203
		status = U_ZERO_ERROR;
203
		status = U_ZERO_ERROR;
204
		ucnv_toUChars(_utf, buffer, ulen+1, (const char*) data, (jint) utflen, &status);
204
		ucnv_toUChars(_utf, reinterpret_cast<UChar*>(buffer), ulen+1, (const char*) data, (jint) utflen, &status);
205
205
206
		delete[] data;
206
		delete[] data;
207
207
Lines 232-238 String DataInputStream::readLine() throw (IOException) Link Here
232
232
233
	array<jchar> target_buffer(80);
233
	array<jchar> target_buffer(80);
234
	jint         target_offset = 0;
234
	jint         target_offset = 0;
235
	      UChar* target = target_buffer.data();
235
		  UChar* target = reinterpret_cast<UChar*>(target_buffer.data());
236
	const UChar* target_limit = target+1;
236
	const UChar* target_limit = target+1;
237
	      char  source_buffer[MAX_BYTES_PER_CHARACTER];
237
	      char  source_buffer[MAX_BYTES_PER_CHARACTER];
238
	const char* source = source_buffer;
238
	const char* source = source_buffer;
(-)a/c++/io/DataOutputStream.cxx (-2 / +2 lines)
Lines 187-193 void DataOutputStream::writeUTF(const String& str) throw (IOException) Link Here
187
	const array<jchar>& src = str.toCharArray();
187
	const array<jchar>& src = str.toCharArray();
188
188
189
	// the expected status code here is U_BUFFER_OVERFLOW_ERROR
189
	// the expected status code here is U_BUFFER_OVERFLOW_ERROR
190
	jint need = ucnv_fromUChars(_utf, 0, 0, src.data(), src.size(), &status);
190
	jint need = ucnv_fromUChars(_utf, 0, 0, reinterpret_cast<const UChar*>(src.data()), src.size(), &status);
191
	if (U_FAILURE(status))
191
	if (U_FAILURE(status))
192
		if (status != U_BUFFER_OVERFLOW_ERROR)
192
		if (status != U_BUFFER_OVERFLOW_ERROR)
193
			throw IOException("ucnv_fromUChars failed");
193
			throw IOException("ucnv_fromUChars failed");
Lines 200-206 void DataOutputStream::writeUTF(const String& str) throw (IOException) Link Here
200
	status = U_ZERO_ERROR;
200
	status = U_ZERO_ERROR;
201
201
202
	// the expected status code here is U_STRING_NOT_TERMINATED_WARNING
202
	// the expected status code here is U_STRING_NOT_TERMINATED_WARNING
203
	ucnv_fromUChars(_utf, (char*) buffer, need, src.data(), src.size(), &status);
203
	ucnv_fromUChars(_utf, (char*) buffer, need, reinterpret_cast<const UChar*>(src.data()), src.size(), &status);
204
	if (status != U_STRING_NOT_TERMINATED_WARNING)
204
	if (status != U_STRING_NOT_TERMINATED_WARNING)
205
	{
205
	{
206
		delete[] buffer;
206
		delete[] buffer;
(-)a/c++/io/PrintStream.cxx (-3 / +3 lines)
Lines 191-197 void PrintStream::print(jchar ch) throw () Link Here
191
			UErrorCode status = U_ZERO_ERROR;
191
			UErrorCode status = U_ZERO_ERROR;
192
192
193
			// do conversion of one character
193
			// do conversion of one character
194
			size_t used = ucnv_fromUChars(_loc, buffer, 8, &ch, 1, &status);
194
			size_t used = ucnv_fromUChars(_loc, buffer, 8, reinterpret_cast<UChar*>(&ch), 1, &status);
195
			if (U_FAILURE(status))
195
			if (U_FAILURE(status))
196
				throw IOException("failure in ucnv_fromUChars");
196
				throw IOException("failure in ucnv_fromUChars");
197
197
Lines 268-281 void PrintStream::print(jlong x) throw () Link Here
268
268
269
void PrintStream::print(const array<jchar>& chars) throw ()
269
void PrintStream::print(const array<jchar>& chars) throw ()
270
{
270
{
271
	print(chars.data(), chars.size());
271
	print(reinterpret_cast<const UChar*>(chars.data()), chars.size());
272
}
272
}
273
273
274
void PrintStream::print(const String& str) throw ()
274
void PrintStream::print(const String& str) throw ()
275
{
275
{
276
	const array<jchar>& tmp = str.toCharArray();
276
	const array<jchar>& tmp = str.toCharArray();
277
277
278
	print(tmp.data(), tmp.size());
278
	print(reinterpret_cast<const UChar*>(tmp.data()), tmp.size());
279
}
279
}
280
280
281
void PrintStream::println() throw ()
281
void PrintStream::println() throw ()
(-)a/c++/lang/String.cxx (-4 / +6 lines)
Lines 33-38 using namespace beecrypt::lang; Link Here
33
#include <unicode/ustdio.h>
33
#include <unicode/ustdio.h>
34
#include <unicode/ustring.h>
34
#include <unicode/ustring.h>
35
35
36
static_assert(sizeof(jchar) == sizeof(UChar), "jchar and UChar sizes mismatch");
37
36
String::String(array<jchar>& swapWith)
38
String::String(array<jchar>& swapWith)
37
{
39
{
38
	assert(swapWith.size() <= Integer::MAX_VALUE);
40
	assert(swapWith.size() <= Integer::MAX_VALUE);
Lines 56-62 String::String() Link Here
56
58
57
String::String(char c) : _value(1)
59
String::String(char c) : _value(1)
58
{
60
{
59
	u_charsToUChars(&c, _value.data(), 1);
61
	u_charsToUChars(&c, reinterpret_cast<UChar*>(_value.data()), 1);
60
}
62
}
61
63
62
String::String(jchar c) : _value(&c, 1)
64
String::String(jchar c) : _value(&c, 1)
Lines 67-73 String::String(const char* value) : _value(::strlen(value)) Link Here
67
{
69
{
68
	assert(_value.size() <= Integer::MAX_VALUE);
70
	assert(_value.size() <= Integer::MAX_VALUE);
69
71
70
	u_charsToUChars(value, _value.data(), _value.size());
72
	u_charsToUChars(value, reinterpret_cast<UChar*>(_value.data()), _value.size());
71
}
73
}
72
74
73
String::String(const jchar* value, int offset, int length) : _value(value+offset, length)
75
String::String(const jchar* value, int offset, int length) : _value(value+offset, length)
Lines 449-455 std::ostream& beecrypt::lang::operator<<(std::ostream& stream, const String& str Link Here
449
		if (U_FAILURE(status))
451
		if (U_FAILURE(status))
450
			throw RuntimeException("ucnv_open failed");
452
			throw RuntimeException("ucnv_open failed");
451
453
452
		int need = ucnv_fromUChars(loc, 0, 0, src.data(), src.size(), &status);
454
		int need = ucnv_fromUChars(loc, 0, 0, reinterpret_cast<const UChar*>(src.data()), src.size(), &status);
453
		if (U_FAILURE(status))
455
		if (U_FAILURE(status))
454
			if (status != U_BUFFER_OVERFLOW_ERROR)
456
			if (status != U_BUFFER_OVERFLOW_ERROR)
455
				throw RuntimeException("ucnv_fromUChars failed");
457
				throw RuntimeException("ucnv_fromUChars failed");
Lines 458-464 std::ostream& beecrypt::lang::operator<<(std::ostream& stream, const String& str Link Here
458
460
459
		status = U_ZERO_ERROR;
461
		status = U_ZERO_ERROR;
460
462
461
		ucnv_fromUChars(loc, out, need+1, src.data(), src.size(), &status);
463
		ucnv_fromUChars(loc, out, need+1, reinterpret_cast<const UChar*>(src.data()), src.size(), &status);
462
		if (U_FAILURE(status))
464
		if (U_FAILURE(status))
463
			throw RuntimeException("ucnv_fromUChars failed");
465
			throw RuntimeException("ucnv_fromUChars failed");
464
466
(-)a/c++/lang/StringBuffer.cxx (-3 / +3 lines)
Lines 35-41 StringBuffer::StringBuffer() : _buffer(16) Link Here
35
35
36
StringBuffer::StringBuffer(const char* s) : _buffer(16 + strlen(s))
36
StringBuffer::StringBuffer(const char* s) : _buffer(16 + strlen(s))
37
{
37
{
38
	u_charsToUChars(s, _buffer.data(), _used = strlen(s));
38
	u_charsToUChars(s, reinterpret_cast<UChar*>(_buffer.data()), _used = strlen(s));
39
}
39
}
40
40
41
StringBuffer::StringBuffer(const String& s) : _buffer(16 + s._value.size())
41
StringBuffer::StringBuffer(const String& s) : _buffer(16 + s._value.size())
Lines 53-59 StringBuffer& StringBuffer::append(char c) Link Here
53
	synchronized (this)
53
	synchronized (this)
54
	{
54
	{
55
		core_ensureCapacity(_used+1);
55
		core_ensureCapacity(_used+1);
56
		u_charsToUChars(&c, _buffer.data() + _used++, 1);
56
		u_charsToUChars(&c, reinterpret_cast<UChar*>(_buffer.data() + _used++), 1);
57
	}
57
	}
58
	return *this;
58
	return *this;
59
}
59
}
Lines 88-94 StringBuffer& StringBuffer::append(const char* s) Link Here
88
		jint need = strlen(s);
88
		jint need = strlen(s);
89
89
90
		core_ensureCapacity(_used + need);
90
		core_ensureCapacity(_used + need);
91
		u_charsToUChars(s, _buffer.data() + _used, need);
91
		u_charsToUChars(s, reinterpret_cast<UChar*>(_buffer.data() + _used), need);
92
92
93
		_used += need;
93
		_used += need;
94
	}
94
	}
(-)a/c++/lang/StringBuilder.cxx (-3 / +3 lines)
Lines 38-44 StringBuilder::StringBuilder() : _buffer(16) Link Here
38
38
39
StringBuilder::StringBuilder(const char* s) : _buffer(16 + strlen(s))
39
StringBuilder::StringBuilder(const char* s) : _buffer(16 + strlen(s))
40
{
40
{
41
	u_charsToUChars(s, _buffer.data(), _used = strlen(s));
41
	u_charsToUChars(s, reinterpret_cast<UChar*>(_buffer.data()), _used = strlen(s));
42
}
42
}
43
43
44
StringBuilder::StringBuilder(const String& s) : _buffer(16 + s._value.size())
44
StringBuilder::StringBuilder(const String& s) : _buffer(16 + s._value.size())
Lines 55-61 StringBuilder& StringBuilder::append(char c) Link Here
55
{
55
{
56
	ensureCapacity(_used+1);
56
	ensureCapacity(_used+1);
57
57
58
	u_charsToUChars(&c, _buffer.data() + _used++, 1);
58
	u_charsToUChars(&c, reinterpret_cast<UChar*>(_buffer.data() + _used++), 1);
59
59
60
	return *this;
60
	return *this;
61
}
61
}
Lines 97-103 StringBuilder& StringBuilder::append(const char* s) Link Here
97
97
98
	ensureCapacity(_used + need);
98
	ensureCapacity(_used + need);
99
99
100
	u_charsToUChars(s, _buffer.data() + _used, need);
100
	u_charsToUChars(s, reinterpret_cast<UChar*>(_buffer.data() + _used), need);
101
101
102
	_used += need;
102
	_used += need;
103
103
(-)a/c++/security/Provider.cxx (-1 / +1 lines)
Lines 90-96 Object* Provider::setProperty(const String& key, const String& value) Link Here
90
90
91
			UErrorCode status = U_ZERO_ERROR;
91
			UErrorCode status = U_ZERO_ERROR;
92
92
93
			ucnv_fromUChars(_conv, symname, 1024, src.data(), src.size(), &status);
93
			ucnv_fromUChars(_conv, symname, 1024, reinterpret_cast<const UChar*>(src.data()), src.size(), &status);
94
94
95
			if (status != U_ZERO_ERROR)
95
			if (status != U_ZERO_ERROR)
96
					throw RuntimeException("error in ucnv_fromUChars");
96
					throw RuntimeException("error in ucnv_fromUChars");
(-)a/c++/security/Security.cxx (-2 / +2 lines)
Lines 104-110 void Security::initialize() Link Here
104
104
105
					const array<jchar>& src = value->toCharArray();
105
					const array<jchar>& src = value->toCharArray();
106
106
107
					int need = ucnv_fromUChars(_loc, 0, 0, src.data(), src.size(), &status);
107
					int need = ucnv_fromUChars(_loc, 0, 0, reinterpret_cast<const UChar*>(src.data()), src.size(), &status);
108
					if (U_FAILURE(status))
108
					if (U_FAILURE(status))
109
						if (status != U_BUFFER_OVERFLOW_ERROR)
109
						if (status != U_BUFFER_OVERFLOW_ERROR)
110
							throw RuntimeException("ucnv_fromUChars failed");
110
							throw RuntimeException("ucnv_fromUChars failed");
Lines 112-118 void Security::initialize() Link Here
112
					char* shared_library = new char[need+1];
112
					char* shared_library = new char[need+1];
113
113
114
					status = U_ZERO_ERROR;
114
					status = U_ZERO_ERROR;
115
					ucnv_fromUChars(_loc, shared_library, need+1, src.data(), src.size(), &status);
115
					ucnv_fromUChars(_loc, shared_library, need+1, reinterpret_cast<const UChar*>(src.data()), src.size(), &status);
116
					if (U_FAILURE(status))
116
					if (U_FAILURE(status))
117
						throw RuntimeException("ucnv_fromUChars failed");
117
						throw RuntimeException("ucnv_fromUChars failed");
118
118

Return to bug 618676