View | Details | Raw Unified | Return to bug 221157
Collapse All | Expand All

(-)audio/taglib/Makefile (-3 / +11 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	taglib
4
PORTNAME=	taglib
5
PORTVERSION=	1.10
5
PORTVERSION=	1.11.1
6
CATEGORIES=	audio
6
CATEGORIES=	audio
7
MASTER_SITES=	http://taglib.github.io/releases/
7
MASTER_SITES=	http://taglib.github.io/releases/
8
8
Lines 9-15 Link Here
9
MAINTAINER=	jhale@FreeBSD.org
9
MAINTAINER=	jhale@FreeBSD.org
10
COMMENT=	Library for manipulating ID3 tags and Ogg comments
10
COMMENT=	Library for manipulating ID3 tags and Ogg comments
11
11
12
LICENSE=	LGPL21 MPL
12
LICENSE=	LGPL21 MPL11
13
LICENSE_COMB=	dual
13
LICENSE_COMB=	dual
14
LICENSE_FILE_LGPL21=	${WRKSRC}/COPYING.LGPL
14
LICENSE_FILE_LGPL21=	${WRKSRC}/COPYING.LGPL
15
LICENSE_FILE_MPL=	${WRKSRC}/COPYING.MPL
15
LICENSE_FILE_MPL=	${WRKSRC}/COPYING.MPL
Lines 16-22 Link Here
16
16
17
USES=		cmake cpe pathfix
17
USES=		cmake cpe pathfix
18
CMAKE_ARGS=	-DWITH_ASF:BOOL=ON \
18
CMAKE_ARGS=	-DWITH_ASF:BOOL=ON \
19
		-DWITH_MP4:BOOL=ON
19
		-DWITH_MP4:BOOL=ON \
20
		-DBUILD_SHARED_LIBS:BOOL=ON
21
20
USE_LDCONFIG=	yes
22
USE_LDCONFIG=	yes
21
23
22
CPE_VENDOR=	scott_wheeler
24
CPE_VENDOR=	scott_wheeler
Lines 24-29 Link Here
24
OPTIONS_DEFINE=	RCC
26
OPTIONS_DEFINE=	RCC
25
OPTIONS_SUB=	yes
27
OPTIONS_SUB=	yes
26
28
29
# The official patches for this can be obtained from:
30
#   http://darksoft.org/files/rusxmms/patches/
31
# however, they do not seem to yet have any for taglib-1.11.1.
32
# So instead, use:
33
#   https://sourceforge.net/p/qmmp-dev/code/HEAD/tree/trunk/extras/package/win32/contrib/taglib-rusxmms/
34
#
27
RCC_DESC=		Build with RusXMMS librcc patches (experimental)
35
RCC_DESC=		Build with RusXMMS librcc patches (experimental)
28
RCC_LIB_DEPENDS=	librcc.so:devel/librcc
36
RCC_LIB_DEPENDS=	librcc.so:devel/librcc
29
RCC_EXTRA_PATCHES=	${FILESDIR}/extrapatch-rcc
37
RCC_EXTRA_PATCHES=	${FILESDIR}/extrapatch-rcc
(-)audio/taglib/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (taglib-1.10.tar.gz) = 24c32d50042cb0ddf162eb263f8ac75c5a158e12bf32ed534c1d5c71ee369baa
1
TIMESTAMP = 1501054372
2
SIZE (taglib-1.10.tar.gz) = 1233893
2
SHA256 (taglib-1.11.1.tar.gz) = b6d1a5a610aae6ff39d93de5efd0fdc787aa9e9dc1e7026fa4c961b26563526b
3
SIZE (taglib-1.11.1.tar.gz) = 1261620
(-)audio/taglib/files/extrapatch-rcc (-141 / +161 lines)
Lines 1-27 Link Here
1
--- ConfigureChecks.cmake.orig	2015-11-11 21:41:59 UTC
1
Obtained from:
2
+++ ConfigureChecks.cmake
2
	https://sourceforge.net/p/qmmp-dev/code/HEAD/tree/trunk/extras/package/win32/contrib/taglib-rusxmms/taglib-1.11.1-ds-rusxmms.patch?format=raw
3
@@ -201,6 +201,8 @@ if(NOT ZLIB_SOURCE)
3
4
   endif()
4
diff --git CMakeLists.txt CMakeLists.txt
5
index a59efc9..eda2f53 100644
6
--- CMakeLists.txt
7
+++ CMakeLists.txt
8
@@ -120,6 +120,8 @@ if(NOT HAVE_ZLIB AND ZLIB_SOURCE)
9
   set(HAVE_ZLIB_SOURCE 1)
5
 endif()
10
 endif()
6
 
11
 
7
+SET(HAVE_LIBRCC 1)
12
+SET(HAVE_LIBRCC 1)
8
+
13
+
9
 if(BUILD_TESTS)
14
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
10
   find_package(CppUnit)
15
 configure_file(config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h")
11
   if(NOT CppUnit_FOUND)
16
 
12
--- config.h.cmake.orig	2015-11-11 21:41:59 UTC
17
diff --git config.h.cmake config.h.cmake
18
index 7eb5993..8d4a541 100644
19
--- config.h.cmake
13
+++ config.h.cmake
20
+++ config.h.cmake
14
@@ -22,6 +22,9 @@
21
@@ -30,4 +30,7 @@
15
 /* Defined if you have libz */
22
 /* Indicates whether debug messages are shown even in release mode */
16
 #cmakedefine   HAVE_ZLIB 1
23
 #cmakedefine   TRACE_IN_RELEASE 1
17
 
24
 
18
+/* Defined if you have LibRCC from RusXMMS project */
25
+/* Defined if you have LibRCC from RusXMMS project */
19
+#cmakedefine   HAVE_LIBRCC 1
26
+#cmakedefine   HAVE_LIBRCC 1
20
+
27
+
21
 /* Indicates whether debug messages are shown even in release mode */
28
 #cmakedefine TESTS_DIR "@TESTS_DIR@"
22
 #cmakedefine   TRACE_IN_RELEASE 1
29
diff --git examples/tagreader_c.c examples/tagreader_c.c
23
 
30
index 0436992..e0f17d8 100644
24
--- examples/tagreader_c.c.orig	2015-11-11 21:41:59 UTC
31
--- examples/tagreader_c.c
25
+++ examples/tagreader_c.c
32
+++ examples/tagreader_c.c
26
@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
33
@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
27
   TagLib_Tag *tag;
34
   TagLib_Tag *tag;
Lines 28-38 Link Here
28
   const TagLib_AudioProperties *properties;
35
   const TagLib_AudioProperties *properties;
29
 
36
 
30
-  taglib_set_strings_unicode(FALSE);
37
-  taglib_set_strings_unicode(FALSE);
31
+//  taglib_set_strings_unicode(FALSE);
38
+  //taglib_set_strings_unicode(FALSE);
32
 
39
 
33
   for(i = 1; i < argc; i++) {
40
   for(i = 1; i < argc; i++) {
34
     printf("******************** \"%s\" ********************\n", argv[i]);
41
     printf("******************** \"%s\" ********************\n", argv[i]);
35
--- examples/tagwriter.cpp.orig	2015-11-11 21:41:59 UTC
42
diff --git examples/tagwriter.cpp examples/tagwriter.cpp
43
index ed8b0d7..6a7a263 100644
44
--- examples/tagwriter.cpp
36
+++ examples/tagwriter.cpp
45
+++ examples/tagwriter.cpp
37
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
46
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
38
     if(isArgument(argv[i]) && i + 1 < argc && !isArgument(argv[i + 1])) {
47
     if(isArgument(argv[i]) && i + 1 < argc && !isArgument(argv[i + 1])) {
Lines 43-51 Link Here
43
 
52
 
44
       TagLib::List<TagLib::FileRef>::ConstIterator it;
53
       TagLib::List<TagLib::FileRef>::ConstIterator it;
45
       for(it = fileList.begin(); it != fileList.end(); ++it) {
54
       for(it = fileList.begin(); it != fileList.end(); ++it) {
46
--- taglib/CMakeLists.txt.orig	2015-11-11 21:41:59 UTC
55
diff --git taglib/CMakeLists.txt taglib/CMakeLists.txt
56
index 000f793..e30471e 100644
57
--- taglib/CMakeLists.txt
47
+++ taglib/CMakeLists.txt
58
+++ taglib/CMakeLists.txt
48
@@ -38,6 +38,7 @@ set(tag_HDRS
59
@@ -42,6 +42,7 @@ set(tag_HDRS
49
   audioproperties.h
60
   audioproperties.h
50
   taglib_export.h
61
   taglib_export.h
51
   ${CMAKE_CURRENT_BINARY_DIR}/../taglib_config.h
62
   ${CMAKE_CURRENT_BINARY_DIR}/../taglib_config.h
Lines 53-59 Link Here
53
   toolkit/taglib.h
64
   toolkit/taglib.h
54
   toolkit/tstring.h
65
   toolkit/tstring.h
55
   toolkit/tlist.h
66
   toolkit/tlist.h
56
@@ -291,6 +292,7 @@ set(xm_SRCS
67
@@ -297,6 +298,7 @@ set(xm_SRCS
57
 )
68
 )
58
 
69
 
59
 set(toolkit_SRCS
70
 set(toolkit_SRCS
Lines 61-67 Link Here
61
   toolkit/tstring.cpp
72
   toolkit/tstring.cpp
62
   toolkit/tstringlist.cpp
73
   toolkit/tstringlist.cpp
63
   toolkit/tbytevector.cpp
74
   toolkit/tbytevector.cpp
64
@@ -337,7 +339,7 @@ set(tag_LIB_SRCS
75
@@ -345,7 +347,7 @@ set(tag_LIB_SRCS
65
 add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
76
 add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
66
 
77
 
67
 if(ZLIB_FOUND)
78
 if(ZLIB_FOUND)
Lines 69-78 Link Here
69
+  target_link_libraries(tag rcc ${ZLIB_LIBRARIES})
80
+  target_link_libraries(tag rcc ${ZLIB_LIBRARIES})
70
 endif()
81
 endif()
71
 
82
 
72
 set_target_properties(tag PROPERTIES
83
 if(HAVE_BOOST_ATOMIC)
73
--- taglib/mpeg/id3v1/id3v1tag.cpp.orig	2015-11-11 21:41:59 UTC
84
diff --git taglib/mpeg/id3v1/id3v1tag.cpp taglib/mpeg/id3v1/id3v1tag.cpp
85
index ca93041..dca5f7a 100644
86
--- taglib/mpeg/id3v1/id3v1tag.cpp
74
+++ taglib/mpeg/id3v1/id3v1tag.cpp
87
+++ taglib/mpeg/id3v1/id3v1tag.cpp
75
@@ -64,17 +64,18 @@ StringHandler::StringHandler()
88
@@ -69,15 +69,15 @@ StringHandler::StringHandler()
76
 
89
 
77
 String ID3v1::StringHandler::parse(const ByteVector &data) const
90
 String ID3v1::StringHandler::parse(const ByteVector &data) const
78
 {
91
 {
Lines 82-110 Link Here
82
 
95
 
83
 ByteVector ID3v1::StringHandler::render(const String &s) const
96
 ByteVector ID3v1::StringHandler::render(const String &s) const
84
 {
97
 {
85
   if(!s.isLatin1())
98
-  if(s.isLatin1())
86
   {
99
-    return s.data(String::Latin1);
87
+   if (String::ID3WType(String::Latin1) == String::Latin1)
100
-  else
101
+  if(!s.isLatin1() && String::ID3WType(String::Latin1) == String::Latin1)
88
     return ByteVector();
102
     return ByteVector();
89
   }
103
+    
90
 
91
-  return s.data(String::Latin1);
92
+  return s.data(String::Latin1ID3);
104
+  return s.data(String::Latin1ID3);
93
 }
105
 }
94
 
106
 
95
 ////////////////////////////////////////////////////////////////////////////////
107
 ////////////////////////////////////////////////////////////////////////////////
96
@@ -257,7 +258,7 @@ void ID3v1::Tag::parse(const ByteVector 
108
@@ -262,7 +262,7 @@ void ID3v1::Tag::parse(const ByteVector &data)
97
     d->track = uchar(data[offset + 29]);
109
     d->track   = static_cast<unsigned char>(data[offset + 29]);
98
   }
110
   }
99
   else
111
   else
100
-    d->comment = data.mid(offset, 30);
112
-    d->comment = data.mid(offset, 30);
101
+    d->comment = TagPrivate::stringHandler->parse(data.mid(offset, 30));
113
+    d->comment = stringHandler->parse(data.mid(offset, 30));
102
 
114
 
103
   offset += 30;
115
   offset += 30;
104
 
116
 
105
--- taglib/mpeg/id3v2/frames/commentsframe.cpp.orig	2015-11-11 21:41:59 UTC
117
diff --git taglib/mpeg/id3v2/frames/commentsframe.cpp taglib/mpeg/id3v2/frames/commentsframe.cpp
118
index b561832..9cfaba2 100644
119
--- taglib/mpeg/id3v2/frames/commentsframe.cpp
106
+++ taglib/mpeg/id3v2/frames/commentsframe.cpp
120
+++ taglib/mpeg/id3v2/frames/commentsframe.cpp
107
@@ -150,10 +150,10 @@ void CommentsFrame::parseFields(const By
121
@@ -148,10 +148,10 @@ void CommentsFrame::parseFields(const ByteVector &data)
108
     return;
122
     return;
109
   }
123
   }
110
 
124
 
Lines 117-128 Link Here
117
 
131
 
118
   ByteVectorList l = ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign, 2);
132
   ByteVectorList l = ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign, 2);
119
 
133
 
120
@@ -174,10 +174,12 @@ ByteVector CommentsFrame::renderFields()
134
@@ -171,11 +171,13 @@ ByteVector CommentsFrame::renderFields() const
135
   ByteVector v;
121
 
136
 
122
   String::Type encoding = d->textEncoding;
137
   String::Type encoding = d->textEncoding;
138
+  
139
+  encoding = String::ID3WType(encoding);
123
 
140
 
124
+  encoding = String::ID3WType(encoding);
125
+
126
   encoding = checkTextEncoding(d->description, encoding);
141
   encoding = checkTextEncoding(d->description, encoding);
127
   encoding = checkTextEncoding(d->text, encoding);
142
   encoding = checkTextEncoding(d->text, encoding);
128
 
143
 
Lines 131-139 Link Here
131
   v.append(d->language.size() == 3 ? d->language : "XXX");
146
   v.append(d->language.size() == 3 ? d->language : "XXX");
132
   v.append(d->description.data(encoding));
147
   v.append(d->description.data(encoding));
133
   v.append(textDelimiter(encoding));
148
   v.append(textDelimiter(encoding));
134
--- taglib/mpeg/id3v2/frames/textidentificationframe.cpp.orig	2015-11-11 21:41:59 UTC
149
diff --git taglib/mpeg/id3v2/frames/textidentificationframe.cpp taglib/mpeg/id3v2/frames/textidentificationframe.cpp
150
index d9d3b29..74f69da 100644
151
--- taglib/mpeg/id3v2/frames/textidentificationframe.cpp
135
+++ taglib/mpeg/id3v2/frames/textidentificationframe.cpp
152
+++ taglib/mpeg/id3v2/frames/textidentificationframe.cpp
136
@@ -187,12 +187,12 @@ void TextIdentificationFrame::parseField
153
@@ -191,12 +191,12 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
137
 
154
 
138
   // read the string data type (the first byte of the field data)
155
   // read the string data type (the first byte of the field data)
139
 
156
 
Lines 148-160 Link Here
148
 
165
 
149
   // build a small counter to strip nulls off the end of the field
166
   // build a small counter to strip nulls off the end of the field
150
 
167
 
151
@@ -223,11 +223,14 @@ void TextIdentificationFrame::parseField
168
@@ -227,11 +227,14 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
152
 
169
 
153
 ByteVector TextIdentificationFrame::renderFields() const
170
 ByteVector TextIdentificationFrame::renderFields() const
154
 {
171
 {
155
-  String::Type encoding = checkTextEncoding(d->fieldList, d->textEncoding);
172
-  String::Type encoding = checkTextEncoding(d->fieldList, d->textEncoding);
156
+  String::Type encoding = d->textEncoding;
173
+  String::Type encoding = d->textEncoding;
157
+
174
+  
158
+  encoding = String::ID3WType(encoding);
175
+  encoding = String::ID3WType(encoding);
159
+  encoding = checkTextEncoding(d->fieldList, encoding);
176
+  encoding = checkTextEncoding(d->fieldList, encoding);
160
 
177
 
Lines 165-173 Link Here
165
 
182
 
166
   for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {
183
   for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {
167
 
184
 
168
--- taglib/mpeg/id3v2/id3v2frame.cpp.orig	2015-11-11 21:41:59 UTC
185
diff --git taglib/mpeg/id3v2/id3v2frame.cpp taglib/mpeg/id3v2/id3v2frame.cpp
186
index 1f896fa..ef9d91d 100644
187
--- taglib/mpeg/id3v2/id3v2frame.cpp
169
+++ taglib/mpeg/id3v2/id3v2frame.cpp
188
+++ taglib/mpeg/id3v2/id3v2frame.cpp
170
@@ -339,7 +339,7 @@ String::Type Frame::checkEncoding(const 
189
@@ -297,7 +297,7 @@ String::Type Frame::checkEncoding(const StringList &fields, String::Type encodin
171
   if((encoding == String::UTF8 || encoding == String::UTF16BE) && version != 4)
190
   if((encoding == String::UTF8 || encoding == String::UTF16BE) && version != 4)
172
     return String::UTF16;
191
     return String::UTF16;
173
 
192
 
Lines 176-182 Link Here
176
     return encoding;
195
     return encoding;
177
 
196
 
178
   for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
197
   for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
179
--- taglib/toolkit/rccpatch.cpp.orig	2016-07-26 16:05:28 UTC
198
diff --git taglib/toolkit/rccpatch.cpp taglib/toolkit/rccpatch.cpp
199
new file mode 100644
200
index 0000000..af99323
201
--- /dev/null
180
+++ taglib/toolkit/rccpatch.cpp
202
+++ taglib/toolkit/rccpatch.cpp
181
@@ -0,0 +1,237 @@
203
@@ -0,0 +1,237 @@
182
+#include <stdlib.h>
204
+#include <stdlib.h>
Lines 416-422 Link Here
416
+#endif /* HAVE_LIBRCC */
438
+#endif /* HAVE_LIBRCC */
417
+    return TagLib::String::Latin1;
439
+    return TagLib::String::Latin1;
418
+}
440
+}
419
--- taglib/toolkit/rccpatch.h.orig	2016-07-26 16:05:28 UTC
441
diff --git taglib/toolkit/rccpatch.h taglib/toolkit/rccpatch.h
442
new file mode 100644
443
index 0000000..31f4410
444
--- /dev/null
420
+++ taglib/toolkit/rccpatch.h
445
+++ taglib/toolkit/rccpatch.h
421
@@ -0,0 +1,20 @@
446
@@ -0,0 +1,20 @@
422
+#ifndef _RCC_PATCH_H
447
+#ifndef _RCC_PATCH_H
Lines 439-515 Link Here
439
+TagLib::String::Type rccTaglibPatchGetID3Type();
464
+TagLib::String::Type rccTaglibPatchGetID3Type();
440
+
465
+
441
+#endif /* _RCC_PATCH_H */
466
+#endif /* _RCC_PATCH_H */
442
--- taglib/toolkit/tstring.cpp.orig	2015-11-11 21:41:59 UTC
467
diff --git taglib/toolkit/tstring.cpp taglib/toolkit/tstring.cpp
468
index 8328790..278256f 100644
469
--- taglib/toolkit/tstring.cpp
443
+++ taglib/toolkit/tstring.cpp
470
+++ taglib/toolkit/tstring.cpp
444
@@ -29,6 +29,7 @@
471
@@ -42,6 +42,7 @@
445
 #include <config.h>
472
 #include <trefcounter.h>
446
 #endif
473
 #include <tutils.h>
447
 
474
 
448
+#include "rccpatch.h"
475
+#include "rccpatch.h"
449
 #include "tstring.h"
476
 #include "tstring.h"
450
 #include "tdebug.h"
477
 
451
 #include "tstringlist.h"
478
 namespace
452
@@ -167,8 +168,11 @@ String::String(const String &s)
479
@@ -120,15 +121,37 @@ namespace
453
 String::String(const std::string &s, Type t)
480
     else
454
   : d(new StringPrivate())
481
       return String::UTF16BE;
482
   }
483
+  
484
+  void copyFromUTF8(std::wstring &data, const char *s, size_t length);
485
 
486
   // Converts a Latin-1 string into UTF-16(without BOM/CPU byte order)
487
   // and copies it to the internal buffer.
488
-  void copyFromLatin1(std::wstring &data, const char *s, size_t length)
489
+  void copyFromLatin1(std::wstring &data, const char *s, size_t length, bool prepare = false, String::Type t = String::Latin1)
490
   {
491
     data.resize(length);
492
 
493
     for(size_t i = 0; i < length; ++i)
494
       data[i] = static_cast<unsigned char>(s[i]);
495
+      
496
+         
497
+    // librcc conversation
498
+    if (prepare) {
499
+     
500
+     ByteVector v;
501
+     std::string str = std::string(s, length);
502
+    
503
+     if (t == String::Latin1ID3) v = rccTaglibPatchRecodeInputID3(str, false);
504
+     else if (t == String::Latin1ID3V2) v = rccTaglibPatchRecodeInputID3(str, true);
505
+     else /* Latin1 converted from Locale */ v = rccTaglibPatchRecodeInput(str);
506
+
507
+     if (v.size()) {
508
+       copyFromUTF8(data, v.data(), v.size());
509
+     } else {
510
+     // We don't know if we got UTF-8 encoded string or either rcc is disable or something is failed,
511
+     // since standard applications are really expecting here Latin1, it is safe to just check if we have violations of UTF8
512
+     //if (Unicode::isLegalUTF8(s)) t = UTF8;
513
+     }
514
+    }      
515
   }
516
 
517
   // Converts a UTF-8 string into UTF-16(without BOM/CPU byte order)
518
@@ -264,8 +287,11 @@ String::String(const String &s) :
519
 String::String(const std::string &s, Type t) :
520
   d(new StringPrivate())
455
 {
521
 {
456
-  if(t == Latin1)
522
-  if(t == Latin1)
457
-    copyFromLatin1(s.c_str(), s.length());
523
-    copyFromLatin1(d->data, s.c_str(), s.length());
458
+  if(t == Locale)
524
+  if(t == Locale)
459
+    t = rccTaglibPatchGetLocaleType();
525
+   t = rccTaglibPatchGetLocaleType();
460
+
526
+
461
+  if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
527
+  if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
462
+    copyFromLatin1(s.c_str(), s.length(), true, t);
528
+    copyFromLatin1(d->data, s.c_str(), s.length(), true, t);
463
   else if(t == String::UTF8)
529
   else if(t == String::UTF8)
464
     copyFromUTF8(s.c_str(), s.length());
530
     copyFromUTF8(d->data, s.c_str(), s.length());
465
   else {
531
   else {
466
@@ -215,8 +219,11 @@ String::String(const wchar_t *s, Type t)
532
@@ -312,8 +338,11 @@ String::String(const wchar_t *s, Type t) :
467
 String::String(const char *s, Type t)
533
 String::String(const char *s, Type t) :
468
   : d(new StringPrivate())
534
   d(new StringPrivate())
469
 {
535
 {
470
-  if(t == Latin1)
536
-  if(t == Latin1)
471
-    copyFromLatin1(s, ::strlen(s));
537
-    copyFromLatin1(d->data, s, ::strlen(s));
472
+  if(t == Locale)
538
+  if(t == Locale)
473
+    t = rccTaglibPatchGetLocaleType();
539
+    t = rccTaglibPatchGetLocaleType();
474
+
540
+
475
+  if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
541
+  if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
476
+    copyFromLatin1(s, ::strlen(s), true, t);
542
+    copyFromLatin1(d->data, s, ::strlen(s), true, t);
477
   else if(t == String::UTF8)
543
   else if(t == String::UTF8)
478
     copyFromUTF8(s, ::strlen(s));
544
     copyFromUTF8(d->data, s, ::strlen(s));
479
   else {
545
   else {
480
@@ -237,7 +244,10 @@ String::String(wchar_t c, Type t)
546
@@ -344,9 +373,13 @@ String::String(const ByteVector &v, Type t) :
481
 String::String(char c, Type t)
482
   : d(new StringPrivate(1, static_cast<uchar>(c)))
483
 {
547
 {
484
-  if(t != Latin1 && t != UTF8) {
548
   if(v.isEmpty())
549
     return;
550
+    
485
+  if(t == Locale)
551
+  if(t == Locale)
486
+    t = rccTaglibPatchGetLocaleType();
552
+   t = rccTaglibPatchGetLocaleType();
487
+
553
+
488
+  if(t != Latin1 && t != Latin1ID3 && t != Latin1ID3V2 && t != UTF8) {
554
+   if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
489
     debug("String::String() -- char should not contain UTF16.");
555
+     copyFromLatin1(d->data, v.data(), v.size(), true, t);
490
   }
491
 }
492
@@ -248,8 +258,11 @@ String::String(const ByteVector &v, Type
493
   if(v.isEmpty())
494
     return;
495
 
556
 
496
-  if(t == Latin1)
557
-  if(t == Latin1)
497
-    copyFromLatin1(v.data(), v.size());
558
-    copyFromLatin1(d->data, v.data(), v.size());
498
+  if(t == Locale)
499
+    t = rccTaglibPatchGetLocaleType();
500
+
501
+  if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
502
+    copyFromLatin1(v.data(), v.size(), true, t);
503
   else if(t == UTF8)
559
   else if(t == UTF8)
504
     copyFromUTF8(v.data(), v.size());
560
     copyFromUTF8(d->data, v.data(), v.size());
505
   else
561
   else
506
@@ -396,8 +409,37 @@ bool String::isNull() const
562
@@ -499,8 +532,38 @@ bool String::isNull() const
507
 
563
 
508
 ByteVector String::data(Type t) const
564
 ByteVector String::data(Type t) const
509
 {
565
 {
510
-  switch(t)
566
-  switch(t)
511
-  {
567
-  {
512
+  ByteVector v;
568
+   ByteVector v;
569
+
513
+  if (t == Locale) {
570
+  if (t == Locale) {
514
+        // The source is either Unicode or real Latin1 (if rcc is bypassed)
571
+        // The source is either Unicode or real Latin1 (if rcc is bypassed)
515
+    std::string s = to8Bit(true);
572
+    std::string s = to8Bit(true);
Lines 543-582 Link Here
543
   case Latin1:
600
   case Latin1:
544
     {
601
     {
545
       ByteVector v(size(), 0);
602
       ByteVector v(size(), 0);
546
@@ -738,12 +780,29 @@ void String::detach()
603
@@ -822,7 +885,35 @@ const TagLib::String operator+(const TagLib::String &s1, const char *s2)
547
 // private members
548
 ////////////////////////////////////////////////////////////////////////////////
549
 
604
 
550
-void String::copyFromLatin1(const char *s, size_t length)
551
+void String::copyFromLatin1(const char *s, size_t length, bool prepare, Type t)
552
 {
553
   d->data.resize(length);
554
-
555
   for(size_t i = 0; i < length; ++i)
556
     d->data[i] = static_cast<uchar>(s[i]);
557
+
558
+  // librcc conversation
559
+  if (prepare) {
560
+    std::string s = to8Bit(false);
561
+    ByteVector v;
562
+
563
+    if (t == Latin1ID3) v = rccTaglibPatchRecodeInputID3(s, false);
564
+    else if (t == Latin1ID3V2) v = rccTaglibPatchRecodeInputID3(s, true);
565
+    else /* Latin1 converted from Locale */ v = rccTaglibPatchRecodeInput(s);
566
+
567
+    if (v.size()) {
568
+      copyFromUTF8(v.data(), v.size());
569
+    } else {
570
+    // We don't know if we got UTF-8 encoded string or either rcc is disable or something is failed,
571
+    // since standard applications are really expecting here Latin1, it is safe to just check if we have violations of UTF8
572
+    //if (Unicode::isLegalUTF8(s)) t = UTF8;
573
+    }
574
+  }
575
 }
576
 
577
 void String::copyFromUTF8(const char *s, size_t length)
578
@@ -859,7 +918,33 @@ const TagLib::String operator+(const Tag
579
 
580
 std::ostream &operator<<(std::ostream &s, const TagLib::String &str)
605
 std::ostream &operator<<(std::ostream &s, const TagLib::String &str)
581
 {
606
 {
582
-  s << str.to8Bit();
607
-  s << str.to8Bit();
Lines 610-653 Link Here
610
+    return Latin1;
635
+    return Latin1;
611
+  return type;
636
+  return type;
612
+}
637
+}
613
--- taglib/toolkit/tstring.h.orig	2015-11-11 21:41:59 UTC
638
+
639
+
640
diff --git taglib/toolkit/tstring.h taglib/toolkit/tstring.h
641
index b1be04b..b21f297 100644
642
--- taglib/toolkit/tstring.h
614
+++ taglib/toolkit/tstring.h
643
+++ taglib/toolkit/tstring.h
615
@@ -96,6 +96,18 @@ namespace TagLib {
644
@@ -96,6 +96,18 @@ namespace TagLib {
616
      */
645
      */
617
     enum Type {
646
     enum Type {
618
       /*!
647
       /*!
619
+       * Determine using current locale settings
648
+        * Determine using current locale settings
620
+       */
649
+        */
621
+      Locale = -1,
650
+      Locale = -1,
622
+      /*!
651
+       /*!
623
+       * Latin1 for ID3 tags.
652
+        * Latin1 for ID3 tags.
624
+       */
653
+        */
625
+      Latin1ID3 = 65,
654
+      Latin1ID3 = 65,
626
+      /*!
655
+       /*!
627
+       * Latin1 for ID3v2 tags.
656
+        * Latin1 for ID3v2 tags.
628
+       */
657
+        */
629
+      Latin1ID3V2 = 66,
658
+      Latin1ID3V2 = 66,
630
+      /*!
659
+      /*!
631
        * IS08859-1, or <i>Latin1</i> encoding.  8 bit characters.
660
        * IS08859-1, or <i>Latin1</i> encoding.  8 bit characters.
632
        */
661
        */
633
       Latin1 = 0,
662
       Latin1 = 0,
634
@@ -118,6 +130,10 @@ namespace TagLib {
663
@@ -117,6 +129,10 @@ namespace TagLib {
664
        */
635
       UTF16LE = 4
665
       UTF16LE = 4
636
     };
666
     };
637
 
667
+    
638
+    static Type ID3Type(int i);
668
+    static Type ID3Type(int i);
639
+    static Type ID3WType(Type type);
669
+    static Type ID3WType(Type type);
640
+    static Type ID3RealType(Type type);
670
+    static Type ID3RealType(Type type);
641
+
671
 
642
     /*!
672
     /*!
643
      * Constructs an empty String.
673
      * Constructs an empty String.
644
      */
645
@@ -519,7 +535,7 @@ namespace TagLib {
646
      * Converts a \e Latin-1 string into \e UTF-16(without BOM/CPU byte order)
647
      * and copies it to the internal buffer.
648
      */
649
-    void copyFromLatin1(const char *s, size_t length);
650
+    void copyFromLatin1(const char *s, size_t length, bool prepare = false, Type t = Latin1);
651
 
652
     /*!
653
      * Converts a \e UTF-8 string into \e UTF-16(without BOM/CPU byte order)
(-)audio/taglib/pkg-plist (-1 / +2 lines)
Lines 56-61 Link Here
56
include/taglib/opusfile.h
56
include/taglib/opusfile.h
57
include/taglib/opusproperties.h
57
include/taglib/opusproperties.h
58
include/taglib/ownershipframe.h
58
include/taglib/ownershipframe.h
59
include/taglib/podcastframe.h
59
include/taglib/popularimeterframe.h
60
include/taglib/popularimeterframe.h
60
include/taglib/privateframe.h
61
include/taglib/privateframe.h
61
%%RCC%%include/taglib/rccpatch.h
62
%%RCC%%include/taglib/rccpatch.h
Lines 106-112 Link Here
106
include/taglib/xmproperties.h
107
include/taglib/xmproperties.h
107
lib/libtag.so
108
lib/libtag.so
108
lib/libtag.so.1
109
lib/libtag.so.1
109
lib/libtag.so.1.15.1
110
lib/libtag.so.1.17.0
110
lib/libtag_c.so
111
lib/libtag_c.so
111
lib/libtag_c.so.0
112
lib/libtag_c.so.0
112
lib/libtag_c.so.0.0.0
113
lib/libtag_c.so.0.0.0

Return to bug 221157