gnumeric r17086 - in trunk: . plugins/lotus-123



Author: mortenw
Date: Fri Jan 23 21:22:23 2009
New Revision: 17086
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17086&view=rev

Log:
2009-01-23  Morten Welinder  <terra gnome org>

	* lotus-formula.c (lotus_parse_formula_new): Fix looping while
	parsing AND/OR/NOT nodes.  Fixes #568917.



Modified:
   trunk/NEWS
   trunk/plugins/lotus-123/ChangeLog
   trunk/plugins/lotus-123/lotus-formula.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Fri Jan 23 21:22:23 2009
@@ -76,6 +76,7 @@
 	* Fix undo crash for inter-workbook operations.  [#568634]
 	* Fix crash and criticals in dbf import.  [#568454]
 	* Fix colour problem in LaTeX export.  [#568860]
+	* Fix loop while loading lotus file.  [#568917]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.3

Modified: trunk/plugins/lotus-123/lotus-formula.c
==============================================================================
--- trunk/plugins/lotus-123/lotus-formula.c	(original)
+++ trunk/plugins/lotus-123/lotus-formula.c	Fri Jan 23 21:22:23 2009
@@ -544,14 +544,17 @@
 		case 0x14:
 			/* FIXME: Check if we need bit version.  */
 			handle_named_func (&stack, orig, "AND", NULL, 2);
+			i++;
 			break;
 		case 0x15:
 			/* FIXME: Check if we need bit version.  */
 			handle_named_func (&stack, orig, "OR", NULL, 2);
+			i++;
 			break;
 		case 0x16:
 			/* FIXME: Check if we need bit version.  */
 			handle_named_func (&stack, orig, "NOT", NULL, 1);
+			i++;
 			break;
 		case 0x17: HANDLE_UNARY (GNM_EXPR_OP_UNARY_PLUS);
 
@@ -591,6 +594,7 @@
 	guint i;
 	gboolean done = FALSE;
 	gboolean uses_snum = (state->version <= LOTUS_VERSION_123V4);
+	GnmExprTop const *res;
 
 	for (i = 0; i < len && !done;) {
 		switch (data[i]) {
@@ -698,12 +702,15 @@
 		case LOTUS_FORMULA_OP_AND:
 			/* FIXME: Check if we need bit versions.  */
 			handle_named_func (&stack, orig, "AND", NULL, 2);
+			i++;
 			break;
 		case LOTUS_FORMULA_OP_OR:
 			handle_named_func (&stack, orig, "OR", NULL, 2);
+			i++;
 			break;
 		case LOTUS_FORMULA_OP_NOT:
 			handle_named_func (&stack, orig, "NOT", NULL, 1);
+			i++;
 			break;
 
 		case LOTUS_FORMULA_SPLFUNC: {
@@ -744,10 +751,15 @@
 		}
 	}
 
-	if (gnm_expr_list_length (stack) != 1)
+	res = stack ? gnm_expr_top_new (parse_list_pop (&stack, orig)) : NULL;
+	if (stack) {
 		g_warning ("%s: args remain on stack",
 			   cell_coord_name (orig->eval.col, orig->eval.row));
-	return gnm_expr_top_new (parse_list_pop (&stack, orig));
+		while (stack)
+			gnm_expr_free (parse_list_pop (&stack, orig));
+	}
+
+	return res;
 }
 
 



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