Commit 4a96653c authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Drop maxline argument. All callers changed.

2006-01-13  Morten Welinder  <terra@gnome.org>

	* src/stf-parse.c (stf_parse_general): Drop maxline argument.  All
	callers changed.

	* src/commands.c (cmd_text_to_columns): Plug leaks.
parent d934b6ae
2006-01-13 Morten Welinder <terra@gnome.org>
* src/stf-parse.c (stf_parse_general): Drop maxline argument. All
callers changed.
* src/commands.c (cmd_text_to_columns): Plug leaks.
2006-01-06 Morten Welinder <terra@gnome.org>
* src/commands.c (cmd_search_replace_update_after_action): Add wbc
......
......@@ -33,6 +33,7 @@ Morten:
* Fix error on Search-and-replace.
* Improve handling of boolean args for "R" functions.
* Fix near-infinite loop in FACTDOUBLE.
* Fix text-to-columns crash probably affecting stf import too.
Jon Kåre:
* Hand clipboard off to clipboard manager when exiting.
......
2006-01-13 Morten Welinder <terra@gnome.org>
* src/stf-parse.c (stf_parse_general): Drop maxline argument. All
callers changed.
* src/commands.c (cmd_text_to_columns): Plug leaks.
2006-01-06 Morten Welinder <terra@gnome.org>
* src/commands.c (cmd_search_replace_update_after_action): Add wbc
......
......@@ -5894,16 +5894,20 @@ cmd_text_to_columns (WorkbookControl *wbc,
GnmCellRegion *content)
{
CmdTextToColumns *me;
char *src_range_name, *target_range_name;
g_return_val_if_fail (content != NULL, TRUE);
src_range_name = undo_range_name (src_sheet, src);
target_range_name = undo_range_name (target_sheet, target);
me = g_object_new (CMD_TEXT_TO_COLUMNS_TYPE, NULL);
me->cmd.sheet = (src_sheet == target_sheet ? src_sheet : NULL);
me->cmd.size = 1; /* FIXME? */
me->cmd.cmd_descriptor = g_strdup_printf (_("Text (%s) to Columns (%s)"),
undo_range_name (src_sheet, src),
undo_range_name (target_sheet, target));
src_range_name,
target_range_name);
me->dst.range = *target;
me->dst.sheet = target_sheet;
me->dst.paste_flags = PASTE_CONTENT | PASTE_FORMATS;
......@@ -5912,6 +5916,9 @@ cmd_text_to_columns (WorkbookControl *wbc,
me->content = content;
me->saved_sizes = NULL;
g_free (src_range_name);
g_free (target_range_name);
/* Check array subdivision & merged regions */
if (sheet_range_splits_region (target_sheet, &me->dst.range,
NULL, GO_CMD_CONTEXT (wbc), me->cmd.cmd_descriptor)) {
......
......@@ -95,8 +95,7 @@ csv_page_global_change (G_GNUC_UNUSED GtkWidget *widget,
trim = parseoptions->trim_spaces;
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_NEVER);
lines = stf_parse_general (parseoptions, lines_chunk,
pagedata->cur, pagedata->cur_end,
LINE_DISPLAY_LIMIT);
pagedata->cur, pagedata->cur_end);
stf_parse_options_set_trim_spaces (parseoptions, trim);
stf_preview_set_lines (renderdata, lines_chunk, lines);
......
......@@ -367,8 +367,7 @@ fixed_page_update_preview (StfDialogData *pagedata)
trim = parseoptions->trim_spaces;
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_NEVER);
lines = stf_parse_general (parseoptions, lines_chunk,
pagedata->cur, pagedata->cur_end,
LINE_DISPLAY_LIMIT);
pagedata->cur, pagedata->cur_end);
stf_parse_options_set_trim_spaces (parseoptions, trim);
stf_preview_set_lines (renderdata, lines_chunk, lines);
......
......@@ -409,8 +409,7 @@ format_page_update_preview (StfDialogData *pagedata)
stf_parse_general (pagedata->parseoptions,
lines_chunk,
pagedata->cur,
pagedata->cur_end,
LINE_DISPLAY_LIMIT));
pagedata->cur_end));
col_import_array_len_old = pagedata->format.col_import_array_len;
pagedata->format.col_import_array_len = renderdata->colcount;
......
......@@ -56,8 +56,6 @@ go_setlocale(LC_ALL, parseoptions->locale);}
go_setlocale(LC_ALL, oldlocale);\
g_free (oldlocale);}
#define WARN_TOO_MANY_ROWS _("Too many rows in data to parse: %d")
/* Source_t struct, used for interchanging parsing information between the low level parse functions */
typedef struct {
GStringChunk *chunk;
......@@ -776,8 +774,7 @@ stf_parse_general_free (GPtrArray *lines)
GPtrArray *
stf_parse_general (StfParseOptions_t *parseoptions,
GStringChunk *lines_chunk,
char const *data, char const *data_end,
int maxlines)
char const *data, char const *data_end)
{
GPtrArray *lines;
Source_t src;
......@@ -797,11 +794,6 @@ stf_parse_general (StfParseOptions_t *parseoptions,
while (*src.position != '\0' && src.position < data_end) {
GPtrArray *line;
if (++row >= SHEET_MAX_ROWS) {
g_warning (WARN_TOO_MANY_ROWS, row);
break;
}
line = parseoptions->parsetype == PARSE_TYPE_CSV
? stf_parse_csv_line (&src, parseoptions)
: stf_parse_fixed_line (&src, parseoptions);
......@@ -809,7 +801,7 @@ stf_parse_general (StfParseOptions_t *parseoptions,
g_ptr_array_add (lines, line);
src.position += compare_terminator (src.position, parseoptions);
if (row >= maxlines)
if (++row == SHEET_MAX_ROWS)
break;
}
......@@ -1162,8 +1154,7 @@ stf_parse_sheet (StfParseOptions_t *parseoptions,
if (!data_end)
data_end = data + strlen (data);
lines_chunk = g_string_chunk_new (100 * 1024);
lines = stf_parse_general (parseoptions, lines_chunk, data, data_end,
SHEET_MAX_ROWS);
lines = stf_parse_general (parseoptions, lines_chunk, data, data_end);
if (lines == NULL)
return FALSE;
for (row = start_row, lrow = 0; lrow < lines->len ; row++, lrow++) {
......@@ -1220,8 +1211,7 @@ stf_parse_region (StfParseOptions_t *parseoptions, char const *data, char const
if (!data_end)
data_end = data + strlen (data);
lines_chunk = g_string_chunk_new (100 * 1024);
lines = stf_parse_general (parseoptions, lines_chunk, data, data_end,
SHEET_MAX_ROWS);
lines = stf_parse_general (parseoptions, lines_chunk, data, data_end);
for (row = 0; row < lines->len; row++) {
GPtrArray *line = g_ptr_array_index (lines, row);
unsigned int col, targetcol = 0;
......
......@@ -102,8 +102,7 @@ int stf_parse_options_fixed_splitpositions_nth (StfParseOptions_t *parse
GPtrArray *stf_parse_general (StfParseOptions_t *parseoptions,
GStringChunk *lines_chunk,
char const *data,
char const *data_end,
int maxlines);
char const *data_end);
void stf_parse_general_free (GPtrArray *lines);
GPtrArray *stf_parse_lines (StfParseOptions_t *parseoptions,
GStringChunk *lines_chunk,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment