Gentoo Archives: gentoo-commits

From: "Pacho Ramos (pacho)" <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-libs/taglib/files: taglib-1.9.1-missing-deletes.patch taglib-1.9.1-bytevector-simpler.patch taglib-1.9.1-order-big-endian.patch taglib-1.9.1-abi-breakage.patch
Date: Mon, 07 Jul 2014 12:51:55
Message-Id: 20140707124345.86B622004E@flycatcher.gentoo.org
1 pacho 14/07/07 12:43:45
2
3 Added: taglib-1.9.1-missing-deletes.patch
4 taglib-1.9.1-bytevector-simpler.patch
5 taglib-1.9.1-order-big-endian.patch
6 taglib-1.9.1-abi-breakage.patch
7 Log:
8 Apply some upstream patches fixing important bugs like an accidental ABI breakage (#516342#c1 by CT)
9
10 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key A188FBD4)
11
12 Revision Changes Path
13 1.1 media-libs/taglib/files/taglib-1.9.1-missing-deletes.patch
14
15 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/taglib/files/taglib-1.9.1-missing-deletes.patch?rev=1.1&view=markup
16 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/taglib/files/taglib-1.9.1-missing-deletes.patch?rev=1.1&content-type=text/plain
17
18 Index: taglib-1.9.1-missing-deletes.patch
19 ===================================================================
20 From c14a3b5c3d0831f7c113d0cf95840c4671d9ebd4 Mon Sep 17 00:00:00 2001
21 From: Tsuda Kageyu <tsuda.kageyu@×××××.com>
22 Date: Tue, 13 May 2014 20:07:02 +0900
23 Subject: [PATCH] Added some missing deletes to test_flac.cpp.
24
25 ---
26 tests/test_flac.cpp | 4 ++++
27 1 file changed, 4 insertions(+)
28
29 diff --git a/tests/test_flac.cpp b/tests/test_flac.cpp
30 index caec715..364fb11 100644
31 --- a/tests/test_flac.cpp
32 +++ b/tests/test_flac.cpp
33 @@ -91,6 +91,7 @@ public:
34 newpic->setData("JPEG data");
35 f->addPicture(newpic);
36 f->save();
37 + delete f;
38
39 f = new FLAC::File(newname.c_str());
40 lst = f->pictureList();
41 @@ -138,6 +139,7 @@ public:
42 f->removePictures();
43 f->addPicture(newpic);
44 f->save();
45 + delete f;
46
47 f = new FLAC::File(newname.c_str());
48 lst = f->pictureList();
49 @@ -165,6 +167,7 @@ public:
50
51 f->removePictures();
52 f->save();
53 + delete f;
54
55 f = new FLAC::File(newname.c_str());
56 lst = f->pictureList();
57 @@ -185,6 +188,7 @@ public:
58 tag->setTitle("NEW TITLE 2");
59 f->save();
60 CPPUNIT_ASSERT_EQUAL(String("NEW TITLE 2"), tag->title());
61 + delete f;
62
63 f = new FLAC::File(newname.c_str());
64 tag = f->tag();
65 --
66 1.9.0
67
68
69
70
71 1.1 media-libs/taglib/files/taglib-1.9.1-bytevector-simpler.patch
72
73 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/taglib/files/taglib-1.9.1-bytevector-simpler.patch?rev=1.1&view=markup
74 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/taglib/files/taglib-1.9.1-bytevector-simpler.patch?rev=1.1&content-type=text/plain
75
76 Index: taglib-1.9.1-bytevector-simpler.patch
77 ===================================================================
78 From 4a7d31c87bf41c1de21cb725176d5b34c2a95720 Mon Sep 17 00:00:00 2001
79 From: Tsuda Kageyu <tsuda.kageyu@×××××.com>
80 Date: Thu, 14 Nov 2013 14:05:32 +0900
81 Subject: [PATCH 3/6] Rewrote ByteVector::replace() simpler
82
83 ---
84 taglib/toolkit/tbytevector.cpp | 77 +++++++++++++++---------------------------
85 tests/test_bytevector.cpp | 5 +++
86 2 files changed, 33 insertions(+), 49 deletions(-)
87
88 diff --git a/taglib/toolkit/tbytevector.cpp b/taglib/toolkit/tbytevector.cpp
89 index b658246..566a20f 100644
90 --- a/taglib/toolkit/tbytevector.cpp
91 +++ b/taglib/toolkit/tbytevector.cpp
92 @@ -31,6 +31,7 @@
93 #include <iostream>
94 #include <cstdio>
95 #include <cstring>
96 +#include <cstddef>
97
98 #include <tstring.h>
99 #include <tdebug.h>
100 @@ -508,62 +509,40 @@ ByteVector &ByteVector::replace(const ByteVector &pattern, const ByteVector &wit
101 if(pattern.size() == 0 || pattern.size() > size())
102 return *this;
103
104 - const uint withSize = with.size();
105 - const uint patternSize = pattern.size();
106 - int offset = 0;
107 + const size_t withSize = with.size();
108 + const size_t patternSize = pattern.size();
109 + const ptrdiff_t diff = withSize - patternSize;
110 +
111 + size_t offset = 0;
112 + while (true)
113 + {
114 + offset = find(pattern, offset);
115 + if(offset == static_cast<size_t>(-1)) // Use npos in taglib2.
116 + break;
117
118 - if(withSize == patternSize) {
119 - // I think this case might be common enough to optimize it
120 detach();
121 - offset = find(pattern);
122 - while(offset >= 0) {
123 - ::memcpy(data() + offset, with.data(), withSize);
124 - offset = find(pattern, offset + withSize);
125 - }
126 - return *this;
127 - }
128
129 - // calculate new size:
130 - uint newSize = 0;
131 - for(;;) {
132 - int next = find(pattern, offset);
133 - if(next < 0) {
134 - if(offset == 0)
135 - // pattern not found, do nothing:
136 - return *this;
137 - newSize += size() - offset;
138 - break;
139 + if(diff < 0) {
140 + ::memmove(
141 + data() + offset + withSize,
142 + data() + offset + patternSize,
143 + size() - offset - patternSize);
144 + resize(size() + diff);
145 }
146 - newSize += (next - offset) + withSize;
147 - offset = next + patternSize;
148 - }
149 -
150 - // new private data of appropriate size:
151 - ByteVectorPrivate *newData = new ByteVectorPrivate(newSize, 0);
152 - char *target = DATA(newData);
153 - const char *source = data();
154 -
155 - // copy modified data into new private data:
156 - offset = 0;
157 - for(;;) {
158 - int next = find(pattern, offset);
159 - if(next < 0) {
160 - ::memcpy(target, source + offset, size() - offset);
161 - break;
162 + else if(diff > 0) {
163 + resize(size() + diff);
164 + ::memmove(
165 + data() + offset + withSize,
166 + data() + offset + patternSize,
167 + size() - diff - offset - patternSize);
168 }
169 - int chunkSize = next - offset;
170 - ::memcpy(target, source + offset, chunkSize);
171 - target += chunkSize;
172 - ::memcpy(target, with.data(), withSize);
173 - target += withSize;
174 - offset += chunkSize + patternSize;
175 - }
176
177 - // replace private data:
178 - if(d->deref())
179 - delete d;
180 + ::memcpy(data() + offset, with.data(), with.size());
181
182 - d = newData;
183 + offset += withSize;
184 + if(offset > size() - patternSize)
185 + break;
186 + }
187
188 return *this;
189 }
190 diff --git a/tests/test_bytevector.cpp b/tests/test_bytevector.cpp
191 index 9efd23a..eca74f8 100644
192 --- a/tests/test_bytevector.cpp
193 +++ b/tests/test_bytevector.cpp
194 @@ -239,6 +239,11 @@ public:
195 a.replace(ByteVector("ab"), ByteVector());
196 CPPUNIT_ASSERT_EQUAL(ByteVector("cdf"), a);
197 }
198 + {
199 + ByteVector a("abcdabf");
200 + a.replace(ByteVector("bf"), ByteVector("x"));
201 + CPPUNIT_ASSERT_EQUAL(ByteVector("abcdax"), a);
202 + }
203 }
204
205 };
206 --
207 1.8.4.2
208
209
210
211
212 1.1 media-libs/taglib/files/taglib-1.9.1-order-big-endian.patch
213
214 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/taglib/files/taglib-1.9.1-order-big-endian.patch?rev=1.1&view=markup
215 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/taglib/files/taglib-1.9.1-order-big-endian.patch?rev=1.1&content-type=text/plain
216
217 Index: taglib-1.9.1-order-big-endian.patch
218 ===================================================================
219 From db3e961d1098d5efe57364f540f68a5996dc83c2 Mon Sep 17 00:00:00 2001
220 From: Tsuda Kageyu <tsuda.kageyu@×××××.com>
221 Date: Tue, 13 May 2014 18:22:16 +0900
222 Subject: [PATCH] Fixed a wrong byte order handling on big-endian machines.
223
224 ---
225 taglib/toolkit/tstring.cpp | 8 ++++++--
226 1 file changed, 6 insertions(+), 2 deletions(-)
227
228 diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp
229 index 603455a..1ec083b 100644
230 --- a/taglib/toolkit/tstring.cpp
231 +++ b/taglib/toolkit/tstring.cpp
232 @@ -47,10 +47,14 @@
233
234 namespace
235 {
236 -
237 inline unsigned short combine(unsigned char c1, unsigned char c2)
238 {
239 - return (c1 << 8) | c2;
240 + using namespace TagLib::Utils;
241 +
242 + if(SystemByteOrder == LittleEndian)
243 + return (c1 << 8) | c2;
244 + else
245 + return (c2 << 8) | c1;
246 }
247
248 void UTF16toUTF8(const wchar_t *src, size_t srcLength, char *dst, size_t dstLength)
249 --
250 1.9.0
251
252
253
254
255 1.1 media-libs/taglib/files/taglib-1.9.1-abi-breakage.patch
256
257 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/taglib/files/taglib-1.9.1-abi-breakage.patch?rev=1.1&view=markup
258 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/taglib/files/taglib-1.9.1-abi-breakage.patch?rev=1.1&content-type=text/plain
259
260 Index: taglib-1.9.1-abi-breakage.patch
261 ===================================================================
262 From 3bf30af66c8fd77a88d9379a0956ddb2fc70dc20 Mon Sep 17 00:00:00 2001
263 From: Tsuda Kageyu <tsuda.kageyu@×××××.com>
264 Date: Wed, 6 Nov 2013 17:01:21 +0900
265 Subject: [PATCH 2/6] Fixed ABI breakage in TagLib::String
266
267 ---
268 taglib/toolkit/tstring.cpp | 20 ++++++++++++++++++--
269 taglib/toolkit/tstring.h | 12 ++++++++++--
270 tests/test_string.cpp | 14 ++++++++++++++
271 3 files changed, 42 insertions(+), 4 deletions(-)
272
273 diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp
274 index 75a9833..fb6e947 100644
275 --- a/taglib/toolkit/tstring.cpp
276 +++ b/taglib/toolkit/tstring.cpp
277 @@ -209,8 +209,16 @@ String::String(const std::string &s, Type t)
278 String::String(const wstring &s, Type t)
279 : d(new StringPrivate())
280 {
281 - if(t == UTF16 || t == UTF16BE || t == UTF16LE)
282 + if(t == UTF16 || t == UTF16BE || t == UTF16LE) {
283 + // This looks ugly but needed for the compatibility with TagLib1.8.
284 + // Should be removed in TabLib2.0.
285 + if (t == UTF16BE)
286 + t = WCharByteOrder;
287 + else if (t == UTF16LE)
288 + t = (WCharByteOrder == UTF16LE ? UTF16BE : UTF16LE);
289 +
290 copyFromUTF16(s.c_str(), s.length(), t);
291 + }
292 else {
293 debug("String::String() -- A TagLib::wstring should not contain Latin1 or UTF-8.");
294 }
295 @@ -219,8 +227,16 @@ String::String(const wstring &s, Type t)
296 String::String(const wchar_t *s, Type t)
297 : d(new StringPrivate())
298 {
299 - if(t == UTF16 || t == UTF16BE || t == UTF16LE)
300 + if(t == UTF16 || t == UTF16BE || t == UTF16LE) {
301 + // This looks ugly but needed for the compatibility with TagLib1.8.
302 + // Should be removed in TabLib2.0.
303 + if (t == UTF16BE)
304 + t = WCharByteOrder;
305 + else if (t == UTF16LE)
306 + t = (WCharByteOrder == UTF16LE ? UTF16BE : UTF16LE);
307 +
308 copyFromUTF16(s, ::wcslen(s), t);
309 + }
310 else {
311 debug("String::String() -- A const wchar_t * should not contain Latin1 or UTF-8.");
312 }
313 diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h
314 index 57945be..605b9c2 100644
315 --- a/taglib/toolkit/tstring.h
316 +++ b/taglib/toolkit/tstring.h
317 @@ -134,13 +134,21 @@ namespace TagLib {
318
319 /*!
320 * Makes a deep copy of the data in \a s.
321 + *
322 + * /note If \a t is UTF16LE, the byte order of \a s will be swapped regardless
323 + * of the CPU byte order. If UTF16BE, it will not be swapped. This behavior
324 + * will be changed in TagLib2.0.
325 */
326 - String(const wstring &s, Type t = WCharByteOrder);
327 + String(const wstring &s, Type t = UTF16BE);
328
329 /*!
330 * Makes a deep copy of the data in \a s.
331 + *
332 + * /note If \a t is UTF16LE, the byte order of \a s will be swapped regardless
333 + * of the CPU byte order. If UTF16BE, it will not be swapped. This behavior
334 + * will be changed in TagLib2.0.
335 */
336 - String(const wchar_t *s, Type t = WCharByteOrder);
337 + String(const wchar_t *s, Type t = UTF16BE);
338
339 /*!
340 * Makes a deep copy of the data in \a c.
341 diff --git a/tests/test_string.cpp b/tests/test_string.cpp
342 index a815a0b..9a574b3 100644
343 --- a/tests/test_string.cpp
344 +++ b/tests/test_string.cpp
345 @@ -75,6 +75,20 @@ public:
346 String unicode3(L"\u65E5\u672C\u8A9E");
347 CPPUNIT_ASSERT(*(unicode3.toCWString() + 1) == L'\u672C');
348
349 + String unicode4(L"\u65e5\u672c\u8a9e", String::UTF16BE);
350 + CPPUNIT_ASSERT(unicode4[1] == L'\u672c');
351 +
352 + String unicode5(L"\u65e5\u672c\u8a9e", String::UTF16LE);
353 + CPPUNIT_ASSERT(unicode5[1] == L'\u2c67');
354 +
355 + wstring stduni = L"\u65e5\u672c\u8a9e";
356 +
357 + String unicode6(stduni, String::UTF16BE);
358 + CPPUNIT_ASSERT(unicode6[1] == L'\u672c');
359 +
360 + String unicode7(stduni, String::UTF16LE);
361 + CPPUNIT_ASSERT(unicode7[1] == L'\u2c67');
362 +
363 CPPUNIT_ASSERT(strcmp(String::number(0).toCString(), "0") == 0);
364 CPPUNIT_ASSERT(strcmp(String::number(12345678).toCString(), "12345678") == 0);
365 CPPUNIT_ASSERT(strcmp(String::number(-12345678).toCString(), "-12345678") == 0);
366 --
367 1.8.4.2