gnumeric r16404 - in branches/gnumeric-1-8: . plugins/sylk



Author: mortenw
Date: Sun Feb 24 02:07:25 2008
New Revision: 16404
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16404&view=rev

Log:
2008-02-23  Morten Welinder  <terra gnome org>

	* sylk.c (sylk_parse_value): Constify and fix the unqouted-string
	case.



Modified:
   branches/gnumeric-1-8/NEWS
   branches/gnumeric-1-8/plugins/sylk/ChangeLog
   branches/gnumeric-1-8/plugins/sylk/sylk.c

Modified: branches/gnumeric-1-8/NEWS
==============================================================================
--- branches/gnumeric-1-8/NEWS	(original)
+++ branches/gnumeric-1-8/NEWS	Sun Feb 24 02:07:25 2008
@@ -22,6 +22,7 @@
 	* Fix paste-as-text bug.  [#514438]
 	* Fix corrupted-mps-bug.  [#517141]
 	* Fix corrupted-qpro-bugs.  [#517144] [#517376] [#517591]
+	* Fix corrupted-sylk-bug.
 	* Make <control>KP_Subtract work as <control>minus.  [#516358]
 	* Make <control>KP_Add work as <control>plus.
 	* Fix corrupted-applix-bugs.  [#517778]

Modified: branches/gnumeric-1-8/plugins/sylk/sylk.c
==============================================================================
--- branches/gnumeric-1-8/plugins/sylk/sylk.c	(original)
+++ branches/gnumeric-1-8/plugins/sylk/sylk.c	Sun Feb 24 02:07:25 2008
@@ -195,19 +195,24 @@
 }
 
 static GnmValue *
-sylk_parse_value (SylkReader *state, char *str)
+sylk_parse_value (SylkReader *state, const char *str)
 {
 	GnmValue *val;
 	if ('\"' == *str) { /* quoted string */
-		unsigned len = strlen (str);
+		size_t len;
+
+		str++;
+		len = strlen (str);
 		if (str[len-1] == '\"')
-			str[len-1] = '\0';
-		return value_new_string (str+1);
+			len--;
+		return value_new_string_nocopy (g_strndup (str + 1, len));
 	}
 
-	if (NULL != (val = format_match_simple (str)))
+	val = format_match_simple (str);
+	if (val)
 		return val;
-	return value_new_string_nocopy (str);
+
+	return value_new_string (str);
 }
 
 static GnmExprTop const *



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