From: Jordi Mallach Date: Mon, 17 Mar 2003 11:02:40 +0000 (+0000) Subject: Patch from Robert Cheramy to fix locale segfaults. X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=5f2eb588016d67344ed7ffd4900487511b433b8f;p=gtetrinet Patch from Robert Cheramy to fix locale segfaults. Doc updates. --- diff --git a/AUTHORS b/AUTHORS index 8ac3d0d..bfc6f28 100644 --- a/AUTHORS +++ b/AUTHORS @@ -18,3 +18,4 @@ James Antill Steve Kemp Gerfried Fuchs Dani Carbonell +Christian Hammond diff --git a/ChangeLog b/ChangeLog index bb1302c..2d84dfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-03-17 Jordi Mallach + + * src/fields.c (gmsginput_activate): Patch from Robert Cheramy, to + workaround segfaults when trying to input characters not supported + by the current locale. + * src/partyline.c (textentry): Likewise. + + * AUTHORS, TODO: Updated. + * README: Changed contact address. + 2003-03-17 Jordi Mallach * configure.in (ALL_LINGUAS): Added "ru" (Russian). diff --git a/README b/README index 6c70934..d3a61b1 100644 --- a/README +++ b/README @@ -35,4 +35,4 @@ The GTetrinet homepage is at http://gtetrinet.sourceforge.net/ -E-Mail suggestions, bug reports, etc to kswong@zip.com.au +E-Mail suggestions, bug reports, etc. to gtetrinet-list@gnome.org. diff --git a/TODO b/TODO index 335b90f..2077d78 100644 --- a/TODO +++ b/TODO @@ -3,10 +3,6 @@ GTetrinet's TODO list - Get server list from http://www.tetrinet.org/ip/ (see #104323) -- GNOME2 port issues: - + detaching and reattaching the Menu Bar causes two Bonobo-CRITICAL - + if you use the C locale and input an 8bit character, gtetrinet segfaults - - Make gtetrinet resizeable (at least the fields messages bit) - Hide mouse cursor when game is in progress diff --git a/src/fields.c b/src/fields.c index 7fe8c03..62b9852 100644 --- a/src/fields.c +++ b/src/fields.c @@ -604,6 +604,8 @@ void gmsginput_activate (void) /* post /me thingy */ g_snprintf (buf, sizeof(buf), "* %s %s", nick, s+4); locale_s = g_locale_from_utf8 (buf, -1, NULL, NULL, NULL); + /* FIXME : if there is an error while converting from UTF8 to current locale, we ignore the message */ + if (locale_s == NULL) return; client_outmessage (OUT_GMSG, locale_s); g_free (locale_s); } @@ -611,6 +613,8 @@ void gmsginput_activate (void) /* post message */ g_snprintf (buf, sizeof(buf), "<%s> %s", nick, s); locale_s = g_locale_from_utf8 (buf, -1, NULL, NULL, NULL); + /* FIXME : if there is an error while converting from UTF8 to current locale, we ignore the message */ + if (locale_s == NULL) return; client_outmessage (OUT_GMSG, locale_s); g_free (locale_s); } diff --git a/src/partyline.c b/src/partyline.c index 1f8ade6..df2f224 100644 --- a/src/partyline.c +++ b/src/partyline.c @@ -331,6 +331,9 @@ void textentry (GtkWidget *widget) /* convert from UTF-8 to the current locale, will work with ISO8859-1 locales */ iso_text = g_locale_from_utf8 (text, -1, NULL, NULL, NULL); + /* FIXME : if there is an error while converting from UTF8 to current locale, we ignore the message */ + if (iso_text == NULL) return; + tetrinet_playerline (iso_text); GTET_O_STRCPY (plhistory[plh_end], iso_text); gtk_entry_set_text (GTK_ENTRY(widget), "");