[Goodies-commits] r4499 - xfce4-dict/trunk/lib

Enrico Troeger enrico at xfce.org
Wed Apr 2 14:22:29 CEST 2008


Author: enrico
Date: 2008-04-02 12:22:29 +0000 (Wed, 02 Apr 2008)
New Revision: 4499

Modified:
   xfce4-dict/trunk/lib/aspell.c
Log:
Fix broken aspell search.

Modified: xfce4-dict/trunk/lib/aspell.c
===================================================================
--- xfce4-dict/trunk/lib/aspell.c	2008-04-02 12:21:38 UTC (rev 4498)
+++ xfce4-dict/trunk/lib/aspell.c	2008-04-02 12:22:29 UTC (rev 4499)
@@ -36,7 +36,7 @@
 #include "gui.h"
 
 
-static GIOChannel *set_up_io_channel(gint fd, GIOCondition cond, GIOFunc func, gconstpointer data)
+static GIOChannel *set_up_io_channel(gint fd, GIOCondition cond, GIOFunc func, gpointer data)
 {
 	GIOChannel *ioc;
 
@@ -123,10 +123,10 @@
 
 static gboolean iofunc_write(GIOChannel *ioc, GIOCondition cond, gpointer data)
 {
-	gsize written;
+	if (NZV((gchar *) data))
+		g_io_channel_write_chars(ioc, (gchar *) data, -1, NULL, NULL);
 
-	if (NZV((const gchar *) data))
-		g_io_channel_write_chars(ioc, (const gchar *) data, -1, &written, NULL);
+	g_free(data);
 
 	return FALSE;
 }
@@ -141,6 +141,7 @@
 	gint     stderr_fd;
 	gint     stdin_fd;
 	gchar	*tts;
+	gchar	*tts_end;
 
 	if (! NZV(dd->spell_bin))
 	{
@@ -157,13 +158,13 @@
 	/* TODO search only for the first word when working on a sentence,
 	 * workout a better solution */
 	tts = g_strdup(word);
-	if ((tts = strchr(word, ' ')) ||
-		(tts = strchr(word, '-')) ||
-		(tts = strchr(word, '_')) ||
-		(tts = strchr(word, '.')) ||
-		(tts = strchr(word, ',')))
+	if ((tts_end = strchr(word, ' ')) ||
+		(tts_end = strchr(word, '-')) ||
+		(tts_end = strchr(word, '_')) ||
+		(tts_end = strchr(word, '.')) ||
+		(tts_end = strchr(word, ',')))
 	{
-		*tts = '\0';
+		*tts_end = '\0';
 	}
 
 	locale_cmd = g_locale_from_utf8(dd->spell_bin, -1, NULL, NULL, NULL);
@@ -193,6 +194,6 @@
 		error = NULL;
 	}
 
-	g_free(tts);
+	/* tts is freed in iofunc_write() */
 	g_strfreev(argv);
 }




More information about the Goodies-commits mailing list