Re: [evolution-patches] patch for 43558



Thanks Dan,
I noticed your reply a bit late. 
See whether the attached pacth for e-time-utils.c is OK. I have added a
bit more code to free up the string.

Regards,
Suresh


On 二, 2003-07-29 at 05:58, Dan Winship wrote:
> On Mon, 2003-07-28 at 21:16, Suresh Chandrasekharan wrote:
> > Hi ,
> > Pl. evaluate and apply the evolution patch for "43558
> > Appointment Editor always gives time validation error for apptmnts for
> > non-UTF-8 non ASCII locales."
> 
> > -       else if (!e_date_edit_parse_time (dedit, time_text, &tmp_tm))
> > +       else if (!e_date_edit_parse_time (dedit, e_utf8_to_locale_string(time_text), &tmp_tm))
> 
> e_date_edit_parse_time passes the time_text to e_time_parse_time(). In
> general, all public APIs should be using UTF8-encoded strings. So I
> think it would be better to leave e-dateedit.c as it is and do the
> conversion inside e-time-utils.c.
> 
> That would also fix the several other places in widgets/misc and
> calendar/gui that call the e_time_parse_* functions and presumably all
> currently suffer from the same bug you're trying to fix here.
> 
> -- Dan
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.398.2.1
diff -u -r1.398.2.1 ChangeLog
--- ChangeLog	17 Jul 2003 12:41:04 -0000	1.398.2.1
+++ ChangeLog	29 Jul 2003 19:51:28 -0000
@@ -1,3 +1,8 @@
+2003-07-28  Suresh Chandrasekharan  <suresh chandrasekharan sun com
+	* e-time-utils.c (parse_with_strptime): Fixes #43558 Appointment 
+	Editor always gives time validation error for apptmnts in non 
+	UTF-8/non ASCII locales.
+
 2003-07-03  JP Rosevear  <jpr ximian com>
 
 	* e-xml-hash-utils.c (foreach_save_func): encode the text
Index: e-time-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-time-utils.c,v
retrieving revision 1.15
diff -u -r1.15 e-time-utils.c
--- e-time-utils.c	30 May 2003 17:32:52 -0000	1.15
+++ e-time-utils.c	29 Jul 2003 19:51:28 -0000
@@ -17,6 +17,7 @@
 
 #include <time.h>
 #include <sys/time.h>
+#include <gal/widgets/e-unicode.h>
 
 #ifdef __linux__
 #undef _GNU_SOURCE
@@ -58,6 +59,8 @@
 parse_with_strptime (const char *value, struct tm *result, const char **formats, int n_formats)
 {
 	const char *parse_end = NULL, *pos;
+	gchar *locale_str;
+	ETimeParseStatus parse_ret;
 	gboolean parsed = FALSE;
 	int i;
 
@@ -66,8 +69,10 @@
 		result->tm_isdst = -1;
 		return E_TIME_PARSE_NONE;
 	}
+	
+	locale_str = e_utf8_to_locale_string (value);
 
-	pos = value;
+	pos = (const char *) locale_str;
 
 	/* Skip whitespace */
 	while (isspace (*pos))
@@ -86,6 +91,8 @@
 
 	result->tm_isdst = -1;
 
+	parse_ret =  E_TIME_PARSE_INVALID;
+
 	/* If we parsed something, make sure we parsed the entire string. */
 	if (parsed) {
 		/* Skip whitespace */
@@ -93,10 +100,13 @@
 			parse_end++;
 
 		if (*parse_end == '\0')
-			return E_TIME_PARSE_OK;
+			parse_ret = E_TIME_PARSE_OK;
 	}
 
-	return E_TIME_PARSE_INVALID;
+	g_free(locale_str);
+
+	return(parse_ret);
+
 }
 
 


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