[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/cmigemo/F-7 cmigemo-1.3c-MIT-signore-random-string.patch, NONE, 1.1 cmigemo.spec, 1.1, 1.2



Author: mtasaka

Update of /cvs/extras/rpms/cmigemo/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15066/F-7

Modified Files:
	cmigemo.spec 
Added Files:
	cmigemo-1.3c-MIT-signore-random-string.patch 
Log Message:
* Sat May 26 2007 Mamoru Tasaka <mtasaka ioa s u-tokyo ac jp> - 1.3-0.4.c_MIT
- Suppress completent for too random string.


cmigemo-1.3c-MIT-signore-random-string.patch:

--- NEW FILE cmigemo-1.3c-MIT-signore-random-string.patch ---
--- cmigemo-1.3c-MIT/src/migemo.c.orig	2004-06-19 20:21:19.000000000 +0900
+++ cmigemo-1.3c-MIT/src/migemo.c	2007-05-26 23:48:29.000000000 +0900
@@ -342,6 +342,10 @@
  * ƒ[ƒ}Žš•ÏŠ·‚ª•sŠ®‘S‚¾‚Á‚½Žž‚ɁA[aiueo]‚¨‚æ‚Ñ"xn"‚Æ"xtu"‚ð•â‚Á‚Ä•ÏŠ·‚µ‚Ä
  * ‚Ý‚éB
  */
+/*
+   ƒ‰ƒ“ƒ_ƒ€‚È•¶Žš—ñ‚ð“ü‚ê‚é‚Ɛ”‚ª‹}‚É‘‘å‚·‚é‚̂ŁA‚±‚Ì‹ ”\‚Í
+   Žæ‚芸‚¦‚¸—}§
+*/
     static void
 add_dubious_roma(migemo* object, rxgen* rx, unsigned char* query)
 {
@@ -349,6 +353,8 @@
     int len;
     char *buf;
 
+    return;
+
     if (!(len = strlen(query)))
 	return;
     if (!(buf = malloc(len + 1 + 3))) /* NUL‚ÆŠg’£•¶Žš—p(Å’·:xtu) */
@@ -388,9 +394,42 @@
 }
 
 /*
+   —]‚è‚É–³’ƒ‹ê’ƒ‚È•¶Žš—ñ‚͏ˆ—‚µ‚È‚¢
+*/
+
+static int 
+too_random_string(const unsigned char *string)
+{
+
+	unsigned char *query = string;
+	unsigned short int no_vowels = 0;
+	unsigned short int length_bunsetsu = 0;
+	unsigned short int randomness = 0;
+	unsigned short int found_upper = 0;
+	unsigned short int length = 0;
+
+
+	for (; *query; query++, length++){
+		if (isupper (*query)){
+			found_upper = 1;
+			if (length_bunsetsu < 2 && (query != string)) randomness++;
+			length_bunsetsu = 0;
+		}
+		else
+			length_bunsetsu++ ;
+
+	}
+
+	if (randomness >= 2) return 1;
+	if (found_upper && (length <= 3)) return 1;
+	return 0;
+}
+
+/*
  * query‚𕶐߂ɕª‰ð‚·‚éB•¶ß‚̐؂ê–ڂ͒ʏíƒAƒ‹ƒtƒ ƒxƒbƒg‚̑啶ŽšB•¶ß‚ª•¡
  * ”•¶Žš‚̑啶Žš‚ÅŽn‚Ü‚Á‚½•¶ß‚Í”ñ‘啶Žš‚ð‹æØ‚è‚Æ‚·‚éB
  */
+
     static wordlist_p
 parse_query(migemo* object, const unsigned char* query)
 {
@@ -399,6 +438,8 @@
     const unsigned char *end = NULL;
     wordlist_p querylist = NULL, *pp = &querylist;
 
+    int random_query_p = too_random_string (query);
+
     while (1)
     {
 	int len, upper;
@@ -406,13 +447,13 @@
 	if (!object->char2int || (len = object->char2int(curr, NULL)) < 1)
 	    len = 1;
 	start = curr;
-	upper = (len == 1 && isupper(*curr) && isupper(curr[1]));
+	upper = (len == 1 && isupper(*curr) && isupper(curr[1]) && (!random_query_p));
 	curr += len;
 	while (1)
 	{
 	    if (!object->char2int || (len = object->char2int(curr, NULL)) < 1)
 		len = 1;
-	    if (*curr == '\0' || (len == 1 && (isupper(*curr) != 0) != upper))
+	    if (*curr == '\0' || (len == 1 && ((isupper(*curr) != 0) != upper)) && (!random_query_p))
 		break;
 	    curr += len;
 	}


Index: cmigemo.spec
===================================================================
RCS file: /cvs/extras/rpms/cmigemo/F-7/cmigemo.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cmigemo.spec	21 May 2007 18:22:06 -0000	1.1
+++ cmigemo.spec	26 May 2007 15:04:12 -0000	1.2
@@ -2,7 +2,7 @@
 %define		minorver	c-MIT
 %define		prerelease	1
 
-%define		fedorarel	3
+%define		fedorarel	4
 
 
 %define		uprel		%(echo %{?minorver} | %{__sed} -e 's|^--*||' | %{__sed} -e 's|-|_|g' )
@@ -21,6 +21,7 @@
 License:	MIT
 URL:		http://www.kaoriya.net/
 Source0:	http://www.kaoriya.net/dist/var/%{name}-%{mainver}%{?minorver}.tar.bz2
+Patch0:		cmigemo-1.3c-MIT-signore-random-string.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  skkdic
@@ -41,6 +42,7 @@
 
 %prep
 %setup -q -n %{name}-%{version}%{?minorver}
+%patch0 -p1 -b .random
 
 # Change default command for configure
 %{__sed} -i.bak \
@@ -128,6 +130,9 @@
 %{_libdir}/libmigemo.so
 
 %changelog
+* Sat May 26 2007 Mamoru Tasaka <mtasaka ioa s u-tokyo ac jp> - 1.3-0.4.c_MIT
+- Suppress completent for too random string.
+
 * Sun May 20 2007 Mamoru Tasaka <mtasaka ioa s u-tokyo ac jp> - 1.3-0.3.c_MIT
 - Don't create unnecessary document backup
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]