From d5a4216ceaf4d5c274da74e6f2ae75bd4e177b4d Mon Sep 17 00:00:00 2001 From: Cheng-Lung Sung Date: Sat, 20 May 2006 16:23:34 +0000 Subject: - since isspace(0xa0) return true. When using sscanf(...,"%s",...), it will treat some UTF8 words containing 0xa0 as spaces. Thus those words will be skipped. - added two patch to avoid that problem. - bump PORTREVISION Submitted by: Rong-En Fan --- chinese/libchewing/Makefile | 1 + chinese/libchewing/files/patch-src-char.c | 11 +++++++++++ chinese/libchewing/files/patch-src-dict.c | 11 +++++++++++ 3 files changed, 23 insertions(+) create mode 100644 chinese/libchewing/files/patch-src-char.c create mode 100644 chinese/libchewing/files/patch-src-dict.c (limited to 'chinese/libchewing') diff --git a/chinese/libchewing/Makefile b/chinese/libchewing/Makefile index 6c0881715cd2..e2bfa54d5b76 100644 --- a/chinese/libchewing/Makefile +++ b/chinese/libchewing/Makefile @@ -7,6 +7,7 @@ PORTNAME= libchewing PORTVERSION= 0.3.0 +PORTREVISION= 1 CATEGORIES= chinese textproc MASTER_SITES= http://chewing.csie.net/download/libchewing/ diff --git a/chinese/libchewing/files/patch-src-char.c b/chinese/libchewing/files/patch-src-char.c new file mode 100644 index 000000000000..353fd37bd874 --- /dev/null +++ b/chinese/libchewing/files/patch-src-char.c @@ -0,0 +1,11 @@ +--- src/char.c.orig Mon May 15 14:49:43 2006 ++++ src/char.c Sun May 21 00:14:41 2006 +@@ -126,7 +126,7 @@ + + fgettab( buf, 1000, dictfile ); + /* only read 6 bytes to wrd_ptr->word avoid buffer overflow */ +- sscanf( buf, "%hu %6s", &sh, wrd_ptr->word ); ++ sscanf( buf, "%hu %6[^ ]", &sh, wrd_ptr->word ); + assert( wrd_ptr->word != NULL ); + } + diff --git a/chinese/libchewing/files/patch-src-dict.c b/chinese/libchewing/files/patch-src-dict.c new file mode 100644 index 000000000000..5b24125c8016 --- /dev/null +++ b/chinese/libchewing/files/patch-src-dict.c @@ -0,0 +1,11 @@ +--- src/dict.c.orig Mon May 15 14:49:43 2006 ++++ src/dict.c Sun May 21 00:14:29 2006 +@@ -101,7 +101,7 @@ + char buf[ 1000 ]; + + fgettab( buf, 1000, dictfile ); +- sscanf( buf, "%s %d", phr_ptr->phrase, &( phr_ptr->freq ) ); ++ sscanf( buf, "%[^ ] %d", phr_ptr->phrase, &( phr_ptr->freq ) ); + } + + int GetPhraseFirst( Phrase *phr_ptr, int phone_phr_id ) -- cgit v1.2.3