Use opencc 1.0.2
This commit is contained in:
parent
781d506fbb
commit
e3558534eb
57
ibus-libpinyin-use-opencc.patch
Normal file
57
ibus-libpinyin-use-opencc.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
Index: ibus-libpinyin-1.6.92/src/PYSimpTradConverter.cc
|
||||||
|
===================================================================
|
||||||
|
--- ibus-libpinyin-1.6.92.orig/src/PYSimpTradConverter.cc
|
||||||
|
+++ ibus-libpinyin-1.6.92/src/PYSimpTradConverter.cc
|
||||||
|
@@ -40,44 +40,27 @@ namespace PY {
|
||||||
|
#ifdef HAVE_OPENCC
|
||||||
|
|
||||||
|
class opencc {
|
||||||
|
- static const int BUFFER_SIZE = 64;
|
||||||
|
public:
|
||||||
|
opencc (void)
|
||||||
|
{
|
||||||
|
- m_od = opencc_open (OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD);
|
||||||
|
- g_assert (m_od != NULL);
|
||||||
|
+ m_cc = opencc_open (OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD);
|
||||||
|
+ g_assert (m_cc != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
~opencc (void)
|
||||||
|
{
|
||||||
|
- opencc_close(m_od);
|
||||||
|
+ opencc_close(m_cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void convert (const gchar *in, String &out)
|
||||||
|
{
|
||||||
|
- glong n_char;
|
||||||
|
- gunichar *in_ucs4 = g_utf8_to_ucs4_fast (in, -1, &n_char);
|
||||||
|
-
|
||||||
|
- ucs4_t *pinbuf = (ucs4_t *)in_ucs4;
|
||||||
|
- size_t inbuf_left = n_char;
|
||||||
|
- while (inbuf_left != 0) {
|
||||||
|
- ucs4_t *poutbuf = (ucs4_t *)m_buffer;
|
||||||
|
- size_t outbuf_left = BUFFER_SIZE;
|
||||||
|
- size_t retval = opencc_convert(m_od, &pinbuf, &inbuf_left, &poutbuf, &outbuf_left);
|
||||||
|
- if (retval == (size_t) -1) {
|
||||||
|
- /* append left chars in pinbuf */
|
||||||
|
- g_warning ("opencc_convert return failed");
|
||||||
|
- out << (gunichar *) pinbuf;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- *poutbuf = L'\0';
|
||||||
|
- out << m_buffer;
|
||||||
|
- }
|
||||||
|
- g_free (in_ucs4);
|
||||||
|
+ char * converted = opencc_convert_utf8 (m_cc, in, -1);
|
||||||
|
+ g_assert (converted != NULL);
|
||||||
|
+ out = converted;
|
||||||
|
+ opencc_convert_utf8_free (converted);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
- opencc_t m_od;
|
||||||
|
- gunichar m_buffer[BUFFER_SIZE + 1];
|
||||||
|
+ opencc_t m_cc;
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: ibus-libpinyin
|
Name: ibus-libpinyin
|
||||||
Version: 1.6.92
|
Version: 1.6.92
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
Summary: Intelligent Pinyin engine based on libpinyin for IBus
|
Summary: Intelligent Pinyin engine based on libpinyin for IBus
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
@ -11,6 +11,7 @@ Source0: http://downloads.sourceforge.net/libpinyin/ibus-libpinyin/%{name}-%{
|
|||||||
%if %snapshot
|
%if %snapshot
|
||||||
Patch0: ibus-libpinyin-1.7.x-head.patch
|
Patch0: ibus-libpinyin-1.7.x-head.patch
|
||||||
%endif
|
%endif
|
||||||
|
Patch1: ibus-libpinyin-use-opencc.patch
|
||||||
|
|
||||||
Requires: pygobject3
|
Requires: pygobject3
|
||||||
Requires: ibus >= 1.5.4
|
Requires: ibus >= 1.5.4
|
||||||
@ -20,7 +21,7 @@ BuildRequires: libtool
|
|||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: sqlite-devel
|
BuildRequires: sqlite-devel
|
||||||
BuildRequires: libuuid-devel
|
BuildRequires: libuuid-devel
|
||||||
BuildRequires: opencc-devel
|
BuildRequires: opencc-devel >= 1.0.2
|
||||||
BuildRequires: lua-devel
|
BuildRequires: lua-devel
|
||||||
BuildRequires: python2-devel
|
BuildRequires: python2-devel
|
||||||
BuildRequires: desktop-file-utils
|
BuildRequires: desktop-file-utils
|
||||||
@ -44,6 +45,7 @@ input method based on libpinyin for IBus.
|
|||||||
%if %snapshot
|
%if %snapshot
|
||||||
%patch0 -p1 -b .head
|
%patch0 -p1 -b .head
|
||||||
%endif
|
%endif
|
||||||
|
%patch1 -p1 -b .opencc
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --disable-static \
|
%configure --disable-static \
|
||||||
@ -88,6 +90,9 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
|||||||
%{_datadir}/ibus/component/*
|
%{_datadir}/ibus/component/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 7 2015 Peng Wu <pwu@redhat.com> - 1.6.92-5
|
||||||
|
- Use opencc 1.0.2
|
||||||
|
|
||||||
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.92-4
|
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.92-4
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user