[Tomoe-cvs 952] CVS update: tomoe/recognizer

Back to archive index

Hiroyuki Ikezoe ikezo****@users*****
2006年 11月 24日 (金) 10:41:10 JST


Index: tomoe/recognizer/tomoe-recognizer-simple-logic.c
diff -u tomoe/recognizer/tomoe-recognizer-simple-logic.c:1.21 tomoe/recognizer/tomoe-recognizer-simple-logic.c:1.22
--- tomoe/recognizer/tomoe-recognizer-simple-logic.c:1.21	Wed Nov 22 15:19:20 2006
+++ tomoe/recognizer/tomoe-recognizer-simple-logic.c	Fri Nov 24 10:41:09 2006
@@ -17,7 +17,7 @@
  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  *  Boston, MA  02111-1307  USA
  *
- *  $Id: tomoe-recognizer-simple-logic.c,v 1.21 2006/11/22 06:19:20 makeinu Exp $
+ *  $Id: tomoe-recognizer-simple-logic.c,v 1.22 2006/11/24 01:41:09 ikezoe Exp $
  */
 
 #include <stdlib.h>
@@ -75,16 +75,18 @@
 {
     /* TomoeRecognizerSimple *recognizer = context; */
     GList *matched = NULL;
-    guint i, j;
     GArray *matches = NULL;
     GPtrArray *cands = NULL;
     GPtrArray *first_cands = NULL;
     guint letters_num = 0;
     const GPtrArray *letters = NULL;
+    guint input_stroke_num, i, j;
 
-    if (!input) return 0;
-    if (tomoe_writing_get_number_of_strokes (input) == 0) return 0;
-    if (!dict) return 0;
+    g_return_val_if_fail (input, NULL);
+    g_return_val_if_fail (dict, NULL);
+
+    input_stroke_num = tomoe_writing_get_number_of_strokes (input);
+    g_return_val_if_fail (input_stroke_num > 0, NULL);
 
     first_cands = g_ptr_array_new ();
     letters = tomoe_dict_get_letters(dict);
@@ -101,7 +103,7 @@
         if (!writing) continue;
 
         /* check the number of stroke */
-        if (tomoe_writing_get_number_of_strokes (input) > tomoe_writing_get_number_of_strokes (writing))
+        if (input_stroke_num > tomoe_writing_get_number_of_strokes (writing))
             continue;
 
         /* append a candidate to candidate list */
@@ -112,7 +114,7 @@
     /* Ugly hack! */
     cands = first_cands;
     cands = get_candidates (input, 0, first_cands);
-    for (i = 1; i < tomoe_writing_get_number_of_strokes (input); i++) {
+    for (i = 1; i < input_stroke_num; i++) {
         GPtrArray *tmp;
         tmp = get_candidates(input, i, cands);
         g_ptr_array_free (cands, TRUE);
@@ -128,8 +130,7 @@
         cand = g_ptr_array_index (cands, i);
         adapted = cand->adapted_strokes;
         pj = match_stroke_num (dict, cand->index,
-                               tomoe_writing_get_number_of_strokes (input),
-                               adapted);
+                               input_stroke_num, adapted);
 
         if (pj < 0)
             continue;


tomoe-cvs メーリングリストの案内
Back to archive index