Re: [evolution-patches][Mailer] Fixes for bug #332140



hi all,

	i have splitted that patch into three smaller ones. And corrected  the
errors as jeffery suggested.
	pls review them for me. thanks!

regards,

jerry

On Tue, 2006-02-28 at 09:34 -0500, Jeffrey Stedfast wrote:
> you realise you leak memory all over the place, right?
> 
> also, in some of those functions, filename is declared `const char *`,
> so this will also cause compiler warnings.
> 
> Jeff
> 
> On Tue, 2006-02-28 at 18:02 +0800, ShiPu wrote:
> > hi all,
> > 
> > 	this patch is for bug #332140. Anyone who could review it for me?
> > 
> > thanks,
> > 
> > jerry
> > _______________________________________________
> > Evolution-patches mailing list
> > Evolution-patches gnome org
> > http://mail.gnome.org/mailman/listinfo/evolution-patches
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.3001
diff -u -p -r1.3001 ChangeLog
--- calendar/ChangeLog	28 Feb 2006 12:16:43 -0000	1.3001
+++ calendar/ChangeLog	1 Mar 2006 09:04:30 -0000
@@ -1,3 +1,12 @@
+2006-03-01  Shi Pu <shi pu sun com>
+
+	Fixes bug #332140
+
+	* gui/dialogs/comp-editor.c: (get_attachment_list):
+	* gui/e-cal-popup.c: (temp_save_part):
+	Changed to transfer filenames from utf-8 to glib encoding before
+	really saving files.
+
 2006-02-28  Chenthill Palanisamy  <pchenthill novell com>
 
 	Fixes #332726
Index: calendar/gui/e-cal-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.c,v
retrieving revision 1.22
diff -u -p -r1.22 e-cal-popup.c
--- calendar/gui/e-cal-popup.c	8 Feb 2006 13:06:02 -0000	1.22
+++ calendar/gui/e-cal-popup.c	1 Mar 2006 09:04:32 -0000
@@ -91,7 +91,7 @@ static char *
 temp_save_part(CamelMimePart *part, char *path, gboolean file)
 {
 	const char *filename;
-	char *tmpdir, *mfilename = NULL;
+	char *tmpdir, *utf8_mfilename = NULL, *mfilename = NULL;
 	CamelStream *stream;
 	CamelDataWrapper *wrapper;
 
@@ -106,9 +106,11 @@ temp_save_part(CamelMimePart *part, char
 			/* This is the default filename used for temporary file creation */
 			filename = _("Unknown");
 		} else {
-			mfilename = g_strdup(filename);
-			e_filename_make_safe(mfilename);
-			filename = mfilename;
+			utf8_mfilename = g_strdup (filename);
+			e_filename_make_safe (utf8_mfilename);
+			mfilename = g_filename_from_utf8 ((const char *) utf8_mfilename, -1, NULL, NULL, NULL);
+			g_free (utf8_mfilename);
+			filename = (const char *) mfilename;
 		}
 
 		path = g_build_filename(tmpdir, filename, NULL);
@@ -121,9 +123,11 @@ temp_save_part(CamelMimePart *part, char
 			/* This is the default filename used for temporary file creation */
 			filename = _("Unknown");
 		} else {
-			mfilename = g_strdup(filename);
-			e_filename_make_safe(mfilename);
-			filename = mfilename;
+			utf8_mfilename = g_strdup (filename);
+			e_filename_make_safe (utf8_mfilename);
+			mfilename = g_filename_from_utf8 ((const char *)utf8_mfilename, -1, NULL, NULL, NULL);
+			g_free (utf8_mfilename);
+			filename = (const char *) mfilename;
 		}
 		
 		path = g_build_filename(tmpdir, filename, NULL);
Index: calendar/gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.166
diff -u -p -r1.166 comp-editor.c
--- calendar/gui/dialogs/comp-editor.c	10 Feb 2006 22:27:36 -0000	1.166
+++ calendar/gui/dialogs/comp-editor.c	1 Mar 2006 09:04:32 -0000
@@ -634,7 +634,7 @@ get_attachment_list (CompEditor *editor)
 		CamelDataWrapper *wrapper;
 		CamelStream *stream;
 		char *attach_file_url;
-		char *safe_fname;
+		char *safe_fname, *utf8_safe_fname;
 		char *filename;
 	
 		wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (p->data));
@@ -642,7 +642,9 @@ get_attachment_list (CompEditor *editor)
 		/* Extract the content from the stream and write it down
 		 * as a mime part file into the directory denoting the
 		 * calendar source */
-		safe_fname = camel_file_util_safe_filename(camel_mime_part_get_filename ((CamelMimePart *)p->data));
+		utf8_safe_fname = camel_file_util_safe_filename (camel_mime_part_get_filename ((CamelMimePart *) p->data));
+		safe_fname = g_filename_from_utf8 ((const char *) utf8_safe_fname, -1, NULL, NULL, NULL);
+		g_free (utf8_safe_fname);
 
 		filename = g_strdup_printf ("%s-%s", comp_uid, safe_fname);
 
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3811
diff -u -p -r1.3811 ChangeLog
--- mail/ChangeLog	1 Mar 2006 00:06:23 -0000	1.3811
+++ mail/ChangeLog	1 Mar 2006 09:02:50 -0000
@@ -1,3 +1,11 @@
+2006-03-01  Shi Pu <shi pu sun com>
+
+	Fixes bug #332140
+
+	* em-utils.c: (em_utils_temp_save_part):
+	Changed to transfer filenames from utf-8 to glib encoding before
+	really saving files.
+
 2006-03-01  Andre Klapper  <a9016009 gmx de>
 
 	* default/C/Inbox: Update the Welcome mail.
Index: mail/em-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-utils.c,v
retrieving revision 1.77
diff -u -p -r1.77 em-utils.c
--- mail/em-utils.c	20 Feb 2006 16:01:00 -0000	1.77
+++ mail/em-utils.c	1 Mar 2006 09:07:17 -0000
@@ -1259,7 +1259,7 @@ char *
 em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part)
 {
 	const char *filename;
-	char *tmpdir, *path, *mfilename = NULL;
+	char *tmpdir, *path, *utf8_mfilename = NULL, *mfilename = NULL;
 	int done;
 
 	tmpdir = e_mkdtemp("evolution-tmp-XXXXXX");
@@ -1273,9 +1273,11 @@ em_utils_temp_save_part(GtkWidget *paren
 		/* This is the default filename used for temporary file creation */
 		filename = _("Unknown");
 	} else {
-		mfilename = g_strdup(filename);
-		e_filename_make_safe(mfilename);
-		filename = mfilename;
+		utf8_mfilename = g_strdup (filename);
+		e_filename_make_safe (utf8_mfilename);
+		mfilename = g_filename_from_utf8 ((const char *) utf8_mfilename, -1, NULL, NULL, NULL);
+		g_free (utf8_mfilename);
+		filename = (const char *) mfilename;
 	}
 
 	path = g_build_filename(tmpdir, filename, NULL);
Index: widgets/misc/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v
retrieving revision 1.401
diff -u -p -r1.401 ChangeLog
--- widgets/misc/ChangeLog	28 Feb 2006 10:49:36 -0000	1.401
+++ widgets/misc/ChangeLog	1 Mar 2006 09:07:18 -0000
@@ -1,3 +1,11 @@
+2006-03-01  Shi Pu <shi pu sun com>
+
+	Fixes bug #332140
+
+	* e-attachment-bar.c: (temp_save_part):
+	Changed to transfer filenames from utf-8 to glib encoding before
+	really saving files.
+
 2006-02-28  Devashish Sharma  <sdevashish novell com>
 
 	* e-reflow.c :(do_adjustment): Check and see if reflow->items 
Index: widgets/misc/e-attachment-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-attachment-bar.c,v
retrieving revision 1.15
diff -u -p -r1.15 e-attachment-bar.c
--- widgets/misc/e-attachment-bar.c	30 Jan 2006 12:28:04 -0000	1.15
+++ widgets/misc/e-attachment-bar.c	1 Mar 2006 09:07:18 -0000
@@ -671,7 +671,7 @@ static char *
 temp_save_part(CamelMimePart *part)
 {
 	const char *filename;
-	char *tmpdir, *path, *mfilename = NULL;
+	char *tmpdir, *path, *mfilename = NULL, *utf8_mfilename = NULL;
 	CamelStream *stream;
 	CamelDataWrapper *wrapper;
 
@@ -685,9 +685,11 @@ temp_save_part(CamelMimePart *part)
 		/* This is the default filename used for temporary file creation */
 		filename = _("Unknown");
 	} else {
-		mfilename = g_strdup(filename);
-		e_filename_make_safe(mfilename);
-		filename = mfilename;
+		utf8_mfilename = g_strdup (filename);
+		e_filename_make_safe (utf8_mfilename);
+		mfilename = g_filename_from_utf8 ((const char *) utf8_mfilename, -1, NULL, NULL, NULL);
+		g_free (utf8_mfilename);
+		filename = (const char *) mfilename;
 	}
 
 	path = g_build_filename(tmpdir, filename, NULL);


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