[gnumeric] compilation: use double or gnm_float as appropriate, not float.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] compilation: use double or gnm_float as appropriate, not float.
- Date: Wed, 18 Nov 2009 18:31:11 +0000 (UTC)
commit 7cd9c5562ccd9be1b3a57378d5902c6213946df7
Author: Morten Welinder <terra gnome org>
Date: Wed Nov 18 13:30:45 2009 -0500
compilation: use double or gnm_float as appropriate, not float.
plugins/excel/ms-excel-write.c | 12 +++---
plugins/excel/xlsx-read.c | 10 ++---
plugins/excel/xlsx-write.c | 2 +-
plugins/mps/mps.c | 2 +-
plugins/openoffice/openoffice-write.c | 4 +-
src/colrow.h | 6 ++--
src/dialogs/dialog-col-width.c | 2 +-
src/dialogs/dialog-row-height.c | 2 +-
src/func.h | 2 +-
src/gnm-so-filled.c | 2 +-
src/gnm-style-impl.h | 4 +-
src/io-context-gtk.c | 18 +++++----
src/mstyle.c | 10 +++---
src/mstyle.h | 8 ++--
src/parser.y | 4 +-
src/print-cell.c | 6 ++--
src/print.c | 2 +-
src/sheet-control-gui.c | 5 ++-
src/sheet.c | 4 +-
src/test-token.c | 63 ---------------------------------
src/tools/dao.c | 4 +-
21 files changed, 55 insertions(+), 117 deletions(-)
---
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index eab26f4..61a2f2e 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -659,8 +659,8 @@ static void
excel_write_WINDOW1 (BiffPut *bp, WorkbookView const *wb_view)
{
guint8 *data = ms_biff_put_len_next (bp, BIFF_WINDOW1, 18);
- float hdpi = gnm_app_display_dpi_get (TRUE) / (72. * 20.);
- float vdpi = gnm_app_display_dpi_get (FALSE) / (72. * 20.);
+ double hdpi = gnm_app_display_dpi_get (TRUE) / (72. * 20.);
+ double vdpi = gnm_app_display_dpi_get (FALSE) / (72. * 20.);
guint16 width = .5 + wb_view->preferred_width / hdpi;
guint16 height = .5 + wb_view->preferred_height / vdpi;
guint16 options = 0;
@@ -3592,7 +3592,7 @@ excel_write_margin (BiffPut *bp, guint16 op, double points)
}
static XL_font_width const *
-xl_find_fontspec (ExcelWriteSheet *esheet, float *scale)
+xl_find_fontspec (ExcelWriteSheet *esheet, double *scale)
{
/* Use the 'Normal' Style which is by definition the 0th */
GnmStyle const *def_style = esheet->ewb->base.xf.default_style;
@@ -3604,7 +3604,7 @@ static void
excel_write_DEFCOLWIDTH (BiffPut *bp, ExcelWriteSheet *esheet)
{
guint16 charwidths;
- float width, scale;
+ double width, scale;
XL_font_width const *spec = xl_find_fontspec (esheet, &scale);
/* pts to avoid problems when zooming */
@@ -3635,8 +3635,8 @@ excel_write_COLINFO (BiffPut *bp, ExcelWriteSheet *esheet, ColRowInfo const *ci,
{
guint8 *data;
guint16 charwidths, options = 0;
- float width, scale;
- float const def_width = esheet->gnum_sheet->cols.default_style.size_pts;
+ double width, scale;
+ double def_width = esheet->gnum_sheet->cols.default_style.size_pts;
XL_font_width const *spec;
if (NULL != ci) {
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index ec8ad32..9364d9d 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -508,8 +508,6 @@ attr_range (GsfXMLIn *xin, xmlChar const **attrs,
XLSX_MaxCol, XLSX_MaxRow
};
- XLSXReadState *state = (XLSXReadState *)xin->user_state;
-
g_return_val_if_fail (attrs != NULL, FALSE);
g_return_val_if_fail (attrs[0] != NULL, FALSE);
g_return_val_if_fail (attrs[1] != NULL, FALSE);
@@ -529,7 +527,7 @@ attr_datetime (GsfXMLIn *xin, xmlChar const **attrs,
{
unsigned y, m, d, h, mi, n;
GnmValue *res = NULL;
- float s;
+ gnm_float s;
g_return_val_if_fail (attrs != NULL, NULL);
g_return_val_if_fail (attrs[0] != NULL, NULL);
@@ -538,7 +536,7 @@ attr_datetime (GsfXMLIn *xin, xmlChar const **attrs,
if (strcmp (attrs[0], target))
return NULL;
- n = sscanf (attrs[1], "%u-%u-%uT%u:%u:%g",
+ n = sscanf (attrs[1], "%u-%u-%uT%u:%u:%" GNM_SCANF_g,
&y, &m, &d, &h, &mi, &s);
if (n >= 3) {
@@ -549,7 +547,7 @@ attr_datetime (GsfXMLIn *xin, xmlChar const **attrs,
unsigned d_serial = go_date_g_to_serial (&date,
workbook_date_conv (state->wb));
if (n >= 6) {
- double time_frac = h + ((double)mi / 60.) + ((double)s / 3600.);
+ double time_frac = h + (gnm_float)mi / 60 + s / 3600;
res = value_new_float (d_serial + time_frac / 24.);
value_set_fmt (res, state->date_fmt);
} else {
@@ -2392,7 +2390,7 @@ hue_to_color (int m1, int m2, int h)
}
static GOColor
-apply_tint (GOColor orig, float tint)
+apply_tint (GOColor orig, double tint)
{
int r = GO_COLOR_UINT_R (orig);
int g = GO_COLOR_UINT_G (orig);
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 6c6aaae..eba5fb0 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -661,7 +661,7 @@ static gboolean
xlsx_write_col (XLSXWriteState *state, GsfXMLOut *xml,
ColRowInfo const *ci, int first, int last, gboolean has_child)
{
- float const def_width = state->sheet->cols.default_style.size_pts;
+ double const def_width = state->sheet->cols.default_style.size_pts;
if (NULL == ci)
return has_child;
diff --git a/plugins/mps/mps.c b/plugins/mps/mps.c
index 613d806..155da5a 100644
--- a/plugins/mps/mps.c
+++ b/plugins/mps/mps.c
@@ -69,7 +69,7 @@ mps_set_cell (Sheet *sheet, int col, int row, const gchar *str)
gnm_cell_set_value (cell, value_new_string (str));
}
-/* Writes a float into a cell. */
+/* Writes a gnm_float into a cell. */
static void
mps_set_cell_float (Sheet *sheet, int col, int row, const gnm_float f)
{
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 2e36bc3..6acf17f 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -392,7 +392,7 @@ odf_add_percent (GsfXMLOut *xml, char const *id, double val)
static void
-odf_add_pt (GsfXMLOut *xml, char const *id, float l)
+odf_add_pt (GsfXMLOut *xml, char const *id, double l)
{
GString *str = g_string_new (NULL);
@@ -538,7 +538,7 @@ static char *
odf_get_border_format (GnmBorder *border)
{
GString *str = g_string_new (NULL);
- float w = gnm_style_border_get_width (border->line_type);
+ double w = gnm_style_border_get_width (border->line_type);
GnmColor *color = border->color;
char const *border_type;
diff --git a/src/colrow.h b/src/colrow.h
index 6e613e3..e314ea9 100644
--- a/src/colrow.h
+++ b/src/colrow.h
@@ -8,7 +8,7 @@ G_BEGIN_DECLS
struct _ColRowInfo {
/* Size including margins, and right grid line */
- float size_pts;
+ double size_pts;
int size_pixels;
unsigned is_default : 1;
@@ -47,11 +47,11 @@ struct _ColRowCollection {
struct _ColRowSegment {
ColRowInfo *info [COLROW_SEGMENT_SIZE];
- float size_pts;
+ double size_pts;
int size_pixels;
};
typedef struct _ColRowState {
- float size_pts;
+ double size_pts;
unsigned is_default : 1;
unsigned outline_level : 4;
unsigned is_collapsed : 1; /* Does this terminate an outline ? */
diff --git a/src/dialogs/dialog-col-width.c b/src/dialogs/dialog-col-width.c
index 8050445..514e2da 100644
--- a/src/dialogs/dialog-col-width.c
+++ b/src/dialogs/dialog-col-width.c
@@ -198,7 +198,7 @@ cb_dialog_col_width_apply_clicked (G_GNUC_UNUSED GtkWidget *button,
(GTK_TOGGLE_BUTTON (state->default_check));
if (state->set_default_value) {
- float points = value * 72./gnm_app_display_dpi_get (FALSE);
+ double points = value * 72./gnm_app_display_dpi_get (FALSE);
cmd_colrow_std_size (WORKBOOK_CONTROL (state->wbcg),
state->sheet, TRUE, points);
dialog_col_width_load_value (state);
diff --git a/src/dialogs/dialog-row-height.c b/src/dialogs/dialog-row-height.c
index e547e26..c3df547 100644
--- a/src/dialogs/dialog-row-height.c
+++ b/src/dialogs/dialog-row-height.c
@@ -196,7 +196,7 @@ cb_dialog_row_height_apply_clicked (G_GNUC_UNUSED GtkWidget *button,
(GTK_TOGGLE_BUTTON (state->default_check));
if (state->set_default_value) {
- float points = value * 72./gnm_app_display_dpi_get (TRUE);
+ double points = value * 72./gnm_app_display_dpi_get (TRUE);
cmd_colrow_std_size (WORKBOOK_CONTROL (state->wbcg),
state->sheet, FALSE, points);
dialog_row_height_load_value (state);
diff --git a/src/func.h b/src/func.h
index 25d5b99..68c77ba 100644
--- a/src/func.h
+++ b/src/func.h
@@ -48,7 +48,7 @@ GnmFuncGroup *gnm_func_group_fetch (char const *name,
* Argument tokens passed in 'args'
*
* With intersection and iteration support
- * f : float (no errors, string conversion attempted)
+ * f : floating point (no errors, string conversion attempted)
* b : boolean (identical to f, Do we need this ?)
* s : string (no errors)
* S : 'scalar': any non-error value
diff --git a/src/gnm-so-filled.c b/src/gnm-so-filled.c
index 260d7c7..f1be8d1 100644
--- a/src/gnm-so-filled.c
+++ b/src/gnm-so-filled.c
@@ -54,7 +54,7 @@ typedef struct {
char *text;
PangoAttrList *markup;
struct {
- float top, bottom, left, right;
+ double top, bottom, left, right;
} margin_pts;
} GnmSOFilled;
typedef SheetObjectClass GnmSOFilledClass;
diff --git a/src/gnm-style-impl.h b/src/gnm-style-impl.h
index 49df7f1..6d31a9f 100644
--- a/src/gnm-style-impl.h
+++ b/src/gnm-style-impl.h
@@ -22,7 +22,7 @@ struct _GnmStyle {
Sheet *linked_sheet;
PangoAttrList *pango_attrs;
- float pango_attrs_zoom;
+ double pango_attrs_zoom;
int pango_attrs_height;
GnmFont *font;
@@ -45,7 +45,7 @@ struct _GnmStyle {
GnmUnderline underline;
gboolean strikethrough;
GOFontScript script;
- float size;
+ double size;
} font_detail;
GOFormat *format;
diff --git a/src/io-context-gtk.c b/src/io-context-gtk.c
index 9bb6a84..151e60e 100644
--- a/src/io-context-gtk.c
+++ b/src/io-context-gtk.c
@@ -42,7 +42,7 @@ struct _GOIOContextGtk {
guint files_total;
guint files_done;
- gfloat progress;
+ double progress;
char *progress_msg;
gdouble latency;
@@ -146,8 +146,9 @@ icg_show_gui (IOContextGtk *icg)
gtk_progress_bar_set_orientation (
icg->file_bar, GTK_PROGRESS_LEFT_TO_RIGHT);
gtk_progress_bar_set_text (icg->file_bar, "Files");
- gtk_progress_bar_set_fraction (icg->file_bar,
- (float) icg->files_done / (float) icg->files_total);
+ gtk_progress_bar_set_fraction
+ (icg->file_bar,
+ icg->files_done / (double)icg->files_total);
gtk_box_pack_start (box, GTK_WIDGET (icg->file_bar),
FALSE, FALSE, 0);
}
@@ -188,8 +189,8 @@ static gboolean
icg_user_is_impatient (IOContextGtk *icg)
{
gdouble t = g_timer_elapsed (icg->timer, NULL);
- gfloat progress = icg->progress;
- gfloat forecast_delay = ICG_POPUP_DELAY / 3.0;
+ double progress = icg->progress;
+ double forecast_delay = ICG_POPUP_DELAY / 3.0;
gboolean ret = FALSE;
if (icg->progress == 0. && icg->files_done == 0)
@@ -204,7 +205,7 @@ icg_user_is_impatient (IOContextGtk *icg)
/* We're likely to be back shortly. */
ret = (t > ICG_POPUP_DELAY * 0.8);
} else {
- gfloat forecast = icg->latency;
+ double forecast = icg->latency;
forecast += (t - icg->latency) / progress;
ret = (forecast > ICG_POPUP_DELAY);
}
@@ -288,8 +289,9 @@ icg_processing_file (GOIOContext *ioc, char const *file)
int maxlen = 40;
if (icg->files_total > 0)
- gtk_progress_bar_set_fraction (icg->file_bar,
- (float) icg->files_done / (float) icg->files_total);
+ gtk_progress_bar_set_fraction
+ (icg->file_bar,
+ icg->files_done / (double)icg->files_total);
gtk_progress_bar_set_fraction (icg->work_bar, 0.0);
diff --git a/src/mstyle.c b/src/mstyle.c
index aab48e4..092a88f 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -1282,7 +1282,7 @@ gnm_style_get_font_script (GnmStyle const *style)
}
void
-gnm_style_set_font_size (GnmStyle *style, float size)
+gnm_style_set_font_size (GnmStyle *style, double size)
{
g_return_if_fail (style != NULL);
g_return_if_fail (size >= 1.);
@@ -1293,7 +1293,7 @@ gnm_style_set_font_size (GnmStyle *style, float size)
gnm_style_clear_pango (style);
}
-float
+double
gnm_style_get_font_size (GnmStyle const *style)
{
g_return_val_if_fail (style != NULL, 12.0);
@@ -1645,7 +1645,7 @@ add_attr (PangoAttrList *attrs, PangoAttribute *attr)
PangoAttrList *
gnm_style_get_pango_attrs (GnmStyle const *style,
PangoContext *context,
- float zoom)
+ double zoom)
{
PangoAttrList *l;
@@ -1739,7 +1739,7 @@ gnm_style_generate_attrs_full (GnmStyle const *style)
int
gnm_style_get_pango_height (GnmStyle const *style,
PangoContext *context,
- float zoom)
+ double zoom)
{
PangoAttrList *attrs = gnm_style_get_pango_attrs (style, context, zoom);
@@ -1767,7 +1767,7 @@ gnm_style_set_from_pango_attribute (GnmStyle *style, PangoAttribute const *attr)
break;
case PANGO_ATTR_SIZE :
gnm_style_set_font_size (style,
- (float )(((PangoAttrInt *)attr)->value) / PANGO_SCALE);
+ ((PangoAttrInt *)attr)->value / (double)PANGO_SCALE);
break;
case PANGO_ATTR_STYLE :
gnm_style_set_font_italic (style,
diff --git a/src/mstyle.h b/src/mstyle.h
index f788da5..a19d9b8 100644
--- a/src/mstyle.h
+++ b/src/mstyle.h
@@ -111,8 +111,8 @@ void gnm_style_set_font_strike (GnmStyle *style, gboolean strike);
gboolean gnm_style_get_font_strike (GnmStyle const *style);
void gnm_style_set_font_script (GnmStyle *style, GOFontScript script);
GOFontScript gnm_style_get_font_script (GnmStyle const *style);
-void gnm_style_set_font_size (GnmStyle *style, float size);
-float gnm_style_get_font_size (GnmStyle const *style);
+void gnm_style_set_font_size (GnmStyle *style, double size);
+double gnm_style_get_font_size (GnmStyle const *style);
GnmFont *gnm_style_get_font (GnmStyle const *style,
PangoContext *context);
@@ -161,10 +161,10 @@ gboolean gnm_style_visible_in_blank (GnmStyle const *style);
PangoAttrList *gnm_style_generate_attrs_full (GnmStyle const *style);
PangoAttrList *gnm_style_get_pango_attrs (GnmStyle const *style,
PangoContext *context,
- float zoom);
+ double zoom);
int gnm_style_get_pango_height (GnmStyle const *style,
PangoContext *context,
- float zoom);
+ double zoom);
void gnm_style_set_from_pango_attribute (GnmStyle *style,
PangoAttribute const *attr);
diff --git a/src/parser.y b/src/parser.y
index a1cfa39..feca359 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -469,7 +469,7 @@ build_set (GnmExprList *list)
* parse_string_as_value :
*
* Try to parse the entered text as a basic value (empty, bool, int,
- * float, err) if this succeeds, we store this as a GnmValue otherwise, we
+ * gnm_float, err) if this succeeds, we store this as a GnmValue otherwise, we
* return a string.
*/
static GnmExpr *
@@ -1241,7 +1241,7 @@ yylex (void)
GnmValue *v = NULL;
if (c == state->decimal_point || c == 'e' || c == 'E') {
- /* This is float */
+ /* This is a floating point number */
char *end;
gnm_float d;
diff --git a/src/print-cell.c b/src/print-cell.c
index 917c9ed..ee062ed 100644
--- a/src/print-cell.c
+++ b/src/print-cell.c
@@ -156,7 +156,7 @@ print_rectangle_gtk (cairo_t *context,
static void
print_cell_background_gtk (cairo_t *context,
GnmStyle const *style, int col, int row,
- float x, float y, float w, float h)
+ double x, double y, double w, double h)
{
if (gnumeric_background_set_gtk (style, context))
print_rectangle_gtk (context, x, y, w, h);
@@ -177,7 +177,7 @@ print_merged_range_gtk (cairo_t *context,
double start_x, double start_y,
GnmRange const *view, GnmRange const *range)
{
- float l, r, t, b;
+ double l, r, t, b;
int last;
GnmCell const *cell = sheet_cell_get (sheet, range->start.col, range->start.row);
int const dir = sheet->text_is_rtl ? -1 : 1;
@@ -260,7 +260,7 @@ gnm_gtk_print_cell_range (cairo_t *context,
{
ColRowInfo const *ri = NULL, *next_ri = NULL;
int const dir = sheet->text_is_rtl ? -1 : 1;
- float const hscale = sheet->display_formulas ? 2 : 1;
+ double const hscale = sheet->display_formulas ? 2 : 1;
int start_row, start_col, end_col, end_row;
GnmStyleRow sr, next_sr;
diff --git a/src/print.c b/src/print.c
index d733617..f6cca65 100644
--- a/src/print.c
+++ b/src/print.c
@@ -200,7 +200,7 @@ print_page_cells (GtkPrintContext *context, PrintingInstance * pi,
static void
print_header_gtk (GtkPrintContext *context, cairo_t *cr,
- float x, float y, float w, float h,
+ double x, double y, double w, double h,
char const *name,
PangoFontDescription *desc)
{
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index f898fbf..b768977 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -2048,7 +2048,7 @@ calc_obj_place (GnmPane *pane, gint64 canvas_coord, gboolean is_col,
}
/* TODO : handle other anchor types */
- *offset = ((float) (canvas_coord - origin))/ ((float) cri->size_pixels);
+ *offset = (canvas_coord - origin) / (double)cri->size_pixels;
return colrow;
}
@@ -2404,7 +2404,8 @@ scg_object_coords_to_anchor (SheetControlGUI const *scg,
}
static double
-cell_offset_calc_pixel (Sheet const *sheet, int i, gboolean is_col, float offset)
+cell_offset_calc_pixel (Sheet const *sheet, int i, gboolean is_col,
+ double offset)
{
ColRowInfo const *cri = sheet_colrow_get_info (sheet, i, is_col);
return offset * cri->size_pixels;
diff --git a/src/sheet.c b/src/sheet.c
index 6b584ba..475038e 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -5118,8 +5118,8 @@ sheet_row_get_distance_pts (Sheet const *sheet, int from, int to)
{
ColRowSegment const *segment;
ColRowInfo const *ri;
- float const default_size = sheet->rows.default_style.size_pts;
- float pts = 0., sign = 1.;
+ double const default_size = sheet->rows.default_style.size_pts;
+ double pts = 0., sign = 1.;
int i;
g_return_val_if_fail (IS_SHEET (sheet), 1.);
diff --git a/src/tools/dao.c b/src/tools/dao.c
index 9d3e1de..2266985 100644
--- a/src/tools/dao.c
+++ b/src/tools/dao.c
@@ -514,7 +514,7 @@ dao_set_cell_printf (data_analysis_output_t *dao, int col, int row,
* @row:
* @v:
*
- * set cell to a float
+ * set cell to a gnm_float
*
*
**/
@@ -567,7 +567,7 @@ dao_set_cell_na (data_analysis_output_t *dao, int col, int row)
* @v:
* @is_valid:
*
- * set cell to a float or NA as appropraite
+ * set cell to a gnm_float or NA as appropraite
*
*
**/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]