gnumeric r17140 - in trunk: . src



Author: mortenw
Date: Fri Feb 13 14:08:58 2009
New Revision: 17140
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17140&view=rev

Log:
2009-02-13  Morten Welinder  <terra gnome org>

	* src/stf-parse.c (stf_parse_general): Flag row overflow.

	* src/stf.c (stf_read_workbook_auto_csvtab): Check for row
	overflow too.  Fixes #517603.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/src/stf-parse.c
   trunk/src/stf-parse.h
   trunk/src/stf.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Fri Feb 13 14:08:58 2009
@@ -105,6 +105,7 @@
 	* Fix csv import problem with "-OINK".  [#571129]
 	* Make sure ()s do not take up stack space during eval.
 	* Make dependency debug output a little easier to read.
+	* Warn when we drop csv rows.  [#571603]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.3

Modified: trunk/src/stf-parse.c
==============================================================================
--- trunk/src/stf-parse.c	(original)
+++ trunk/src/stf-parse.c	Fri Feb 13 14:08:58 2009
@@ -164,6 +164,7 @@
 	parseoptions->formats = NULL;
 
 	parseoptions->cols_exceeded = FALSE;
+	parseoptions->rows_exceeded = FALSE;
 
 	return parseoptions;
 }
@@ -839,6 +840,11 @@
 	while (*src.position != '\0' && src.position < data_end) {
 		GPtrArray *line;
 
+		if (row == gnm_sheet_get_max_rows (NULL)) {
+			parseoptions->rows_exceeded = TRUE;
+			break;
+		}
+
 		line = parseoptions->parsetype == PARSE_TYPE_CSV
 			? stf_parse_csv_line (&src, parseoptions)
 			: stf_parse_fixed_line (&src, parseoptions);
@@ -846,9 +852,7 @@
 		g_ptr_array_add (lines, line);
 		if (parseoptions->parsetype != PARSE_TYPE_CSV)
 			src.position += compare_terminator (src.position, parseoptions);
-
-		if (++row == gnm_sheet_get_max_rows (NULL))
-			break;
+		row++;
 	}
 
 	return lines;

Modified: trunk/src/stf-parse.h
==============================================================================
--- trunk/src/stf-parse.h	(original)
+++ trunk/src/stf-parse.h	Fri Feb 13 14:08:58 2009
@@ -53,6 +53,7 @@
 	gboolean             cols_exceeded;         /* This is set to TRUE if */
 	                                            /* we tried to import more than */
 	                                            /* SHEET_MAX_COLS columns */
+	gboolean             rows_exceeded;         /* Ditto rows.  */
 } StfParseOptions_t;
 
 /* CREATION/DESTRUCTION of stf options struct */

Modified: trunk/src/stf.c
==============================================================================
--- trunk/src/stf.c	(original)
+++ trunk/src/stf.c	Fri Feb 13 14:08:58 2009
@@ -391,11 +391,10 @@
 	if (stf_parse_sheet (po, utf8data, NULL, sheet, 0, 0)) {
 		workbook_recalc_all (book);
 		sheet_queue_respan (sheet, 0, gnm_sheet_get_max_rows (sheet)-1);
-		if (po->cols_exceeded) {
+		if (po->cols_exceeded || po->rows_exceeded) {
 			const char *msg =
-				_("Some columns of data were"
-				  " dropped since they exceeded"
-				  " the available sheet size.");
+				_("Some data did not fit on the sheet and was dropped.");
+
 			/*
 			 * Using go_cmd_context_error_import will destroy the
 			 * successfully imported portion.  We ought to have a



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