Accepting request 173626 from home:plater

Fix bnc#814814 with taglib-1.8-ds-rusxmms-r8.patch

OBS-URL: https://build.opensuse.org/request/show/173626
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/taglib?expand=0&rev=52
This commit is contained in:
Dave Plater 2013-04-28 10:09:07 +00:00 committed by Git OBS Bridge
parent 08adc432c1
commit 80e22483e7
3 changed files with 101 additions and 20 deletions

View File

@ -34,6 +34,18 @@ diff -dPNur taglib-1.8/examples/tagreader_c.c taglib-1.8-ds/examples/tagreader_c
for(i = 1; i < argc; i++) {
printf("******************** \"%s\" ********************\n", argv[i]);
diff -dPNur taglib-1.8/examples/tagwriter.cpp taglib-1.8-ds/examples/tagwriter.cpp
--- taglib-1.8/examples/tagwriter.cpp 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/examples/tagwriter.cpp 2013-04-25 23:48:17.000000000 +0200
@@ -92,7 +92,7 @@
if(isArgument(argv[i]) && i + 1 < argc && !isArgument(argv[i + 1])) {
char field = argv[i][1];
- TagLib::String value = argv[i + 1];
+ TagLib::String value(argv[i + 1], TagLib::String::Locale);
TagLib::List<TagLib::FileRef>::Iterator it;
for(it = fileList.begin(); it != fileList.end(); ++it) {
diff -dPNur taglib-1.8/taglib/CMakeLists.txt taglib-1.8-ds/taglib/CMakeLists.txt
--- taglib-1.8/taglib/CMakeLists.txt 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/taglib/CMakeLists.txt 2013-04-24 17:44:12.000000000 +0200
@ -163,19 +175,25 @@ diff -dPNur taglib-1.8/taglib/mpeg/id3v2/frames/textidentificationframe.cpp tagl
diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.cpp taglib-1.8-ds/taglib/toolkit/rccpatch.cpp
--- taglib-1.8/taglib/toolkit/rccpatch.cpp 1970-01-01 01:00:00.000000000 +0100
+++ taglib-1.8-ds/taglib/toolkit/rccpatch.cpp 2013-04-24 17:44:12.000000000 +0200
@@ -0,0 +1,195 @@
+++ taglib-1.8-ds/taglib/toolkit/rccpatch.cpp 2013-04-26 06:40:40.000000000 +0200
@@ -0,0 +1,237 @@
+#include <stdlib.h>
+
+#include <string>
+#include "tstring.h"
+#include "tbytevector.h"
+
+//#define RCC_DEBUG
+
+
+#ifndef HAVE_LIBRCC
+# include <config.h>
+#endif
+
+#ifdef HAVE_LIBRCC
+# ifdef RCC_DEBUG
+# include <stdio.h>
+# endif /* RCC_DEBUG */
+# include <librcc.h>
+# include <string.h>
+#endif /* HAVE_LIBRCC */
@ -248,8 +266,18 @@ diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.cpp taglib-1.8-ds/taglib/toolkit/
+ rccTaglibPatchTryInit();
+
+ res = rccSizedRecode(ctx, UTF_CLASS, OUT_CLASS, s.c_str(), s.length(), &rlen);
+#ifdef RCC_DEBUG
+ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
+ if (*c > 127) {
+ printf(" Output: %s - %s\n", s.c_str(), res?res:"null");
+ break;
+ }
+ }
+#endif /* RCC_DEBUG */
+
+ if (res) v.setData(res, rlen);
+ else v.setData(s.c_str(), s.length());
+ else v.setData("", 0);
+ //v.setData(s.c_str(), s.length());
+
+ return v;
+#else
@ -268,8 +296,18 @@ diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.cpp taglib-1.8-ds/taglib/toolkit/
+ rccTaglibPatchTryInit();
+
+ res = rccSizedRecode(ctx, UTF_CLASS, v2?ID3V2_CLASS:ID3_CLASS, s.c_str(), s.length(), &rlen);
+#ifdef RCC_DEBUG
+ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
+ if (*c > 127) {
+ printf(" OutputID3(%i): %s - %s\n", v2, s.c_str(), res?res:"null");
+ break;
+ }
+ }
+#endif /* RCC_DEBUG */
+
+ if (res) v.setData(res, rlen);
+ else v.setData(s.c_str(), s.length());
+ else v.setData("", 0);
+ //v.setData(s.c_str(), s.length());
+
+ return v;
+#else
@ -288,6 +326,15 @@ diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.cpp taglib-1.8-ds/taglib/toolkit/
+ rccTaglibPatchTryInit();
+
+ res = rccSizedRecode(ctx, OUT_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
+#ifdef RCC_DEBUG
+ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
+ if (*c > 127) {
+ printf(" Input: %s - %s\n", s.c_str(), res?res:"null");
+ break;
+ }
+ }
+#endif /* RCC_DEBUG */
+
+ if (res) v.setData(res, rlen);
+ else
+#endif /* HAVE_LIBRCC */
@ -305,6 +352,14 @@ diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.cpp taglib-1.8-ds/taglib/toolkit/
+ rccTaglibPatchTryInit();
+
+ res = rccSizedRecode(ctx, v2?ID3V2_CLASS:ID3_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
+#ifdef RCC_DEBUG
+ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
+ if (*c > 127) {
+ printf(" InputID3(%i): %s - %s\n", v2, s.c_str(), res?res:"null");
+ break;
+ }
+ }
+#endif /* RCC_DEBUG */
+ if (res) v.setData(res, rlen);
+ else
+#endif /* HAVE_LIBRCC */
@ -319,7 +374,6 @@ diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.cpp taglib-1.8-ds/taglib/toolkit/
+ char charset[32];
+
+ rccTaglibPatchTryInit();
+
+ if (!rccLocaleGetCharset(charset, NULL, 31)) {
+ if (!strncmp(charset, "UTF", 3)) {
+ len = strlen(charset);
@ -386,7 +440,7 @@ diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.h taglib-1.8-ds/taglib/toolkit/rc
+#endif /* _RCC_PATCH_H */
diff -dPNur taglib-1.8/taglib/toolkit/tstring.cpp taglib-1.8-ds/taglib/toolkit/tstring.cpp
--- taglib-1.8/taglib/toolkit/tstring.cpp 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/taglib/toolkit/tstring.cpp 2013-04-24 17:48:10.000000000 +0200
+++ taglib-1.8-ds/taglib/toolkit/tstring.cpp 2013-04-26 07:11:38.000000000 +0200
@@ -23,6 +23,7 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
@ -404,32 +458,47 @@ diff -dPNur taglib-1.8/taglib/toolkit/tstring.cpp taglib-1.8-ds/taglib/toolkit/t
int length = 0;
d->data.resize(v.size());
@@ -397,8 +398,24 @@
@@ -397,10 +398,38 @@
{
ByteVector v;
+ if (t == Locale) t = rccTaglibPatchGetLocaleType();
- switch(t) {
+ if (t == Locale) {
+ // The source is either Unicode or real Latin1 (if rcc is bypassed)
+ std::string s = to8Bit(true);
+
switch(t) {
+ case Locale:
+ // In case of UTF8 locale, this probably will return NULL (no recoding needed), but we will take UTF8 path in the next swtich
+ v = rccTaglibPatchRecodeOutput(s);
+ if (v.size()) return v;
+ t = rccTaglibPatchGetLocaleType();
+ }
+
+ switch(t) {
+ case Latin1ID3:
+ case Latin1ID3V2:
+ {
+ std::string s = to8Bit(true);
+ if (t == Latin1ID3) v = rccTaglibPatchRecodeOutputID3(s, false);
+ else if (t == Latin1ID3V2) v = rccTaglibPatchRecodeOutputID3(s, true);
+ else /* if (t == Latin1(Locale) */ v = rccTaglibPatchRecodeOutput(s);
+ if (v.size()) return v;
+ if (v.size()) break;
+
+ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
+ v.append(char(*it));
+ // we don't know if we got NULL because rcc is disabled (error) or UTF8 output is required
+ if ((t == Latin1ID3V2)&&(rccTaglibPatchGetID3Type() == UTF8)) {
+ v.setData(s.c_str(), s.length());
+ } else {
+ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
+ v.append(char(*it));
+ }
+ break;
+ }
case Latin1:
{
+ // We can have the UTF16 inside, but first 256 positions is equal to Latin1
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
@@ -750,6 +767,30 @@
v.append(char(*it));
break;
@@ -750,6 +779,34 @@
void String::prepare(Type t)
{
@ -454,13 +523,17 @@ diff -dPNur taglib-1.8/taglib/toolkit/tstring.cpp taglib-1.8-ds/taglib/toolkit/t
+ }
+ d->data.resize(length);
+ t = UTF8;
+ } else {
+ // We don't know if we got UTF-8 encoded string or either rcc is disable or something is failed,
+ // since standard applications are really expecting here Latin1, it is safe to just check if we have violations of UTF8
+ //if (Unicode::isLegalUTF8(s)) t = UTF8;
+ }
+ }
+
switch(t) {
case UTF16:
{
@@ -839,6 +880,27 @@
@@ -839,6 +896,27 @@
std::ostream &operator<<(std::ostream &s, const String &str)
{

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Apr 26 17:19:29 UTC 2013 - davejplater@gmail.com
- Added taglib-1.8-ds-rusxmms-r8.patch which fixes bnc#814814
- Removed old taglib-1.8-ds-rusxmms-r4.patch
-------------------------------------------------------------------
Thu Apr 25 17:05:18 UTC 2013 - davejplater@gmail.com

View File

@ -27,7 +27,7 @@ Source0: https://github.com/downloads/taglib/taglib/%{name}-%{version}.ta
Source1: %{name}.desktop
Source100: baselibs.conf
# This patch is to fix bnc#814814.
Patch0: taglib-1.8-ds-rusxmms-r4.patch
Patch0: taglib-1.8-ds-rusxmms-r8.patch
Patch1: taglib-1.7.2-doxygen.patch
# PATCH-FIX-UPSTREAM taglib-1.8-version_fix.patch - fix version defines in taglib.h
Patch2: taglib-1.8-version_fix.patch
@ -46,8 +46,10 @@ BuildRequires: update-desktop-files
%endif
BuildRequires: librcc-devel
BuildRequires: zlib-devel
Requires: libtag1 = %{version}
Requires: libtag_c0 = %{version}
# NOTE: The tagreader and writer executables give different results when built with
# an earlier taglib-1.8-ds-rusxmms patch. See bnc#814814
Requires: libtag1 = %{version}-%{release}
Requires: libtag_c0 = %{version}-%{release}
%description
TagLib is a library for reading and editing the meta-data of several popular