Re: [evolution-patches] [Contacts] Fix for 317411



Hi,

Modified the patch little bit.

Let me know your comments.

Thanks,

V. Varadhan

On Wed, 2005-12-07 at 17:18 +0000, "Veerapuram Varadhan"  wrote:
> Hi,
> 
> Attached patch fixes 317411 and other related crashes due to similar
> "combination" of characters in the FullName field.
> 
> Let me know your comments.
> 
> Thanks,
> 
> V. Varadhan
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.329
diff -u -p -r1.329 ChangeLog
--- addressbook/ChangeLog	30 Nov 2005 13:18:01 -0000	1.329
+++ addressbook/ChangeLog	15 Dec 2005 14:24:52 -0000
@@ -1,3 +1,10 @@
+2005-12-07  Veerapuram Varadhan <vvaradhan novell com>
+
+	* libebook/e-name-western.c: (e_name_western_reorder_asshole):
+	Check for invalid combination of prefix and comma separation
+	before reordering the name.
+	** Fixes #317411
+	
 2005-11-30  Harish Krishnaswamy  <kharish novell com>
 
 	* backends/ldap/e-book-backend-ldap.c: (poll_ldap):
Index: addressbook/libebook/e-name-western.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-name-western.c,v
retrieving revision 1.3
diff -u -p -r1.3 e-name-western.c
--- addressbook/libebook/e-name-western.c	4 May 2005 08:46:12 -0000	1.3
+++ addressbook/libebook/e-name-western.c	15 Dec 2005 14:24:52 -0000
@@ -647,7 +647,24 @@ e_name_western_reorder_asshole (ENameWes
 
 	while (g_unichar_isspace (g_utf8_get_char (p)) && *p != '\0')
 		p = g_utf8_next_char (p);
-
+	
+	/* 
+	   Consider this case, "Br. Gate,Br. Gate,W". I know this is a damn
+	   random name, but, I got this from the bug report of 317411.
+	   
+	   comma1 = ",Br.Gate,W"
+	   comma2 = ",W"
+	   prefix1 = ".Gate,Br.Gate,W"
+	   prefix2 = ". Gate,W"
+	   
+	   Actually, we don't have to put lot of intelligence in reordering such
+	   screwedup names, just return.
+	*/
+	if (comma - p + 1 < 1) {
+		g_free (prefix);
+		return;
+	}
+	
 	last = g_malloc0 (comma - p + 1);
 	strncpy (last, p, comma - p);
 
@@ -929,7 +946,7 @@ e_name_western_parse (const char *full_n
 	idxs->nick_idx   = -1;
 	idxs->last_idx   = -1;
 	idxs->suffix_idx = -1;
-	
+
 	/*
 	 * An extremely simple algorithm.
 	 *


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