1 |
commit: e91c58f05f9ebb9cf9d15a1132356051b928fe22 |
2 |
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 1 20:23:04 2017 +0000 |
4 |
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Dec 1 20:23:04 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e91c58f0 |
7 |
|
8 |
dev-libs/beecrypt: Fix compilation with >=dev-libs/icu-59. |
9 |
|
10 |
Closes: https://bugs.gentoo.org/618676 |
11 |
Package-Manager: Portage-2.3.16, Repoman-2.3.6 |
12 |
|
13 |
dev-libs/beecrypt/Manifest | 2 +- |
14 |
dev-libs/beecrypt/beecrypt-4.2.1-r4.ebuild | 1 + |
15 |
.../beecrypt/files/beecrypt-4.2.1-cast-uchar.patch | 214 +++++++++++++++++++++ |
16 |
3 files changed, 216 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/dev-libs/beecrypt/Manifest b/dev-libs/beecrypt/Manifest |
19 |
index de57828f34d..0fc625fdb93 100644 |
20 |
--- a/dev-libs/beecrypt/Manifest |
21 |
+++ b/dev-libs/beecrypt/Manifest |
22 |
@@ -1 +1 @@ |
23 |
-DIST beecrypt-4.2.1.tar.gz 882758 SHA256 286f1f56080d1a6b1d024003a5fa2158f4ff82cae0c6829d3c476a4b5898c55d SHA512 59995d53c024efe6344a21ac0d6d55fbe652488a4a22cc6719f9fc3851d56697fa8738937d48aa1e6f9ebe749de61ac3c79a5f0cea793872213c3bdf922e71bc WHIRLPOOL c4a0371d8e2cf37194800867c58e77d72bb59ab464fdff9c561230ece0f288dabdebfdd0ac13382c9ebe45b455ffbfdd81e6a15969dcb86d3d8c8e6635e294bb |
24 |
+DIST beecrypt-4.2.1.tar.gz 882758 BLAKE2B 7ca25613cf95df8657c762d932618979783ea2ddfbaecdf066701d61a5f9ac76bd474a51eb65e140c83ef01880477cb7104e3d67c2fc078ae7b710637d18bb53 SHA512 59995d53c024efe6344a21ac0d6d55fbe652488a4a22cc6719f9fc3851d56697fa8738937d48aa1e6f9ebe749de61ac3c79a5f0cea793872213c3bdf922e71bc |
25 |
|
26 |
diff --git a/dev-libs/beecrypt/beecrypt-4.2.1-r4.ebuild b/dev-libs/beecrypt/beecrypt-4.2.1-r4.ebuild |
27 |
index 4d835cb2cd9..69a3ccb8f34 100644 |
28 |
--- a/dev-libs/beecrypt/beecrypt-4.2.1-r4.ebuild |
29 |
+++ b/dev-libs/beecrypt/beecrypt-4.2.1-r4.ebuild |
30 |
@@ -38,6 +38,7 @@ PATCHES=( |
31 |
|
32 |
# Fixes bug 596904 |
33 |
"${FILESDIR}"/${P}-c++11-allow-throw-in-destructors.patch |
34 |
+ "${FILESDIR}"/${P}-cast-uchar.patch #618676 |
35 |
) |
36 |
|
37 |
pkg_setup() { |
38 |
|
39 |
diff --git a/dev-libs/beecrypt/files/beecrypt-4.2.1-cast-uchar.patch b/dev-libs/beecrypt/files/beecrypt-4.2.1-cast-uchar.patch |
40 |
new file mode 100644 |
41 |
index 00000000000..8efedc01e4a |
42 |
--- /dev/null |
43 |
+++ b/dev-libs/beecrypt/files/beecrypt-4.2.1-cast-uchar.patch |
44 |
@@ -0,0 +1,214 @@ |
45 |
+beecrypt's c++ api uses jchar arrays for strings, while ICU 59 expects |
46 |
+char16_t type |
47 |
+ |
48 |
+In practice these both seem to be defined as short int on amd64 so it |
49 |
+might be okay to just reinterpret_cast them? There's probably no easy |
50 |
+way out on a platform where char16_t won't match jchar |
51 |
+ |
52 |
+Patch by Valeriy Malov <jazzvoid@×××××.com> |
53 |
+https://bugs.gentoo.org/618676 |
54 |
+ |
55 |
+--- a/c++/io/DataInputStream.cxx |
56 |
++++ b/c++/io/DataInputStream.cxx |
57 |
+@@ -201,7 +201,7 @@ String DataInputStream::readUTF() throw (IOException) |
58 |
+ jchar* buffer = new jchar[ulen+1]; |
59 |
+ |
60 |
+ status = U_ZERO_ERROR; |
61 |
+- ucnv_toUChars(_utf, buffer, ulen+1, (const char*) data, (jint) utflen, &status); |
62 |
++ ucnv_toUChars(_utf, reinterpret_cast<UChar*>(buffer), ulen+1, (const char*) data, (jint) utflen, &status); |
63 |
+ |
64 |
+ delete[] data; |
65 |
+ |
66 |
+@@ -232,7 +232,7 @@ String DataInputStream::readLine() throw (IOException) |
67 |
+ |
68 |
+ array<jchar> target_buffer(80); |
69 |
+ jint target_offset = 0; |
70 |
+- UChar* target = target_buffer.data(); |
71 |
++ UChar* target = reinterpret_cast<UChar*>(target_buffer.data()); |
72 |
+ const UChar* target_limit = target+1; |
73 |
+ char source_buffer[MAX_BYTES_PER_CHARACTER]; |
74 |
+ const char* source = source_buffer; |
75 |
+--- a/c++/io/DataOutputStream.cxx |
76 |
++++ b/c++/io/DataOutputStream.cxx |
77 |
+@@ -187,7 +187,7 @@ void DataOutputStream::writeUTF(const String& str) throw (IOException) |
78 |
+ const array<jchar>& src = str.toCharArray(); |
79 |
+ |
80 |
+ // the expected status code here is U_BUFFER_OVERFLOW_ERROR |
81 |
+- jint need = ucnv_fromUChars(_utf, 0, 0, src.data(), src.size(), &status); |
82 |
++ jint need = ucnv_fromUChars(_utf, 0, 0, reinterpret_cast<const UChar*>(src.data()), src.size(), &status); |
83 |
+ if (U_FAILURE(status)) |
84 |
+ if (status != U_BUFFER_OVERFLOW_ERROR) |
85 |
+ throw IOException("ucnv_fromUChars failed"); |
86 |
+@@ -200,7 +200,7 @@ void DataOutputStream::writeUTF(const String& str) throw (IOException) |
87 |
+ status = U_ZERO_ERROR; |
88 |
+ |
89 |
+ // the expected status code here is U_STRING_NOT_TERMINATED_WARNING |
90 |
+- ucnv_fromUChars(_utf, (char*) buffer, need, src.data(), src.size(), &status); |
91 |
++ ucnv_fromUChars(_utf, (char*) buffer, need, reinterpret_cast<const UChar*>(src.data()), src.size(), &status); |
92 |
+ if (status != U_STRING_NOT_TERMINATED_WARNING) |
93 |
+ { |
94 |
+ delete[] buffer; |
95 |
+--- a/c++/io/PrintStream.cxx |
96 |
++++ b/c++/io/PrintStream.cxx |
97 |
+@@ -191,7 +191,7 @@ void PrintStream::print(jchar ch) throw () |
98 |
+ UErrorCode status = U_ZERO_ERROR; |
99 |
+ |
100 |
+ // do conversion of one character |
101 |
+- size_t used = ucnv_fromUChars(_loc, buffer, 8, &ch, 1, &status); |
102 |
++ size_t used = ucnv_fromUChars(_loc, buffer, 8, reinterpret_cast<UChar*>(&ch), 1, &status); |
103 |
+ if (U_FAILURE(status)) |
104 |
+ throw IOException("failure in ucnv_fromUChars"); |
105 |
+ |
106 |
+@@ -268,14 +268,14 @@ void PrintStream::print(jlong x) throw () |
107 |
+ |
108 |
+ void PrintStream::print(const array<jchar>& chars) throw () |
109 |
+ { |
110 |
+- print(chars.data(), chars.size()); |
111 |
++ print(reinterpret_cast<const UChar*>(chars.data()), chars.size()); |
112 |
+ } |
113 |
+ |
114 |
+ void PrintStream::print(const String& str) throw () |
115 |
+ { |
116 |
+ const array<jchar>& tmp = str.toCharArray(); |
117 |
+ |
118 |
+- print(tmp.data(), tmp.size()); |
119 |
++ print(reinterpret_cast<const UChar*>(tmp.data()), tmp.size()); |
120 |
+ } |
121 |
+ |
122 |
+ void PrintStream::println() throw () |
123 |
+--- a/c++/lang/String.cxx |
124 |
++++ b/c++/lang/String.cxx |
125 |
+@@ -33,6 +33,8 @@ using namespace beecrypt::lang; |
126 |
+ #include <unicode/ustdio.h> |
127 |
+ #include <unicode/ustring.h> |
128 |
+ |
129 |
++static_assert(sizeof(jchar) == sizeof(UChar), "jchar and UChar sizes mismatch"); |
130 |
++ |
131 |
+ String::String(array<jchar>& swapWith) |
132 |
+ { |
133 |
+ assert(swapWith.size() <= Integer::MAX_VALUE); |
134 |
+@@ -56,7 +58,7 @@ String::String() |
135 |
+ |
136 |
+ String::String(char c) : _value(1) |
137 |
+ { |
138 |
+- u_charsToUChars(&c, _value.data(), 1); |
139 |
++ u_charsToUChars(&c, reinterpret_cast<UChar*>(_value.data()), 1); |
140 |
+ } |
141 |
+ |
142 |
+ String::String(jchar c) : _value(&c, 1) |
143 |
+@@ -67,7 +69,7 @@ String::String(const char* value) : _value(::strlen(value)) |
144 |
+ { |
145 |
+ assert(_value.size() <= Integer::MAX_VALUE); |
146 |
+ |
147 |
+- u_charsToUChars(value, _value.data(), _value.size()); |
148 |
++ u_charsToUChars(value, reinterpret_cast<UChar*>(_value.data()), _value.size()); |
149 |
+ } |
150 |
+ |
151 |
+ String::String(const jchar* value, int offset, int length) : _value(value+offset, length) |
152 |
+@@ -449,7 +451,7 @@ std::ostream& beecrypt::lang::operator<<(std::ostream& stream, const String& str |
153 |
+ if (U_FAILURE(status)) |
154 |
+ throw RuntimeException("ucnv_open failed"); |
155 |
+ |
156 |
+- int need = ucnv_fromUChars(loc, 0, 0, src.data(), src.size(), &status); |
157 |
++ int need = ucnv_fromUChars(loc, 0, 0, reinterpret_cast<const UChar*>(src.data()), src.size(), &status); |
158 |
+ if (U_FAILURE(status)) |
159 |
+ if (status != U_BUFFER_OVERFLOW_ERROR) |
160 |
+ throw RuntimeException("ucnv_fromUChars failed"); |
161 |
+@@ -458,7 +460,7 @@ std::ostream& beecrypt::lang::operator<<(std::ostream& stream, const String& str |
162 |
+ |
163 |
+ status = U_ZERO_ERROR; |
164 |
+ |
165 |
+- ucnv_fromUChars(loc, out, need+1, src.data(), src.size(), &status); |
166 |
++ ucnv_fromUChars(loc, out, need+1, reinterpret_cast<const UChar*>(src.data()), src.size(), &status); |
167 |
+ if (U_FAILURE(status)) |
168 |
+ throw RuntimeException("ucnv_fromUChars failed"); |
169 |
+ |
170 |
+--- a/c++/lang/StringBuffer.cxx |
171 |
++++ b/c++/lang/StringBuffer.cxx |
172 |
+@@ -35,7 +35,7 @@ StringBuffer::StringBuffer() : _buffer(16) |
173 |
+ |
174 |
+ StringBuffer::StringBuffer(const char* s) : _buffer(16 + strlen(s)) |
175 |
+ { |
176 |
+- u_charsToUChars(s, _buffer.data(), _used = strlen(s)); |
177 |
++ u_charsToUChars(s, reinterpret_cast<UChar*>(_buffer.data()), _used = strlen(s)); |
178 |
+ } |
179 |
+ |
180 |
+ StringBuffer::StringBuffer(const String& s) : _buffer(16 + s._value.size()) |
181 |
+@@ -53,7 +53,7 @@ StringBuffer& StringBuffer::append(char c) |
182 |
+ synchronized (this) |
183 |
+ { |
184 |
+ core_ensureCapacity(_used+1); |
185 |
+- u_charsToUChars(&c, _buffer.data() + _used++, 1); |
186 |
++ u_charsToUChars(&c, reinterpret_cast<UChar*>(_buffer.data() + _used++), 1); |
187 |
+ } |
188 |
+ return *this; |
189 |
+ } |
190 |
+@@ -88,7 +88,7 @@ StringBuffer& StringBuffer::append(const char* s) |
191 |
+ jint need = strlen(s); |
192 |
+ |
193 |
+ core_ensureCapacity(_used + need); |
194 |
+- u_charsToUChars(s, _buffer.data() + _used, need); |
195 |
++ u_charsToUChars(s, reinterpret_cast<UChar*>(_buffer.data() + _used), need); |
196 |
+ |
197 |
+ _used += need; |
198 |
+ } |
199 |
+--- a/c++/lang/StringBuilder.cxx |
200 |
++++ b/c++/lang/StringBuilder.cxx |
201 |
+@@ -38,7 +38,7 @@ StringBuilder::StringBuilder() : _buffer(16) |
202 |
+ |
203 |
+ StringBuilder::StringBuilder(const char* s) : _buffer(16 + strlen(s)) |
204 |
+ { |
205 |
+- u_charsToUChars(s, _buffer.data(), _used = strlen(s)); |
206 |
++ u_charsToUChars(s, reinterpret_cast<UChar*>(_buffer.data()), _used = strlen(s)); |
207 |
+ } |
208 |
+ |
209 |
+ StringBuilder::StringBuilder(const String& s) : _buffer(16 + s._value.size()) |
210 |
+@@ -55,7 +55,7 @@ StringBuilder& StringBuilder::append(char c) |
211 |
+ { |
212 |
+ ensureCapacity(_used+1); |
213 |
+ |
214 |
+- u_charsToUChars(&c, _buffer.data() + _used++, 1); |
215 |
++ u_charsToUChars(&c, reinterpret_cast<UChar*>(_buffer.data() + _used++), 1); |
216 |
+ |
217 |
+ return *this; |
218 |
+ } |
219 |
+@@ -97,7 +97,7 @@ StringBuilder& StringBuilder::append(const char* s) |
220 |
+ |
221 |
+ ensureCapacity(_used + need); |
222 |
+ |
223 |
+- u_charsToUChars(s, _buffer.data() + _used, need); |
224 |
++ u_charsToUChars(s, reinterpret_cast<UChar*>(_buffer.data() + _used), need); |
225 |
+ |
226 |
+ _used += need; |
227 |
+ |
228 |
+--- a/c++/security/Provider.cxx |
229 |
++++ b/c++/security/Provider.cxx |
230 |
+@@ -90,7 +90,7 @@ Object* Provider::setProperty(const String& key, const String& value) |
231 |
+ |
232 |
+ UErrorCode status = U_ZERO_ERROR; |
233 |
+ |
234 |
+- ucnv_fromUChars(_conv, symname, 1024, src.data(), src.size(), &status); |
235 |
++ ucnv_fromUChars(_conv, symname, 1024, reinterpret_cast<const UChar*>(src.data()), src.size(), &status); |
236 |
+ |
237 |
+ if (status != U_ZERO_ERROR) |
238 |
+ throw RuntimeException("error in ucnv_fromUChars"); |
239 |
+--- a/c++/security/Security.cxx |
240 |
++++ b/c++/security/Security.cxx |
241 |
+@@ -104,7 +104,7 @@ void Security::initialize() |
242 |
+ |
243 |
+ const array<jchar>& src = value->toCharArray(); |
244 |
+ |
245 |
+- int need = ucnv_fromUChars(_loc, 0, 0, src.data(), src.size(), &status); |
246 |
++ int need = ucnv_fromUChars(_loc, 0, 0, reinterpret_cast<const UChar*>(src.data()), src.size(), &status); |
247 |
+ if (U_FAILURE(status)) |
248 |
+ if (status != U_BUFFER_OVERFLOW_ERROR) |
249 |
+ throw RuntimeException("ucnv_fromUChars failed"); |
250 |
+@@ -112,7 +112,7 @@ void Security::initialize() |
251 |
+ char* shared_library = new char[need+1]; |
252 |
+ |
253 |
+ status = U_ZERO_ERROR; |
254 |
+- ucnv_fromUChars(_loc, shared_library, need+1, src.data(), src.size(), &status); |
255 |
++ ucnv_fromUChars(_loc, shared_library, need+1, reinterpret_cast<const UChar*>(src.data()), src.size(), &status); |
256 |
+ if (U_FAILURE(status)) |
257 |
+ throw RuntimeException("ucnv_fromUChars failed"); |
258 |
+ |