Re: [evolution-data-server] Fix for bug #331633

Irene Huang <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <[email protected]>
Hi, 

Modified as per Jeff's suggestion :) 

Please review :) 

thanks 

--Irene
On Tue, 2006-02-21 at 11:34 -0500, Jeffrey Stedfast wrote:
> On Mon, 2006-02-20 at 02:40 -0700, Veerapuram Varadhan wrote:
> > On Sat, 2006-02-18 at 04:48 +0000, Irene Huang  wrote:
> > > +       if (strlen(dn_value->str))
> > > +               dn = g_strndup (dn_value->str, strlen(dn_value->str) -
> > > 1);
> > 
> > Wouldn't it be better to store strlen() in a variable, instead of
> > calling strlen twice?
> 
> another idea is simply doing:
> 
> if (dn_value->str[0])
> 
> no need to strlen it.
> 
> > 
> > Thanks,
> > 
> > V. Varadhan
> > _______________________________________________
> > Evolution-patches mailing list
> > [email protected]
> > http://mail.gnome.org/mailman/listinfo/evolution-patches
> >

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
EDS-331633-3-6.diff (text/x-patch, 1.4 KB)
Index: servers/exchange/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.65
diff -u -r1.65 ChangeLog
--- servers/exchange/ChangeLog	6 Mar 2006 06:41:32 -0000	1.65
+++ servers/exchange/ChangeLog	6 Mar 2006 08:26:50 -0000
@@ -1,3 +1,10 @@
+2006-03-06  Irene Huang <[email protected]>
+
+	Fixes bug #331633
+
+	* lib/e2k-global-catalog.c: (find_domain_dn): Check and see if 
+	dn_value->str[0] is nil before duplicating.
+
 2006-03-06  Sushma Rai  <[email protected]>
 
 	* storage/e-folder-exchange.c (e_folder_exchange_new_from_file): 
Index: servers/exchange/lib/e2k-global-catalog.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-global-catalog.c,v
retrieving revision 1.5
diff -u -r1.5 e2k-global-catalog.c
--- servers/exchange/lib/e2k-global-catalog.c	13 Dec 2005 03:54:28 -0000	1.5
+++ servers/exchange/lib/e2k-global-catalog.c	6 Mar 2006 08:26:51 -0000
@@ -1023,7 +1023,10 @@
 		g_string_append (dn_value, ",");
 		sub_domain = strtok (NULL, ".");
 	}
-	dn = g_strndup (dn_value->str, strlen(dn_value->str) - 1);
+	if (dn_value->str[0])
+		dn = g_strndup (dn_value->str, strlen(dn_value->str) - 1);
+	else 
+		dn = NULL;
 	g_string_free (dn_value, TRUE);
 	return dn;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.