Re: [Gtranslator-devel] po file



Hi,

The attached patch (commited in CVS) fixes the crash.

Gtranslator currently ignores any line that can't be converted to the
file's charset and only issues warnings to the console. I'm thinking
that the user should be informed that via a single dialog at the end of
file loading.

I'm also not so sure if it's a good idea to continue loading a file when
an error occurs...

> It did that to me today, if you test the file with "msgfmt -cv
> filename.po", it will report errors at line 962. This line starts with
> garbage (added by gtranslator).

The garbage bug seems to be fixed by a patch I submitted a few days ago
to http://bugzilla.gnome.org/show_bug.cgi?id=130114 . I've also just
commited this patch to CVS.

It would be great if someone could give it a test.


-dan
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtranslator/src/ChangeLog,v
retrieving revision 1.915
diff -u -r1.915 ChangeLog
--- ChangeLog	12 Jan 2004 11:28:30 -0000	1.915
+++ ChangeLog	13 Jan 2004 08:17:34 -0000
@@ -1,3 +1,8 @@
+2004-01-13  Dan Damian  <dand gnome ro>
+
+	* parse.c (gtranslator_parse_core): Check error value. Fixes a
+	crash on invalid byte sequences.
+
 2004-01-12  Dan Damian  <dand gnome ro>
 
 	* messages.h, message.c (gtranslator_message_go_to): Save cursor
Index: parse.c
===================================================================
RCS file: /cvs/gnome/gtranslator/src/parse.c,v
retrieving revision 1.260
diff -u -r1.260 parse.c
--- parse.c	12 Jan 2004 07:59:15 -0000	1.260
+++ parse.c	13 Jan 2004 08:17:34 -0000
@@ -324,7 +324,12 @@
 			 */
 			line = g_convert(rawline, strlen(rawline), "utf-8", po->header->charset, NULL, NULL, &errv);
 			if(!line) {
-				g_warning("%s:%d: could not convert line from '%s' to UTF-8: %s", po->filename, lines, po->header->charset, errv->message);
+				if (errv == NULL) {
+					g_warning("%s:%d: could not convert line from '%s' to UTF-8: %s", po->filename, lines, po->header->charset, errv->message);
+				} else {
+					g_warning("%s:%d: could not convert line from '%s' to UTF-8: [NULL ERRV]", po->filename, lines, po->header->charset);
+				}
+										
 				continue;
 			}
 		}


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