Use opencc 1.0.2
This commit is contained in:
parent
86211eced1
commit
ab7acbba15
47
ibus-libzhuyin-1.7.x-HEAD.patch
Normal file
47
ibus-libzhuyin-1.7.x-HEAD.patch
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
Index: ibus-libzhuyin-1.6.99.20140929/src/ZYTradSimpConverter.cc
|
||||||
|
===================================================================
|
||||||
|
--- ibus-libzhuyin-1.6.99.20140929.orig/src/ZYTradSimpConverter.cc
|
||||||
|
+++ ibus-libzhuyin-1.6.99.20140929/src/ZYTradSimpConverter.cc
|
||||||
|
@@ -33,7 +33,6 @@
|
||||||
|
namespace ZY {
|
||||||
|
|
||||||
|
class opencc {
|
||||||
|
- static const int BUFFER_SIZE = 64;
|
||||||
|
public:
|
||||||
|
opencc (void)
|
||||||
|
{
|
||||||
|
@@ -48,30 +47,14 @@ public:
|
||||||
|
|
||||||
|
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_cc, &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_cc;
|
||||||
|
- gunichar m_buffer[BUFFER_SIZE + 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
@ -1,17 +1,22 @@
|
|||||||
|
%global snapshot 1
|
||||||
|
|
||||||
Name: ibus-libzhuyin
|
Name: ibus-libzhuyin
|
||||||
Version: 1.6.99.20140929
|
Version: 1.6.99.20140929
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: New Zhuyin engine based on libzhuyin for IBus
|
Summary: New Zhuyin engine based on libzhuyin for IBus
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: https://github.com/libzhuyin/ibus-libzhuyin
|
URL: https://github.com/libzhuyin/ibus-libzhuyin
|
||||||
Source0: http://downloads.sourceforge.net/libzhuyin/ibus-libzhuyin/%{name}-%{version}.tar.gz
|
Source0: http://downloads.sourceforge.net/libzhuyin/ibus-libzhuyin/%{name}-%{version}.tar.gz
|
||||||
|
%if %snapshot
|
||||||
|
Patch0: ibus-libzhuyin-1.7.x-HEAD.patch
|
||||||
|
%endif
|
||||||
|
|
||||||
BuildRequires: gettext-devel
|
BuildRequires: gettext-devel
|
||||||
BuildRequires: intltool
|
BuildRequires: intltool
|
||||||
BuildRequires: libtool
|
BuildRequires: libtool
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: sqlite-devel
|
BuildRequires: sqlite-devel
|
||||||
BuildRequires: opencc-devel
|
BuildRequires: opencc-devel >= 1.0.2
|
||||||
BuildRequires: ibus-devel >= 1.3
|
BuildRequires: ibus-devel >= 1.3
|
||||||
BuildRequires: libzhuyin-devel >= 0.9.93
|
BuildRequires: libzhuyin-devel >= 0.9.93
|
||||||
BuildRequires: python2-devel
|
BuildRequires: python2-devel
|
||||||
@ -27,6 +32,10 @@ based on libzhuyin for IBus.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%if %snapshot
|
||||||
|
%patch0 -p1 -b .head
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --disable-static \
|
%configure --disable-static \
|
||||||
@ -51,6 +60,9 @@ make install DESTDIR=${RPM_BUILD_ROOT} INSTALL="install -p"
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 7 2015 Peng Wu <pwu@redhat.com> - 1.6.99.20140929-2
|
||||||
|
- Use opencc 1.0.2
|
||||||
|
|
||||||
* Mon Sep 29 2014 Peng Wu <pwu@redhat.com> - 1.6.99.20140929-1
|
* Mon Sep 29 2014 Peng Wu <pwu@redhat.com> - 1.6.99.20140929-1
|
||||||
- Update to 1.6.99.20140929
|
- Update to 1.6.99.20140929
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user