[gnumeric] Compilation: Constify GOFormat handling.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Compilation: Constify GOFormat handling.
- Date: Tue, 16 Nov 2010 20:45:42 +0000 (UTC)
commit ae6bbccaae5d4971a8c465d7d38cded78e2d0789
Author: Morten Welinder <terra gnome org>
Date: Tue Nov 16 15:45:25 2010 -0500
Compilation: Constify GOFormat handling.
ChangeLog | 4 ++++
plugins/excel/ms-excel-xf.h | 2 +-
plugins/openoffice/openoffice-write.c | 4 ++--
src/auto-format.c | 16 ++++++++--------
src/auto-format.h | 4 ++--
src/commands.c | 2 +-
src/dialogs/dialog-function-select.c | 2 +-
src/dialogs/dialog-goal-seek.c | 2 +-
src/dialogs/dialog-tabulate.c | 2 +-
src/gnm-style-impl.h | 2 +-
src/graph.c | 2 +-
src/gui-util.c | 9 +++++----
src/gui-util.h | 13 +++++++++----
src/mstyle.c | 4 ++--
src/mstyle.h | 2 +-
src/stf-parse.c | 2 +-
src/workbook-view.c | 2 +-
17 files changed, 42 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7ce6165..5b12e10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-16 Morten Welinder <terra gnome org>
+
+ * src/*.c: Constify GOFormat handling.
+
2010-11-15 Morten Welinder <terra gnome org>
* src/gui-file.c (gui_file_save_as): Clear "pristine" flag. Fixes
diff --git a/plugins/excel/ms-excel-xf.h b/plugins/excel/ms-excel-xf.h
index 39b861a..ab746cd 100644
--- a/plugins/excel/ms-excel-xf.h
+++ b/plugins/excel/ms-excel-xf.h
@@ -28,7 +28,7 @@
typedef struct _BiffXFData {
guint16 font_idx;
guint16 format_idx;
- GOFormat *style_format;
+ GOFormat const *style_format;
gboolean is_simple_format;
gboolean hidden;
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 184562c..f6a19ed 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -1308,7 +1308,7 @@ odf_write_style_text_properties (GnmOOExport *state, GnmStyle const *style)
static void
-odf_write_style_goformat_name (GnmOOExport *state, GOFormat *gof)
+odf_write_style_goformat_name (GnmOOExport *state, GOFormat const *gof)
{
char const *name;
@@ -1447,7 +1447,7 @@ odf_write_style (GnmOOExport *state, GnmStyle const *style, gboolean is_default)
guint i;
if ((!is_default) && gnm_style_is_element_set (style, MSTYLE_FORMAT)) {
- GOFormat *format = gnm_style_get_format(style);
+ GOFormat const *format = gnm_style_get_format(style);
if (format != NULL)
odf_write_style_goformat_name (state, format);
}
diff --git a/src/auto-format.c b/src/auto-format.c
index f84a048..af1f235 100644
--- a/src/auto-format.c
+++ b/src/auto-format.c
@@ -62,9 +62,9 @@
static GnmFuncFlags do_af_suggest_list (int argc,
GnmExprConstPtr const *argv,
GnmEvalPos const *epos,
- GOFormat **explicit);
+ GOFormat const **explicit);
-struct cb_af_suggest { GnmFuncFlags typ; GOFormat **explicit; };
+struct cb_af_suggest { GnmFuncFlags typ; GOFormat const **explicit; };
static GnmValue *
cb_af_suggest (GnmCellIter const *iter, gpointer user)
@@ -80,14 +80,14 @@ cb_af_suggest (GnmCellIter const *iter, gpointer user)
}
static gboolean
-is_date (GnmFuncFlags typ, GOFormat *explicit)
+is_date (GnmFuncFlags typ, GOFormat const *explicit)
{
return (typ == GNM_FUNC_AUTO_DATE ||
(typ == AF_EXPLICIT && go_format_is_date (explicit)));
}
static GnmFuncFlags
-do_af_suggest (GnmExpr const *expr, GnmEvalPos const *epos, GOFormat **explicit)
+do_af_suggest (GnmExpr const *expr, GnmEvalPos const *epos, GOFormat const **explicit)
{
#if 0
{
@@ -122,7 +122,7 @@ do_af_suggest (GnmExpr const *expr, GnmEvalPos const *epos, GOFormat **explicit)
case GNM_EXPR_OP_SUB: {
GnmFuncFlags typ1, typ2;
- GOFormat *explicit1 = NULL, *explicit2 = NULL;
+ GOFormat const *explicit1 = NULL, *explicit2 = NULL;
typ1 = do_af_suggest (expr->binary.value_a, epos, &explicit1);
typ2 = do_af_suggest (expr->binary.value_b, epos, &explicit2);
@@ -231,7 +231,7 @@ do_af_suggest (GnmExpr const *expr, GnmEvalPos const *epos, GOFormat **explicit)
static GnmFuncFlags
do_af_suggest_list (int argc, GnmExprConstPtr const *argv,
- GnmEvalPos const *epos, GOFormat **explicit)
+ GnmEvalPos const *epos, GOFormat const **explicit)
{
int i;
@@ -247,10 +247,10 @@ do_af_suggest_list (int argc, GnmExprConstPtr const *argv,
/* ------------------------------------------------------------------------- */
-GOFormat *
+GOFormat const *
auto_style_format_suggest (GnmExprTop const *texpr, GnmEvalPos const *epos)
{
- GOFormat *explicit = NULL;
+ GOFormat const *explicit = NULL;
g_return_val_if_fail (texpr != NULL, NULL);
g_return_val_if_fail (epos != NULL, NULL);
diff --git a/src/auto-format.h b/src/auto-format.h
index 4329243..139b6fc 100644
--- a/src/auto-format.h
+++ b/src/auto-format.h
@@ -6,8 +6,8 @@
G_BEGIN_DECLS
-GOFormat *auto_style_format_suggest (GnmExprTop const *texpr,
- GnmEvalPos const *epos);
+GOFormat const *auto_style_format_suggest (GnmExprTop const *texpr,
+ GnmEvalPos const *epos);
G_END_DECLS
diff --git a/src/commands.c b/src/commands.c
index e8039b8..814d829 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -831,7 +831,7 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
sheet_get_conventions (sheet), NULL);
if (texpr != NULL) {
- GOFormat *sf;
+ GOFormat const *sf;
GnmStyle *new_style = NULL;
gboolean same_texpr = TRUE;
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index ae5a25f..8930f1c 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -644,7 +644,7 @@ make_expr_example (Sheet *sheet, const char *text, gboolean localized)
char *etxt = gnm_expr_top_as_string (texpr, &pp, convs);
GnmValue *val = gnm_expr_top_eval
(texpr, &ep, GNM_EXPR_EVAL_PERMIT_NON_SCALAR);
- GOFormat *format = auto_style_format_suggest (texpr, &ep);
+ GOFormat const *format = auto_style_format_suggest (texpr, &ep);
char *vtxt = format_value(format, val, NULL, -1,
workbook_date_conv (sheet->workbook));
diff --git a/src/dialogs/dialog-goal-seek.c b/src/dialogs/dialog-goal-seek.c
index a6620a8..678b4b1 100644
--- a/src/dialogs/dialog-goal-seek.c
+++ b/src/dialogs/dialog-goal-seek.c
@@ -314,7 +314,7 @@ cb_dialog_apply_clicked (G_GNUC_UNUSED GtkWidget *button,
GoalSeekStatus status;
GnmValue *target;
GnmRangeRef const *r;
- GOFormat *format;
+ GOFormat const *format;
if (state->warning_dialog != NULL)
gtk_widget_destroy (state->warning_dialog);
diff --git a/src/dialogs/dialog-tabulate.c b/src/dialogs/dialog-tabulate.c
index 113c432..2c1d0bb 100644
--- a/src/dialogs/dialog-tabulate.c
+++ b/src/dialogs/dialog-tabulate.c
@@ -144,7 +144,7 @@ get_table_float_entry (GtkTable *t, int y, int x, GnmCell *cell, gnm_float *numb
GtkEntry **wp, gboolean with_default, gnm_float default_float)
{
GList *l;
- GOFormat *format;
+ GOFormat const *format;
GList *children = gtk_container_get_children (GTK_CONTAINER (t));
int res = 3;
diff --git a/src/gnm-style-impl.h b/src/gnm-style-impl.h
index 6d31a9f..5b3a815 100644
--- a/src/gnm-style-impl.h
+++ b/src/gnm-style-impl.h
@@ -48,7 +48,7 @@ struct _GnmStyle {
double size;
} font_detail;
- GOFormat *format;
+ GOFormat const *format;
GnmHAlign h_align;
GnmVAlign v_align;
int indent;
diff --git a/src/graph.c b/src/graph.c
index 731d5f6..1281a71 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -166,7 +166,7 @@ gnm_go_data_preferred_fmt (GOData const *dat)
eval_pos_init_dep (&ep, dep);
return dep->texpr
- ? auto_style_format_suggest (dep->texpr, &ep)
+ ? (GOFormat *)auto_style_format_suggest (dep->texpr, &ep)
: NULL;
}
diff --git a/src/gui-util.c b/src/gui-util.c
index 0c569d1..d0ca406 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -1030,8 +1030,9 @@ focus_on_entry (GtkEntry *entry)
}
gboolean
-entry_to_float_with_format_default (GtkEntry *entry, gnm_float *the_float, gboolean update,
- GOFormat *format, gnm_float num)
+entry_to_float_with_format_default (GtkEntry *entry, gnm_float *the_float,
+ gboolean update,
+ GOFormat const *format, gnm_float num)
{
char const *text = gtk_entry_get_text (entry);
gboolean need_default = (text == NULL);
@@ -1054,8 +1055,8 @@ entry_to_float_with_format_default (GtkEntry *entry, gnm_float *the_float, gbool
}
gboolean
-entry_to_float_with_format (GtkEntry *entry, gnm_float *the_float, gboolean update,
- GOFormat *format)
+entry_to_float_with_format (GtkEntry *entry, gnm_float *the_float,
+ gboolean update, GOFormat const *format)
{
GnmValue *value = format_match_number (gtk_entry_get_text (entry), format, NULL);
diff --git a/src/gui-util.h b/src/gui-util.h
index 9894757..39ec9ef 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -91,10 +91,15 @@ void focus_on_entry (GtkEntry *entry);
* We should be passing in a DateConvention */
#define entry_to_float(entry, the_float, update) \
entry_to_float_with_format (entry, the_float, update, NULL)
-gboolean entry_to_float_with_format (GtkEntry *entry, gnm_float *the_float, gboolean update,
- GOFormat *format);
-gboolean entry_to_float_with_format_default (GtkEntry *entry, gnm_float *the_float, gboolean update,
- GOFormat *format, gnm_float num);
+gboolean entry_to_float_with_format (GtkEntry *entry,
+ gnm_float *the_float,
+ gboolean update,
+ GOFormat const *format);
+gboolean entry_to_float_with_format_default (GtkEntry *entry,
+ gnm_float *the_float,
+ gboolean update,
+ GOFormat const *format,
+ gnm_float num);
gboolean entry_to_int (GtkEntry *entry, gint *the_int, gboolean update);
void float_to_entry (GtkEntry *entry, gnm_float the_float);
void int_to_entry (GtkEntry *entry, gint the_int);
diff --git a/src/mstyle.c b/src/mstyle.c
index e117f00..f540242 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -1312,7 +1312,7 @@ gnm_style_set_format (GnmStyle *style, GOFormat const *format)
go_format_ref (format);
elem_clear_contents (style, MSTYLE_FORMAT);
elem_set (style, MSTYLE_FORMAT);
- style->format = (GOFormat *)format;
+ style->format = format;
}
/*
@@ -1334,7 +1334,7 @@ gnm_style_set_format_text (GnmStyle *style, char const *format)
go_format_unref (sf);
}
-GOFormat *
+const GOFormat *
gnm_style_get_format (GnmStyle const *style)
{
g_return_val_if_fail (style != NULL, NULL);
diff --git a/src/mstyle.h b/src/mstyle.h
index a19d9b8..b16ce41 100644
--- a/src/mstyle.h
+++ b/src/mstyle.h
@@ -118,7 +118,7 @@ GnmFont *gnm_style_get_font (GnmStyle const *style,
PangoContext *context);
void gnm_style_set_format (GnmStyle *style, GOFormat const *fmt);
void gnm_style_set_format_text (GnmStyle *style, char const *fmt);
-GOFormat *gnm_style_get_format (GnmStyle const *style);
+GOFormat const*gnm_style_get_format (GnmStyle const *style);
void gnm_style_set_align_h (GnmStyle *style, GnmHAlign a);
GnmHAlign gnm_style_get_align_h (GnmStyle const *style);
void gnm_style_set_align_v (GnmStyle *style, GnmVAlign a);
diff --git a/src/stf-parse.c b/src/stf-parse.c
index be066a9..b39607a 100644
--- a/src/stf-parse.c
+++ b/src/stf-parse.c
@@ -1187,7 +1187,7 @@ stf_cell_set_text (GnmCell *cell, char const *text)
{
GnmExprTop const *texpr;
GnmValue *val;
- GOFormat *fmt = gnm_style_get_format (gnm_cell_get_style (cell));
+ GOFormat const *fmt = gnm_style_get_format (gnm_cell_get_style (cell));
const GODateConventions *date_conv =
workbook_date_conv (cell->base.sheet->workbook);
diff --git a/src/workbook-view.c b/src/workbook-view.c
index a47209c..fc664fa 100644
--- a/src/workbook-view.c
+++ b/src/workbook-view.c
@@ -517,7 +517,7 @@ wb_view_auto_expr_recalc (WorkbookView *wbv)
if (v) {
GString *str = g_string_new (wbv->auto_expr_descr);
GOFormat const *format = NULL;
- GOFormat *tmp_format = NULL;
+ GOFormat const *tmp_format = NULL;
PangoAttrList *attrs;
g_string_append_c (str, '=');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]