Commit dd4a1442 authored by Arturo Espinosa's avatar Arturo Espinosa

Wide use of const in gnumeric now, thanks to Morten Welinder

parent 73aafe07
Fri Apr 23 17:52:44 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy): Don't check that workbook is
NULL because it cb_sheet_do_destroy will call it non-NULL.
* src/workbook.c (cb_sheet_do_destroy): Don't NULL workbook
member as it will be used.
* src/format.c (render_number): Fix rounding up.
* src/*.[chy]: add tons on "const"s.
1999-04-23 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-stat.c: Added GAMMADIST() function. It uses pgamma()
......
Fri Apr 23 17:52:44 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy): Don't check that workbook is
NULL because it cb_sheet_do_destroy will call it non-NULL.
* src/workbook.c (cb_sheet_do_destroy): Don't NULL workbook
member as it will be used.
* src/format.c (render_number): Fix rounding up.
* src/*.[chy]: add tons on "const"s.
1999-04-23 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-stat.c: Added GAMMADIST() function. It uses pgamma()
......
Fri Apr 23 17:52:44 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy): Don't check that workbook is
NULL because it cb_sheet_do_destroy will call it non-NULL.
* src/workbook.c (cb_sheet_do_destroy): Don't NULL workbook
member as it will be used.
* src/format.c (render_number): Fix rounding up.
* src/*.[chy]: add tons on "const"s.
1999-04-23 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-stat.c: Added GAMMADIST() function. It uses pgamma()
......
Fri Apr 23 17:52:44 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy): Don't check that workbook is
NULL because it cb_sheet_do_destroy will call it non-NULL.
* src/workbook.c (cb_sheet_do_destroy): Don't NULL workbook
member as it will be used.
* src/format.c (render_number): Fix rounding up.
* src/*.[chy]: add tons on "const"s.
1999-04-23 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-stat.c: Added GAMMADIST() function. It uses pgamma()
......
......@@ -37,7 +37,7 @@ cell_modified (Cell *cell)
}
void
cell_set_formula (Cell *cell, char *text)
cell_set_formula (Cell *cell, const char *text)
{
char *error_msg = _("ERROR");
char *desired_format = NULL;
......@@ -147,7 +147,7 @@ cell_set_font_from_style (Cell *cell, StyleFont *style_font)
}
void
cell_set_font (Cell *cell, char *font_name)
cell_set_font (Cell *cell, const char *font_name)
{
StyleFont *style_font;
......@@ -491,7 +491,7 @@ cell_set_border (Cell *cell,
* it recomputes the bounding box for the cell as well
*/
void
cell_set_rendered_text (Cell *cell, char *rendered_text)
cell_set_rendered_text (Cell *cell, const char *rendered_text)
{
String *oldtext;
......@@ -549,7 +549,7 @@ cell_render_value (Cell *cell)
* yourself.
*/
void
cell_set_text_simple (Cell *cell, char *text)
cell_set_text_simple (Cell *cell, const char *text)
{
struct lconv *lconv;
......@@ -580,7 +580,7 @@ cell_set_text_simple (Cell *cell, char *text)
Value *v = g_new (Value, 1);
int is_text, is_float, maybe_float, has_digits;
int seen_exp;
char *p;
const char *p;
lconv = localeconv ();
......@@ -673,7 +673,7 @@ cell_content_changed (Cell *cell)
* Changes the content of a cell
*/
void
cell_set_text (Cell *cell, char *text)
cell_set_text (Cell *cell, const char *text)
{
g_return_if_fail (cell != NULL);
g_return_if_fail (text != NULL);
......@@ -740,7 +740,7 @@ cell_set_formula_tree (Cell *cell, ExprTree *formula)
* fields are set to NULL.
*/
Cell *
cell_copy (Cell *cell)
cell_copy (const Cell *cell)
{
Cell *new_cell;
......@@ -864,7 +864,7 @@ cell_queue_redraw (Cell *cell)
* Make sure you queue a draw in the future for this cell.
*/
void
cell_set_format_simple (Cell *cell, char *format)
cell_set_format_simple (Cell *cell, const char *format)
{
g_return_if_fail (cell != NULL);
g_return_if_fail (format != NULL);
......@@ -886,7 +886,7 @@ cell_set_format_simple (Cell *cell, char *format)
* a number display format as specified on the manual
*/
void
cell_set_format (Cell *cell, char *format)
cell_set_format (Cell *cell, const char *format)
{
g_return_if_fail (cell != NULL);
......@@ -985,7 +985,7 @@ cell_make_value (Cell *cell)
}
int
cell_get_horizontal_align (Cell *cell)
cell_get_horizontal_align (const Cell *cell)
{
g_return_val_if_fail (cell != NULL, HALIGN_LEFT);
......@@ -1003,7 +1003,7 @@ cell_get_horizontal_align (Cell *cell)
}
static inline int
cell_is_number (Cell *cell)
cell_is_number (const Cell *cell)
{
if (cell->value)
if (cell->value->type == VALUE_FLOAT || cell->value->type == VALUE_INTEGER)
......@@ -1013,7 +1013,7 @@ cell_is_number (Cell *cell)
}
static inline int
cell_contents_fit_inside_column (Cell *cell)
cell_contents_fit_inside_column (const Cell *cell)
{
if (cell->width < COL_INTERNAL_WIDTH (cell->col))
return TRUE;
......@@ -1187,7 +1187,7 @@ cell_get_span (Cell *cell, int *col1, int *col2)
* constraints in the style using the font specified on the style.
*/
void
calc_text_dimensions (int is_number, Style *style, char *text, int cell_w, int cell_h, int *h, int *w)
calc_text_dimensions (int is_number, Style *style, const char *text, int cell_w, int cell_h, int *h, int *w)
{
GdkFont *font = style->font->font;
int text_width, font_height;
......@@ -1204,9 +1204,9 @@ calc_text_dimensions (int is_number, Style *style, char *text, int cell_w, int c
if (style->halign == HALIGN_JUSTIFY ||
style->valign == VALIGN_JUSTIFY ||
style->fit_in_cell){
char *ideal_cut_spot = NULL;
const char *ideal_cut_spot = NULL;
int used, last_was_cut_point;
char *p = text;
const char *p = text;
*w = cell_w;
*h = font_height;
......@@ -1309,10 +1309,10 @@ draw_overflow (GdkDrawable *drawable, GdkGC *gc, GdkFont *font, int x1, int y1,
}
static GList *
cell_split_text (GdkFont *font, char *text, int width)
cell_split_text (GdkFont *font, const char *text, int width)
{
GList *list;
char *p, *line, *line_begin, *ideal_cut_spot = NULL;
const char *p, *line_begin, *ideal_cut_spot = NULL;
int line_len, used, last_was_cut_point;
list = NULL;
......@@ -1328,7 +1328,8 @@ cell_split_text (GdkFont *font, char *text, int width)
/* If we have overflowed, do the wrap */
if (used + len > width){
char *begin = line_begin;
const char *begin = line_begin;
char *line;
if (ideal_cut_spot){
int n = p - ideal_cut_spot + 1;
......@@ -1357,6 +1358,7 @@ cell_split_text (GdkFont *font, char *text, int width)
last_was_cut_point = FALSE;
}
if (*line_begin){
char *line;
line_len = p - line_begin;
line = g_malloc (line_len+1);
memcpy (line, line_begin, line_len);
......
......@@ -104,16 +104,16 @@ typedef struct {
char *value_format (Value *value, StyleFormat *format, char **color);
void cell_set_text (Cell *cell, char *text);
void cell_set_text_simple (Cell *cell, char *text);
void cell_set_text (Cell *cell, const char *text);
void cell_set_text_simple (Cell *cell, const char *text);
void cell_content_changed (Cell *cell);
void cell_set_formula (Cell *cell, char *text);
void cell_set_formula (Cell *cell, const char *text);
void cell_set_formula_tree (Cell *cell, ExprTree *formula);
void cell_set_formula_tree_simple (Cell *cell, ExprTree *formula);
void cell_set_format (Cell *cell, char *format);
void cell_set_format_simple (Cell *cell, char *format);
void cell_set_format (Cell *cell, const char *format);
void cell_set_format_simple (Cell *cell, const char *format);
void cell_set_format_from_style (Cell *cell, StyleFormat *style_format);
void cell_set_font (Cell *cell, char *font_name);
void cell_set_font (Cell *cell, const char *font_name);
void cell_set_style (Cell *cell, Style *reference_style);
void cell_set_comment (Cell *cell, char *str);
void cell_comment_destroy (Cell *cell);
......@@ -132,7 +132,7 @@ void cell_set_border (Cell *cell,
void cell_set_alignment (Cell *cell, int halign, int valign,
int orientation, int auto_return);
void cell_set_halign (Cell *cell, StyleHAlignFlags halign);
void cell_set_rendered_text (Cell *cell, char *rendered_text);
void cell_set_rendered_text (Cell *cell, const char *rendered_text);
void cell_relocate (Cell *cell,
int col_diff, int row_diff);
void cell_get_span (Cell *cell, int *col1, int *col2);
......@@ -142,17 +142,17 @@ char *cell_get_value_as_text (Cell *cell);
void cell_make_value (Cell *cell);
void cell_render_value (Cell *cell);
void cell_calc_dimensions (Cell *cell);
Cell *cell_copy (Cell *cell);
Cell *cell_copy (const Cell *cell);
void cell_destroy (Cell *cell);
void cell_formula_changed (Cell *cell);
void cell_queue_redraw (Cell *cell);
int cell_get_horizontal_align (Cell *cell);
int cell_get_horizontal_align (const Cell *cell);
int cell_draw (Cell *cell, void *sheet_view,
GdkGC *gc, GdkDrawable *drawable,
int x, int y);
void calc_text_dimensions (int is_number, Style *style, char *text,
void calc_text_dimensions (int is_number, Style *style, const char *text,
int cell_w, int cell_h, int *h, int *w);
void cell_realize (Cell *cell);
......
......@@ -37,7 +37,7 @@ color_alloc_gdk (GdkColor *c)
}
void
color_alloc_name (char *name, GdkColor *c)
color_alloc_name (const char *name, GdkColor *c)
{
int failed;
......
......@@ -5,7 +5,7 @@ void color_init (void);
/* Return the pixel value for the given red, green and blue */
int color_alloc (gushort red, gushort green, gushort blue);
void color_alloc_name (char *name, GdkColor *color);
void color_alloc_name (const char *name, GdkColor *color);
void color_alloc_gdk (GdkColor *color);
/* Colors used by any GnumericSheet item */
......
......@@ -9,7 +9,7 @@
#include <gnome.h>
#include "dates.h"
char *day_short [] =
const char *day_short [] =
{
N_("*Sun"),
N_("*Mon"),
......@@ -21,7 +21,7 @@ char *day_short [] =
NULL,
};
char *day_long [] =
const char *day_long [] =
{
N_("Sunday"),
N_("Monday"),
......@@ -33,7 +33,7 @@ char *day_long [] =
NULL
};
char *month_short [] =
const char *month_short [] =
{
N_("*Jan"),
N_("*Feb"),
......@@ -50,7 +50,7 @@ char *month_short [] =
NULL
};
char *month_long [] =
const char *month_long [] =
{
N_("January"),
N_("February"),
......
#ifndef GNUMERIC_DATES_H
#define GNUMERIC_DATES_H
extern char *day_short [];
extern char *day_long [];
extern char *month_short [];
extern char *month_long [];
extern const char *day_short [];
extern const char *day_long [];
extern const char *month_short [];
extern const char *month_long [];
#endif
......@@ -53,4 +53,3 @@ void cell_unqueue_from_recalc (Cell *cell);
void cell_eval (Cell *cell);
#endif /* GNUMERIC_EVAL_H */
......@@ -60,8 +60,8 @@ make_radio_notify_change (GSList *list, GtkWidget *prop_win)
}
static struct {
char *name;
char **formats;
const char *name;
const char *const *formats;
} cell_formats [] = {
{ N_("Numbers"), cell_format_numbers },
{ N_("Accounting"), cell_format_accounting },
......@@ -79,7 +79,7 @@ static void
format_list_fill (int n)
{
GtkCList *cl = GTK_CLIST (number_format_list);
char **texts;
const char *const *texts;
int i;
g_return_if_fail (n >= 0);
......@@ -105,10 +105,10 @@ format_list_fill (int n)
* format that applies to this cell
*/
static int
format_find (char *format)
format_find (const char *format)
{
int i, row;
char **p;
const char *const *p;
for (i = 0; cell_formats [i].name; i++){
p = cell_formats [i].formats;
......
......@@ -25,7 +25,7 @@ typedef struct {
} ORDER_BOX;
static ORDER_BOX *
order_box_new(GtkWidget * parent, char *frame_text, char *default_text)
order_box_new(GtkWidget * parent, const char *frame_text, const char *default_text)
{
ORDER_BOX *this = g_new(ORDER_BOX, 1);
GtkWidget *box = gtk_hbox_new(0, 0);
......
......@@ -163,7 +163,7 @@ dialog_found_solution (int set_cell_col, int set_cell_row,
GtkWidget *target_label;
GtkWidget *current_label;
char *name;
const char *name;
char status_str[256];
char target_str[256];
char current_str[256];
......@@ -221,7 +221,7 @@ dialog_goal_seek (Workbook *wb, Sheet *sheet)
static GtkWidget *label_box;
static GtkWidget *entry_box;
char *set_entry_str;
const char *set_entry_str;
char *text;
int selection;
float_t old_value;
......
......@@ -15,7 +15,7 @@
/* Different constraint types */
static char *constraint_strs[] = {
static const char *constraint_strs[] = {
N_("<="),
N_("="),
N_(">="),
......@@ -26,7 +26,7 @@ static char *constraint_strs[] = {
static struct {
char *name;
const char *name;
int disables_second_group;
} paste_types [] = {
{ N_("All"), 0 },
......@@ -36,37 +36,37 @@ static struct {
{ NULL, 0 }
};
static char *equal_ops [] = {
static const char *equal_ops [] = {
N_("Max"),
N_("Min"),
NULL
};
static char *estimate_ops [] = {
static const char *estimate_ops [] = {
N_("Tangent"),
N_("Quadratic"),
NULL
};
static char *derivative_ops [] = {
static const char *derivative_ops [] = {
N_("Forward"),
N_("Central"),
NULL
};
static char *search_ops [] = {
static const char *search_ops [] = {
N_("Newton"),
N_("Conjugate"),
NULL
};
static char *check_button_left_ops [] = {
static const char *check_button_left_ops [] = {
N_("Assume Linear Model"),
N_("Assume Non-Negative"),
NULL
};
static char *check_button_right_ops [] = {
static const char *check_button_right_ops [] = {
N_("Use Automatic Scaling"),
N_("Show Iteration Results"),
NULL
......@@ -74,7 +74,7 @@ static char *check_button_right_ops [] = {
static GSList *
add_radio_buttons (GtkWidget *hbox, char *title, char *ops[])
add_radio_buttons (GtkWidget *hbox, const char *title, const char *ops[])
{
GtkWidget *f, *fv;
GSList *group_ops = NULL;
......@@ -98,7 +98,7 @@ add_radio_buttons (GtkWidget *hbox, char *title, char *ops[])
}
static void
add_check_buttons (GtkWidget *box, char *ops[])
add_check_buttons (GtkWidget *box, const char *ops[])
{
GtkWidget *button;
int i;
......@@ -111,7 +111,7 @@ add_check_buttons (GtkWidget *box, char *ops[])
static GList *
add_strings_to_glist (char *strs[])
add_strings_to_glist (const char *strs[])
{
int i;
GList *list = NULL;
......@@ -339,7 +339,7 @@ dialog_solver (Workbook *wb, Sheet *sheet)
constraint_dialog_t constraint_dialog;
char *text, *target_entry_str;
const char *text, *target_entry_str;
int selection, sel_equal_to;
Cell *target_cell;
CellList *input_cells;
......
......@@ -60,8 +60,8 @@ make_radio_notify_change (GSList *list, GtkWidget *prop_win)
}
static struct {
char *name;
char **formats;
const char *name;
const char *const *formats;
} cell_formats [] = {
{ N_("Numbers"), cell_format_numbers },
{ N_("Accounting"), cell_format_accounting },
......@@ -79,7 +79,7 @@ static void
format_list_fill (int n)
{
GtkCList *cl = GTK_CLIST (number_format_list);
char **texts;
const char *const *texts;
int i;
g_return_if_fail (n >= 0);
......@@ -105,10 +105,10 @@ format_list_fill (int n)
* format that applies to this cell
*/
static int
format_find (char *format)
format_find (const char *format)
{
int i, row;
char **p;
const char *const *p;
for (i = 0; cell_formats [i].name; i++){
p = cell_formats [i].formats;
......
......@@ -25,7 +25,7 @@ typedef struct {
} ORDER_BOX;
static ORDER_BOX *
order_box_new(GtkWidget * parent, char *frame_text, char *default_text)
order_box_new(GtkWidget * parent, const char *frame_text, const char *default_text)
{
ORDER_BOX *this = g_new(ORDER_BOX, 1);
GtkWidget *box = gtk_hbox_new(0, 0);
......
......@@ -163,7 +163,7 @@ dialog_found_solution (int set_cell_col, int set_cell_row,
GtkWidget *target_label;
GtkWidget *current_label;
char *name;
const char *name;
char status_str[256];
char target_str[256];
char current_str[256];
......@@ -221,7 +221,7 @@ dialog_goal_seek (Workbook *wb, Sheet *sheet)
static GtkWidget *label_box;
static GtkWidget *entry_box;
char *set_entry_str;
const char *set_entry_str;
char *text;
int selection;
float_t old_value;
......
......@@ -15,7 +15,7 @@
/* Different constraint types */
static char *constraint_strs[] = {
static const char *constraint_strs[] = {
N_("<="),
N_("="),
N_(">="),
......@@ -26,7 +26,7 @@ static char *constraint_strs[] = {
static struct {
char *name;
const char *name;
int disables_second_group;
} paste_types [] = {
{ N_("All"), 0 },
......@@ -36,37 +36,37 @@ static struct {
{ NULL, 0 }
};
static char *equal_ops [] = {
static const char *equal_ops [] = {
N_("Max"),
N_("Min"),
NULL
};
static char *estimate_ops [] = {
static const char *estimate_ops [] = {
N_("Tangent"),
N_("Quadratic"),
NULL
};
static char *derivative_ops [] = {
static const char *derivative_ops [] = {
N_("Forward"),
N_("Central"),
NULL
};
static char *search_ops [] = {
static const char *search_ops [] = {
N_("Newton"),
N_("Conjugate"),
NULL
};
static char *check_button_left_ops [] = {
static const char *check_button_left_ops [] = {
N_("Assume Linear Model"),
N_("Assume Non-Negative"),
NULL
};
static char *check_button_right_ops [] = {
static const char *check_button_right_ops [] = {
N_("Use Automatic Scaling"),
N_("Show Iteration Results"),
NULL
......@@ -74,7 +74,7 @@ static char *check_button_right_ops [] = {
static GSList *
add_radio_buttons (GtkWidget *hbox, char *title, char *ops[])
add_radio_buttons (GtkWidget *hbox, const char *title, const char *ops[])
{
GtkWidget *f, *fv;
GSList *group_ops = NULL;
......@@ -98,7 +98,7 @@ add_radio_buttons (GtkWidget *hbox, char *title, char *ops[])
}
static void
add_check_buttons (GtkWidget *box, char *ops[])
add_check_buttons (GtkWidget *box, const char *ops[])
{
GtkWidget *button;
int i;
......@@ -111,7 +111,7 @@ add_check_buttons (GtkWidget *box, char *ops[])
static GList *