View | Details | Raw Unified | Return to bug 212735 | Differences between
and this patch

Collapse All | Expand All

(-)./distinfo (-4 / +3 lines)
Lines 1-4 Link Here
1
SHA256 (pyzy-0.1.0.tar.gz) = fe468a4372473d85a56f05d55b14f0e0201fde6f9336a1a2322cf79421c84d9a
1
TIMESTAMP = 1480281906
2
SIZE (pyzy-0.1.0.tar.gz) = 1571946
2
SHA256 (pyzy-pyzy-0.1.0-6d9c3cd_GH0.tar.gz) = 20c6306c3e0f507f3279a97f7117856d1733140422ea02b19aa551e113b6b859
3
SHA256 (pyzy-database-1.0.0.tar.bz2) = 32c7d07b9f41e1dfc0f9008f54eca8e6cb367e7f2b19ac94c49754442694c321
3
SIZE (pyzy-pyzy-0.1.0-6d9c3cd_GH0.tar.gz) = 1320154
4
SIZE (pyzy-database-1.0.0.tar.bz2) = 9977983
(-)./files/patch-src_SimpTradConverter.cc (+43 lines)
Line 0 Link Here
1
--- src/SimpTradConverter.cc.orig	2012-12-17 04:00:47 UTC
2
+++ src/SimpTradConverter.cc
3
@@ -40,7 +40,6 @@ namespace PyZy {
4
 #ifdef HAVE_OPENCC
5
 
6
 class opencc {
7
-    static const int BUFFER_SIZE = 64;
8
 public:
9
     opencc (void)
10
     {
11
@@ -55,29 +54,12 @@ public:
12
 
13
     void convert (const char *in, String &out)
14
     {
15
-        long n_char;
16
-        unichar *in_ucs4 = g_utf8_to_ucs4_fast (in, -1, &n_char);
17
-
18
-        ucs4_t *pinbuf = (ucs4_t *)in_ucs4;
19
-        size_t inbuf_left = n_char;
20
-        while (inbuf_left != 0) {
21
-            ucs4_t *poutbuf = (ucs4_t *)m_buffer;
22
-            size_t outbuf_left = BUFFER_SIZE;
23
-            size_t retval = opencc_convert(m_od, &pinbuf, &inbuf_left, &poutbuf, &outbuf_left);
24
-            if (retval == (size_t) -1) {
25
-                /* append left chars in pinbuf */
26
-                g_warning ("opencc_convert return failed");
27
-                out << (unichar *) pinbuf;
28
-                break;
29
-            }
30
-            *poutbuf = L'\0';
31
-            out << m_buffer;
32
-        }
33
-        g_free (in_ucs4);
34
+        char *converted = opencc_convert_utf8(m_od, in, -1);
35
+        out = converted;
36
+        opencc_convert_utf8_free(converted);
37
     }
38
 private:
39
     opencc_t m_od;
40
-    unichar m_buffer[BUFFER_SIZE + 1];
41
 };
42
 
43
 void
(-)./Makefile (-25 / +10 lines)
Lines 1-24 Link Here
1
# Created by: Henry Hu <henry.hu.sh@gmail.com>
1
# Created by: Henry Hu <henry.hu.sh@gmail.com>
2
# $FreeBSD: head/chinese/pyzy/Makefile 424427 2016-10-21 15:21:13Z mat $
2
# $FreeBSD: head/chinese/pyzy/Makefile 422140 2016-09-14 15:59:34Z mat $
3
3
4
PORTNAME=	pyzy
4
PORTNAME=	pyzy
5
PORTVERSION=	0.1.0
5
PORTVERSION=	0.1.0
6
PORTREVISION=	2
6
PORTREVISION=	3
7
CATEGORIES=	chinese
7
CATEGORIES=	chinese
8
MASTER_SITES=	GOOGLE_CODE
9
DISTFILES=	${DISTNAME}${EXTRACT_SUFX}
10
EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
11
8
12
MAINTAINER=	henry.hu.sh@gmail.com
9
MAINTAINER=	henry.hu.sh@gmail.com
13
COMMENT=	The Chinese PinYin and Bopomofo conversion library
10
COMMENT=	Chinese PinYin and Bopomofo conversion library
14
11
15
LICENSE=	LGPL21
12
LICENSE=	LGPL21
16
13
17
BROKEN=		Unfetchable (google code has gone away)
18
19
LIB_DEPENDS=	libsqlite3.so:databases/sqlite3
14
LIB_DEPENDS=	libsqlite3.so:databases/sqlite3
20
15
21
USES=		compiler:c++11-lib gettext-runtime gmake libtool pathfix pkgconfig python:build shebangfix
16
USE_GITHUB=	yes
17
GH_TAGNAME=	6d9c3cd
18
19
USES=		compiler:c++11-lib gmake libtool pkgconfig python:build shebangfix autoreconf gettext-runtime pathfix
22
SHEBANG_FILES=	data/db/android/create_db.py
20
SHEBANG_FILES=	data/db/android/create_db.py
23
USE_GNOME=	glib20
21
USE_GNOME=	glib20
24
USE_LDCONFIG=	yes
22
USE_LDCONFIG=	yes
Lines 26-52 Link Here
26
GNU_CONFIGURE=	yes
24
GNU_CONFIGURE=	yes
27
CONFIGURE_ARGS=	--disable-dependency-tracking --disable-boost
25
CONFIGURE_ARGS=	--disable-dependency-tracking --disable-boost
28
26
29
OPTIONS_DEFINE=	ANDROID_DB OPENPHRASE_DB OPENCC
27
OPTIONS_DEFINE=	OPENCC
30
OPTIONS_DEFAULT=	ANDROID_DB
28
OPTIONS_DEFAULT=
31
OPTIONS_SUB=	yes
29
OPTIONS_SUB=	yes
32
ANDROID_DB_DESC=	Build Android DB
30
OPENCC_DESC=	Use opencc for simplified and traditional Chinese conversion
33
OPENPHRASE_DB_DESC=	Build Open Phrase DB
34
OPENCC_DESC=		Use opencc for simplified and traditional Chinese conversion
35
36
ANDROID_DB_CONFIGURE_ENABLE=	db-android
37
38
OPENPHRASE_DBVER=	1.0.0
39
OPENPHRASE_DBFILE=	pyzy-database-${OPENPHRASE_DBVER}.tar.bz2
40
41
OPENPHRASE_DB_CONFIGURE_ENABLE=	db-open-phrase
42
OPENPHRASE_DB_DISTFILES=	${OPENPHRASE_DBFILE}
43
31
44
OPENCC_CONFIGURE_ENABLE=	opencc
32
OPENCC_CONFIGURE_ENABLE=	opencc
45
OPENCC_LIB_DEPENDS=		libopencc.so:chinese/opencc
33
OPENCC_LIB_DEPENDS=		libopencc.so:chinese/opencc
46
34
47
post-extract-OPENPHRASE_DB-on:
48
	@${CP} ${DISTDIR}/${OPENPHRASE_DBFILE} ${WRKSRC}/data/db/open-phrase
49
50
post-install:
35
post-install:
51
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/lib${PORTNAME}-1.0.so
36
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/lib${PORTNAME}-1.0.so
52
37
(-)./pkg-descr (-1 / +1 lines)
Lines 3-6 Link Here
3
This is the Chinese PinYin / Bopomofo conversion library.
3
This is the Chinese PinYin / Bopomofo conversion library.
4
You can easily write an application which handles the Chinese with it.
4
You can easily write an application which handles the Chinese with it.
5
5
6
WWW: http://code.google.com/p/pyzy
6
WWW: http://github.com/pyzy/pyzy
(-)./pkg-plist (-2 / +1 lines)
Lines 5-11 Link Here
5
lib/libpyzy-1.0.so.0
5
lib/libpyzy-1.0.so.0
6
lib/libpyzy-1.0.so.0.100.0
6
lib/libpyzy-1.0.so.0.100.0
7
libdata/pkgconfig/pyzy-1.0.pc
7
libdata/pkgconfig/pyzy-1.0.pc
8
%%ANDROID_DB%%%%DATADIR%%/db/android.db
8
%%DATADIR%%/db/android.db
9
%%OPENPHRASE_DB%%%%DATADIR%%/db/open-phrase.db
10
%%DATADIR%%/db/create_index.sql
9
%%DATADIR%%/db/create_index.sql
11
%%DATADIR%%/phrases.txt
10
%%DATADIR%%/phrases.txt

Return to bug 212735