add patch for multi-language support

This commit is contained in:
Aurelien Bompard 2006-12-18 22:19:13 +00:00
parent 12b1cd8e02
commit 0ad22dcb61
2 changed files with 37 additions and 1 deletions

31
taglib-1.4_wchar.diff Normal file
View File

@ -0,0 +1,31 @@
diff -ruN taglib-1.4.org/taglib/toolkit/tstring.cpp taglib-1.4/taglib/toolkit/tstring.cpp
--- taglib-1.4.org/taglib/toolkit/tstring.cpp 2005-07-26 06:31:15.000000000 +0900
+++ taglib-1.4/taglib/toolkit/tstring.cpp 2006-05-26 12:02:55.000000000 +0900
@@ -202,12 +202,22 @@
s.resize(d->data.size());
if(!unicode) {
- std::string::iterator targetIt = s.begin();
- for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
- *targetIt = char(*it);
- ++targetIt;
+ bool cjk = false;
+ //pre-scan: is there any cjk unicode character? if so, convert the string into utf-8.
+ for(unsigned int i=0; i< d->data.size(); i++){
+ if(d->data[i] > 0xff){
+ cjk = true;
+ break;
+ }
+ }
+ if(!cjk){
+ std::string::iterator targetIt = s.begin();
+ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
+ *targetIt = char(*it);
+ ++targetIt;
+ }
+ return s;
}
- return s;
}
const int outputBufferSize = d->data.size() * 3 + 1;

View File

@ -1,6 +1,6 @@
Name: taglib
Version: 1.4
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Audio Meta-Data Library
Group: System Environment/Libraries
@ -8,6 +8,7 @@ License: LGPL
URL: http://ktown.kde.org/~wheeler/taglib/
Source: http://developer.kde.org/~wheeler/files/src/taglib-1.4.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch0: http://foetida.jaist.ac.jp:37565/~yaz/diary/2006/07/taglib-1.4_wchar.diff
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@ -31,6 +32,7 @@ Development tools for taglib
%prep
%setup -q
%patch0 -p1 -b .wchar
%build
@ -76,6 +78,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Thu Dec 14 2006 Aurelien Bompard <abompard@fedoraproject.org> 1.4-5
- add patch for multi-language support
* Thu Sep 14 2006 Aurelien Bompard <abompard@fedoraproject.org> 1.4-4
- have the devel package require pkgconfig (#206443)