Re: [evolution-patches] [calendar] fix for bug #272176



Changes are made as per suggestion.
Please review.

Thanks,
Dinesh


On Tue, 2005-09-27 at 10:07 +0000, chen  wrote:
> The patch covers only the deviation in text fields. The other
deviations
> in datetime, duration etc. should be covered.
> 
> thanks, Chenthill.
> 
> On Mon, 2005-09-26 at 05:45 -0600, Dinesh Layek wrote:
> > Attached patch fixes bug#272176 (slight deviations in vCal-format
cause
> > evolution-crash)
> > 
> > Please review
> > 
> > Regards,
> > Dinesh Layek
> > 
> > _______________________________________________
> > Evolution-patches mailing list
> > Evolution-patches gnome org
> > http://mail.gnome.org/mailman/listinfo/evolution-patches
Index: libical/src/libical/icalparser.c
===================================================================
RCS file: /cvs/gnome/libical/src/libical/icalparser.c,v
retrieving revision 1.18
diff -u -p -r1.18 icalparser.c
--- libical/src/libical/icalparser.c	13 May 2004 03:54:39 -0000	1.18
+++ libical/src/libical/icalparser.c	28 Sep 2005 13:31:06 -0000
@@ -106,6 +106,18 @@ struct icalparser_impl 
 };
 
 
+char* strstrip (char *str)
+{
+	if (!str)
+		return NULL;
+	while (*str == ' ')
+		str = str+1;
+	while (*str && str[strlen  (str)-1] == ' ')
+		str[strlen (str)-1] = 0;
+	return str;
+}
+
+
 icalparser* icalparser_new(void)
 {
     struct icalparser_impl* impl = 0;
@@ -809,6 +821,7 @@ icalcomponent* icalparser_add_line(icalp
 	}
 
 	str = icalparser_get_next_parameter(end,&end);
+	str = strstrip (str);
 
 	if (str != 0){
 	    char* name;
@@ -848,7 +861,7 @@ icalcomponent* icalparser_add_line(icalp
 			     ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR);
 		tail = 0;
 		parser->state = ICALPARSER_ERROR;
-		return 0;
+		continue;
 	    }
 
 	    if (param == 0){
@@ -888,7 +901,7 @@ icalcomponent* icalparser_add_line(icalp
 		    icalparameter_free(param);
 		    tail = 0;
 		    parser->state = ICALPARSER_ERROR;
-		    return 0;
+		    continue;	
 		} 
 	    }
 
@@ -915,6 +928,7 @@ icalcomponent* icalparser_add_line(icalp
     vcount=0;
     while(1) {
 	str = icalparser_get_next_value(end,&end, value_kind);
+	str = strstrip (str);
 
 	if (str != 0){
 		
Index: libical/scripts/mkderivedvalues.pl
===================================================================
RCS file: /cvs/gnome/libical/scripts/mkderivedvalues.pl,v
retrieving revision 1.10
diff -u -p -r1.10 mkderivedvalues.pl
--- libical/scripts/mkderivedvalues.pl	11 Sep 2003 22:04:03 -0000	1.10
+++ libical/scripts/mkderivedvalues.pl	28 Sep 2005 13:31:06 -0000
@@ -206,9 +206,14 @@ void icalvalue_set_${lc}(icalvalue* valu
     impl->data.v_$union_data = $assign \n\
     icalvalue_reset_kind(impl);\n}\n";
 
-    print "$type\ icalvalue_get_${lc}(const icalvalue* value)\ {\n\
-    icalerror_check_arg( (value!=0),\"value\");\
-    icalerror_check_value_type(value, ICAL_${uc}_VALUE);\
+    print "$type\ icalvalue_get_${lc} (const icalvalue* value) {\n\n";
+    if( $union_data eq 'string') {
+	print "    icalerror_check_arg_rz ((value!=0),\"value\");\n";
+    }
+    else {
+	print "    icalerror_check_arg ((value!=0),\"value\");\n";
+    }
+    print "    icalerror_check_value_type (value, ICAL_${uc}_VALUE);\
     return ((struct icalvalue_impl*)value)->data.v_${union_data};\n}\n";
 
     
Index: libical/ChangeLog
===================================================================
RCS file: /cvs/gnome/libical/ChangeLog,v
retrieving revision 1.178
diff -u -p -r1.178 ChangeLog
--- libical/ChangeLog	20 Sep 2005 02:20:53 -0000	1.178
+++ libical/ChangeLog	28 Sep 2005 13:31:06 -0000
@@ -1,3 +1,10 @@
+2005-09-27  Dinesh Layek <ldinesh novell com>
+	Fixes bug#272176
+	* src/libical/icalparser.c (icalparser_add_line): removed the
+	leading and trailing white spaces of the string to be parse
+	* scripts/mkderivedvalues.pl: changed the code to make the
+	functions, which returns a string, return NULL on NULL input.
+
 2005-09-20  Irene Huang <Irene Huang sun com>
 
 	* src/libical/icalcomponent.c: (icalcomponent_get_datetime):


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