[evolution-patches] 68787, mail crash migration




Sigh, I wasted the poor chaps time getting me a copy of his evolution tree as test data, where a closer look at the code would've found it easily.

Just fixes some bung logic.
--
Michael Zucchi <notzed ximian com>
"I'm stuck in a reality I can't imagine could be real."
Novell's Evolution and Free Software Developer
? e-util/a.out
? e-util/bag.c
? e-util/bag.ps
? e-util/e-msgport.c.new
? e-util/e-trie.c.fixed
? e-util/e.diff
? e-util/fsusage.c
? e-util/fsusage.h
? e-util/mutex.c
? e-util/mutex.ps
? e-util/test.c
? e-util/ename/Makefile
? e-util/ename/Makefile.in
? e-util/ename/test-ename-western
? e-util/ename/test-ename-western-gtk
Index: e-util/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.481.2.2
diff -u -p -r1.481.2.2 ChangeLog
--- e-util/ChangeLog	13 Oct 2004 17:24:43 -0000	1.481.2.2
+++ e-util/ChangeLog	1 Nov 2004 08:17:04 -0000
@@ -1,3 +1,11 @@
+2004-11-01  Not Zed  <NotZed Ximian com>
+
+	** See bug #68787
+
+	* e-account.c (xml_set_content): check the new val isn't null
+	before dereferencing it.
+	* e-account.c (xml_set_prop): same here.
+
 2004-10-07  Jeffrey Stedfast  <fejj novell com>
 
 	* e-passwords.c (ep_ask_password): Use "%s" as the formatter
Index: e-util/e-account.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account.c,v
retrieving revision 1.10
diff -u -p -r1.10 e-account.c
--- e-util/e-account.c	9 Apr 2004 19:47:06 -0000	1.10
+++ e-util/e-account.c	1 Nov 2004 08:17:04 -0000
@@ -225,45 +225,51 @@ xml_set_int (xmlNodePtr node, const char
 static gboolean
 xml_set_prop (xmlNodePtr node, const char *name, char **val)
 {
-	char *buf, *new_val;
+	char *buf;
+	int res;
 
-	buf = xmlGetProp (node, name);
-	new_val = g_strdup (buf);
-	xmlFree (buf);
-
-	/* We can use strcmp here whether the value is UTF8 or
-	 * not, since we only care if the bytes changed.
-	 */
-	if (!*val || strcmp (*val, new_val)) {
-		g_free (*val);
-		*val = new_val;
-		return TRUE;
+	buf = xmlGetProp(node, name);
+	if (buf == NULL) {
+		res = (*val != NULL);
+		if (res) {
+			g_free(*val);
+			*val = NULL;
+		}
 	} else {
-		g_free (new_val);
-		return FALSE;
+		res = *val == NULL || strcmp(*val, buf) != 0;
+		if (res) {
+			g_free(*val);
+			*val = g_strdup(buf);
+		}
+		xmlFree(buf);
 	}
+
+	return res;
 }
 
 static gboolean
 xml_set_content (xmlNodePtr node, char **val)
 {
-	char *buf, *new_val;
+	char *buf;
+	int res;
 
-	buf = xmlNodeGetContent (node);
-        new_val = g_strdup (buf);
-	xmlFree (buf);
-
-	/* We can use strcmp here whether the value is UTF8 or
-	 * not, since we only care if the bytes changed.
-	 */
-	if (!*val || strcmp (*val, new_val)) {
-		g_free (*val);
-		*val = new_val;
-		return TRUE;
+	buf = xmlNodeGetContent(node);
+	if (buf == NULL) {
+		res = (*val != NULL);
+		if (res) {
+			g_free(*val);
+			*val = NULL;
+		}
 	} else {
-		g_free (new_val);
-		return FALSE;
+		res = *val == NULL || strcmp(*val, buf) != 0;
+		if (res) {
+			g_free(*val);
+			*val = g_strdup(buf);
+		}
+		xmlFree(buf);
 	}
+
+	return res;
 }
 
 static gboolean
@@ -283,6 +289,9 @@ xml_set_identity (xmlNodePtr node, EAcco
 		else if (!strcmp (node->name, "signature")) {
 			changed |= xml_set_prop (node, "uid", &id->sig_uid);
 			if (!id->sig_uid) {
+
+				/* WTF is this shit doing here?  Migrate is supposed to "handle this" */
+
 				/* set a fake sig uid so the migrate code can handle this */
 				gboolean autogen = FALSE;
 				int sig_id = 0;


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