Wed Mar 20 05:25:58 2013 UTC ()
Fixes build on some situations:
* use C++ style header files
* fixes bogus NULL usage, as Integer 0.


(obache)
diff -r1.1.1.1 -r1.2 pkgsrc/inputmethod/novel-pinyin/distinfo
diff -r1.1.1.1 -r1.2 pkgsrc/inputmethod/novel-pinyin/patches/patch-ac
diff -r0 -r1.1 pkgsrc/inputmethod/novel-pinyin/patches/patch-modules_scim_novel__pinyin__imengine.cpp
diff -r0 -r1.1 pkgsrc/inputmethod/novel-pinyin/patches/patch-src_lookup_lookup.h
diff -r0 -r1.1 pkgsrc/inputmethod/novel-pinyin/patches/patch-src_lookup_pinyin__lookup.cpp

cvs diff -r1.1.1.1 -r1.2 pkgsrc/inputmethod/novel-pinyin/distinfo (expand / switch to unified diff)

--- pkgsrc/inputmethod/novel-pinyin/distinfo 2009/11/24 12:13:02 1.1.1.1
+++ pkgsrc/inputmethod/novel-pinyin/distinfo 2013/03/20 05:25:58 1.2
@@ -1,9 +1,12 @@ @@ -1,9 +1,12 @@
1$NetBSD: distinfo,v 1.1.1.1 2009/11/24 12:13:02 obache Exp $ 1$NetBSD: distinfo,v 1.2 2013/03/20 05:25:58 obache Exp $
2 2
3SHA1 (novel-pinyin-0.2.5.tar.gz) = d973b122aed8b844806948e5081f342945df75ff 3SHA1 (novel-pinyin-0.2.5.tar.gz) = d973b122aed8b844806948e5081f342945df75ff
4RMD160 (novel-pinyin-0.2.5.tar.gz) = 61107040664ddf76a26191401a750ae60397fa4e 4RMD160 (novel-pinyin-0.2.5.tar.gz) = 61107040664ddf76a26191401a750ae60397fa4e
5Size (novel-pinyin-0.2.5.tar.gz) = 6006453 bytes 5Size (novel-pinyin-0.2.5.tar.gz) = 6006453 bytes
6SHA1 (patch-aa) = bacaf491f7e7a9085fff5eb1ea15a73e0638c00c 6SHA1 (patch-aa) = bacaf491f7e7a9085fff5eb1ea15a73e0638c00c
7SHA1 (patch-ab) = 7e50761959a6b17480d524b22cb265cacca44332 7SHA1 (patch-ab) = 7e50761959a6b17480d524b22cb265cacca44332
8SHA1 (patch-ac) = a88eab51d41129afdfb2efab0ea6eb1c60ce369f 8SHA1 (patch-ac) = c48bb8217c590b545a494bfed95b1130a164bb5f
9SHA1 (patch-ad) = 16648a1a547982eac40676d40ed1c9b978476df5 9SHA1 (patch-ad) = 16648a1a547982eac40676d40ed1c9b978476df5
 10SHA1 (patch-modules_scim_novel__pinyin__imengine.cpp) = 1a4e139d37139d82a62e7ed720ac13540b75cefa
 11SHA1 (patch-src_lookup_lookup.h) = aed5a9b28eb7ac050f3b1c0ea0f2de4b09d596c5
 12SHA1 (patch-src_lookup_pinyin__lookup.cpp) = 708b78d362f3339e511fb8f9ef97fa8cf4aa832f

cvs diff -r1.1.1.1 -r1.2 pkgsrc/inputmethod/novel-pinyin/patches/patch-ac (expand / switch to unified diff)

--- pkgsrc/inputmethod/novel-pinyin/patches/patch-ac 2009/11/24 12:13:02 1.1.1.1
+++ pkgsrc/inputmethod/novel-pinyin/patches/patch-ac 2013/03/20 05:25:58 1.2
@@ -1,21 +1,31 @@ @@ -1,21 +1,31 @@
1$NetBSD: patch-ac,v 1.1.1.1 2009/11/24 12:13:02 obache Exp $ 1$NetBSD: patch-ac,v 1.2 2013/03/20 05:25:58 obache Exp $
2 2
3Use C++ way for getline(3) less platforms. 3* Use C++ way for getline(3) less platforms.
 4* fixes bogus NULL usage as Integer 0.
4 5
5--- tests/lookup/test_simple_lookup.cpp.orig 2008-07-21 12:39:27.000000000 +0000 6--- tests/lookup/test_simple_lookup.cpp.orig 2008-07-21 12:39:27.000000000 +0000
6+++ tests/lookup/test_simple_lookup.cpp 7+++ tests/lookup/test_simple_lookup.cpp
7@@ -1,3 +1,4 @@ 8@@ -1,3 +1,4 @@
8+#include <iostream> 9+#include <iostream>
9 #include <string.h> 10 #include <string.h>
10 #include <stdio.h> 11 #include <stdio.h>
11 #include <sys/time.h> 12 #include <sys/time.h>
12@@ -57,7 +58,8 @@ int main( int argc, char * argv[]){ 13@@ -57,7 +58,8 @@ int main( int argc, char * argv[]){
13  14
14 char* linebuf = (char *)malloc ( 1024 * sizeof (char) ); 15 char* linebuf = (char *)malloc ( 1024 * sizeof (char) );
15 size_t size = 1024; 16 size_t size = 1024;
16- while( getline(&linebuf, &size, stdin) ){ 17- while( getline(&linebuf, &size, stdin) ){
17+ while( !std::cin.eof() ){ 18+ while( !std::cin.eof() ){
18+ std::cin.getline(linebuf, size); 19+ std::cin.getline(linebuf, size);
19 linebuf[strlen(linebuf)-1] = '\0'; 20 linebuf[strlen(linebuf)-1] = '\0';
20 if ( strcmp ( linebuf, "quit" ) == 0) 21 if ( strcmp ( linebuf, "quit" ) == 0)
21 break; 22 break;
 23@@ -91,7 +93,7 @@ int main( int argc, char * argv[]){
 24 print_time(start_time, times);
 25 for ( size_t i = 0; i < results->len; ++i){
 26 phrase_token_t * token = &g_array_index(results, phrase_token_t, i);
 27- if ( NULL == *token)
 28+ if ( 0 == *token)
 29 continue;
 30 printf("pos:%d,token:%d\t", i, *token);
 31 }

File Added: pkgsrc/inputmethod/novel-pinyin/patches/patch-modules_scim_novel__pinyin__imengine.cpp
$NetBSD: patch-modules_scim_novel__pinyin__imengine.cpp,v 1.1 2013/03/20 05:25:58 obache Exp $

* fixes bogus NULL usage, as Integer 0.

--- modules/scim/novel_pinyin_imengine.cpp.orig	2008-10-05 07:55:31.000000000 +0000
+++ modules/scim/novel_pinyin_imengine.cpp
@@ -1690,7 +1690,7 @@ PinyinInstance::calc_lookup_table (){
 	    }
 	}
     }else
-	last_token = NULL;
+	last_token = 0;
 
     PhraseItemWithFreq item;
     
@@ -1782,7 +1782,7 @@ PinyinInstance::calc_lookup_table (){
 	    }
 	}
 	g_array_sort(m_phrase_items_with_freq, lookup_table_sort);
-	phrase_token_t last_token = NULL;
+	phrase_token_t last_token = 0;
 	for ( size_t m = 0; m < m_phrase_items_with_freq->len; ++m){
 	    PhraseItemWithFreq * item = &g_array_index(m_phrase_items_with_freq, PhraseItemWithFreq, m);
 	    if ( last_token != item->m_token )

File Added: pkgsrc/inputmethod/novel-pinyin/patches/patch-src_lookup_lookup.h
$NetBSD: patch-src_lookup_lookup.h,v 1.1 2013/03/20 05:25:58 obache Exp $

* fixes bogus NULL usage, as Integer 0.

--- src/lookup/lookup.h.orig	2008-07-30 12:38:00.000000000 +0000
+++ src/lookup/lookup.h
@@ -42,7 +42,7 @@ struct lookup_value_t{
     gfloat m_poss;
     gint32 m_last_step;
     lookup_value_t(gfloat poss = FLT_MAX){
-	m_handles[0] = NULL; m_handles[1] = NULL;
+	m_handles[0] = 0; m_handles[1] = 0;
 	m_poss = poss;
 	m_last_step = -1;
     }

File Added: pkgsrc/inputmethod/novel-pinyin/patches/patch-src_lookup_pinyin__lookup.cpp
$NetBSD: patch-src_lookup_pinyin__lookup.cpp,v 1.1 2013/03/20 05:25:58 obache Exp $

* use C++ style include files.
* fixes bogus NULL usage, as Integer 0.

--- src/lookup/pinyin_lookup.cpp.orig	2009-03-08 03:43:51.000000000 +0000
+++ src/lookup/pinyin_lookup.cpp
@@ -20,8 +20,8 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#include <math.h>
-#include <assert.h>
+#include <cmath>
+#include <cassert>
 #include <iostream>
 #include "stl_lite.h"
 #include "novel_types.h"
@@ -379,7 +379,7 @@ bool PinyinLookup::final_step(MatchResul
     g_array_set_size(results, m_steps_content->len);
     for ( size_t i = 0 ; i < m_steps_content->len ; ++i){
 	phrase_token_t * token = &g_array_index(results, phrase_token_t, i);
-	*token = NULL;
+	*token = 0;
     }
     //find max element
     size_t last_step_pos = m_steps_content->len - 1;
@@ -430,7 +430,7 @@ bool PinyinLookup::train_result(PinyinKe
     guint32 train_factor = 23;
     for ( size_t i = 0; i < constraints->len; ++i){
 	phrase_token_t * token = &g_array_index(results, phrase_token_t, i);
-	if ( *token == NULL )
+	if ( *token == 0 )
 	    continue;
 	lookup_constraint_t * constraint = &g_array_index(constraints, lookup_constraint_t, i);
 	if (train_next || CONSTRAINT_ONESTEP == constraint->m_type ){
@@ -484,7 +484,7 @@ bool PinyinLookup::convert_to_utf8(Match
     result_string = g_strdup("");
     for ( size_t i = 0; i < results->len; ++i){
 	phrase_token_t * token = &g_array_index(results, phrase_token_t, i);
-	if ( NULL == *token )
+	if ( 0 == *token )
 	    continue;
 	m_phrase_index->get_phrase_item(*token, m_cache_phrase_item);
 	utf16_t buffer[MAX_PHRASE_LENGTH];