[gnumeric] ADDRESS: Fix previous fix.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ADDRESS: Fix previous fix.
- Date: Fri, 9 Jan 2015 18:16:28 +0000 (UTC)
commit 807af15aecb231fe86ddc4768c88efd11f3f5394
Author: Morten Welinder <terra gnome org>
Date: Fri Jan 9 13:15:35 2015 -0500
ADDRESS: Fix previous fix.
The sheet name is basically a dumb string that'll get prepended to the
result, except that sometimes it will be quoted.
NEWS | 1 +
plugins/fn-lookup/ChangeLog | 5 +++++
plugins/fn-lookup/functions.c | 27 +++++++++++++--------------
3 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/NEWS b/NEWS
index af2bc45..ab8537b 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ Morten:
* Fix GNM_HALIGN_DISTRIBUTED rendering. [#726155]
* Restore translations of function help texts.
* Fix import of extended float formula results from wk4 files.
+ * Fix ADDRESS problem.
Thomas Kluyver:
* Fix import of extended floats from wk4 files. [#739679]
diff --git a/plugins/fn-lookup/ChangeLog b/plugins/fn-lookup/ChangeLog
index 281f786..2b0bcee 100644
--- a/plugins/fn-lookup/ChangeLog
+++ b/plugins/fn-lookup/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-09 Morten Welinder <terra gnome org>
+
+ * functions.c (gnumeric_address): Fix previous fix. The sheet we
+ compute is purely for the purpose of find the sheet size.
+
2015-01-03 Morten Welinder <terra gnome org>
* functions.c (gnumeric_address): Clear sheet_name when defaulting
diff --git a/plugins/fn-lookup/functions.c b/plugins/fn-lookup/functions.c
index a685116..673daee 100644
--- a/plugins/fn-lookup/functions.c
+++ b/plugins/fn-lookup/functions.c
@@ -833,9 +833,8 @@ gnumeric_address (GnmFuncEvalInfo *ei, GnmValue const * const *args)
GnmParsePos pp;
gboolean err;
int col, row;
- Sheet *sheet;
- const char *sheet_name =
- args[4] ? value_peek_string (args[4]) : NULL;
+ Sheet *sheet = NULL;
+ const char *sheet_name = args[4] ? value_peek_string (args[4]) : NULL;
switch (args[2] ? value_get_as_int (args[2]) : 1) {
case 1: case 5: ref.col_relative = ref.row_relative = FALSE; break;
@@ -853,15 +852,11 @@ gnumeric_address (GnmFuncEvalInfo *ei, GnmValue const * const *args)
return value_new_error_VALUE (ei->pos);
}
- if (sheet_name) {
+ if (sheet_name)
sheet = workbook_sheet_by_name (ei->pos->sheet->workbook,
sheet_name);
- if (!sheet) {
- /* Use evaluation sheet if named sheet does not exist. */
- sheet = ei->pos->sheet;
- sheet_name = NULL;
- }
- } else
+ /* For unknown or missing sheet, use current sheet. */
+ if (!sheet)
sheet = ei->pos->sheet;
ref.sheet = NULL;
@@ -882,6 +877,7 @@ gnumeric_address (GnmFuncEvalInfo *ei, GnmValue const * const *args)
if (err)
return value_new_error_VALUE (ei->pos);
}
+
if (col < 0 || col >= gnm_sheet_get_max_cols (sheet))
return value_new_error_VALUE (ei->pos);
if (row < 0 || row >= gnm_sheet_get_max_rows (sheet))
@@ -890,10 +886,13 @@ gnumeric_address (GnmFuncEvalInfo *ei, GnmValue const * const *args)
if (!out.convs->r1c1_addresses)
pp.eval.col = pp.eval.row = 0;
- if (sheet_name) {
- out.accum = gnm_expr_conv_quote (gnm_conventions_default,
- sheet_name);
- g_string_append_c (out.accum, '!');
+ if (sheet_name && sheet_name[0]) {
+ out.accum = gnm_expr_conv_quote (out.convs, sheet_name);
+ g_string_append_c (out.accum, out.convs->sheet_name_sep);
+ } else if (sheet_name) {
+ /* A crazy case. Invalid name, but ends up unquoted. */
+ out.accum = g_string_new (NULL);
+ g_string_append_c (out.accum, out.convs->sheet_name_sep);
} else
out.accum = g_string_new (NULL);
cellref_as_string (&out, &ref, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]