Commit 34a54e0a authored by Morten Welinder's avatar Morten Welinder

Warning and leak fixes.

parent aad39665
1999-07-31 Morten Welinder <terra@diku.dk>
* src/summary.c (summary_info_free): Fix leak.
(summary_item_free): Fix leak.
* src/fn-misc.c (gnumeric_iserror): Fix leak.
(gnumeric_error_type): Fix leaks.
(gnumeric_isna): Fix leak.
(gnumeric_iserr): Fix leak.
* src/fn-information.c (get_value_class): Fix leak.
1999-07-31 Michael Meeks <michael@edenproject.org>
* src/fn-information.c (gnumeric_isref): Implemented.
......
1999-07-31 Morten Welinder <terra@diku.dk>
* src/summary.c (summary_info_free): Fix leak.
(summary_item_free): Fix leak.
* src/fn-misc.c (gnumeric_iserror): Fix leak.
(gnumeric_error_type): Fix leaks.
(gnumeric_isna): Fix leak.
(gnumeric_iserr): Fix leak.
* src/fn-information.c (get_value_class): Fix leak.
1999-07-31 Michael Meeks <michael@edenproject.org>
* src/fn-information.c (gnumeric_isref): Implemented.
......
1999-07-31 Morten Welinder <terra@diku.dk>
* ms-excel-read.c (ms_excel_read_formula): Kill warning that is no
longer valid.
(ms_excel_read_error): Fix leak that I introduced.
1999-07-31 Michael Meeks <michael@edenproject.org>
* ms-excel-read.c (biff_get_text): Hacked to deal with continues
......
......@@ -1606,11 +1606,10 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet)
val = value_new_string ("MISSING Value");
}
if (cell->value != NULL) {
static gboolean already_warned = FALSE;
if (!already_warned) {
g_warning ("EXCEL : How does cell already have value?\n");
already_warned = TRUE;
}
#if 0
/* We always give cells values nowadays. */
g_warning ("EXCEL : How does cell already have value?\n");
#endif
value_release (cell->value);
}
......@@ -1669,6 +1668,8 @@ ms_excel_read_error (BiffQuery *q, ExcelSheet *sheet)
sheet->blank = FALSE;
cell_set_formula_tree_simple (cell, e);
if (cell->value)
value_release (cell->value);
cell->value = v;
expr_tree_unref (e);
ms_excel_set_cell_xf (sheet, cell, xf_index);
......
1999-07-31 Morten Welinder <terra@diku.dk>
* libcsv.c (read_line): Make static.
1999-07-05 Miguel de Icaza <miguel@gnu.org>
* csv-io.c (csv_read_workbook): Load here now.
......
......@@ -21,6 +21,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "libcsv.h"
static char linebuf[16384]; /* Hack for now */
......@@ -136,7 +137,8 @@ static int smash_fields(char *ptr, char **array, int len)
}
char * read_line(FILE *f)
static char *
read_line(FILE *f)
{
int n;
if(fgets(linebuf, sizeof(linebuf),f)==NULL)
......
......@@ -54,6 +54,7 @@ get_value_class (FunctionEvalInfo *ei, ExprTree *expr)
res = VALUE_CLASS_BOGUS;
break;
}
value_release (value);
} else
res = VALUE_CLASS_ERROR;
......
1999-07-31 Morten Welinder <terra@diku.dk>
* lotus.c (lotus_getdouble): Constify.
* lotus.h (lotus_getdouble): Fix prototype.
(lotus_setdouble): Ditto.
1999-07-21 Michael Meeks <michael@edenproject.org>
* boot.c (lotus_load): Stupid bugs.
......
......@@ -34,7 +34,7 @@
/* These really should be in glib */
double
lotus_getdouble (guint8 *p)
lotus_getdouble (const guint8 *p)
{
double d;
int i;
......
......@@ -5,8 +5,8 @@
# define LOTUS_GETDOUBLE(p) (lotus_getdouble(p))
# define LOTUS_SETDOUBLE(p,q) (lotus_setdouble(p,q))
extern double lotus_get_double (guint8 *p);
extern void lotus_set_double (guint8 *p, double d);
double lotus_getdouble (const guint8 *p);
void lotus_setdouble (guint8 *p, double d);
#endif
Workbook *lotus_read (const char *filename);
......@@ -152,6 +152,7 @@ writeTextWorkbook (TextData *data, Workbook *wb)
g_hash_table_foreach (wb->sheets, writeTextSheetTo, data);
}
#if 0
static gint
change_sheet_name (Sheet* sheet, char *string, int start, int end)
{
......@@ -173,6 +174,8 @@ change_sheet_name (Sheet* sheet, char *string, int start, int end)
return 0;
}
#endif
static gint
insert_cell (Sheet* sheet, char *string, int start, int end, int col, int row)
......
1999-07-31 Morten Welinder <terra@diku.dk>
* xbase.c (field_types): Move from xbase.h.
(field_type_descriptions): Ditto.
(xbase_close): Kill warning.
* boot.c (xb_getdouble): Make static and constify.
(xb_setdouble): Make static.
1999-07-21 Michael Meeks <michael@edenproject.org>
* boot.c: Removed include boot.h
......
......@@ -31,7 +31,8 @@
# define XB_GETDOUBLE(p) (xb_getdouble(p))
# define XB_SETDOUBLE(p,q) (xb_setdouble(p,q))
double xb_getdouble (guint8 *p)
static double
xb_getdouble (const guint8 *p)
{
double d;
int i;
......@@ -44,7 +45,8 @@ double xb_getdouble (guint8 *p)
return d;
}
void xb_setdouble (guint8 *p, double d)
static void
xb_setdouble (guint8 *p, double d)
{
int i;
guint8 *t = (guint8 *)&d;
......
......@@ -21,6 +21,16 @@
#define XBASE_DEBUG 0
static const char *field_types = "CNLDMF?BGPYTI";
static const char *field_type_descriptions[] = { /* FIXME: fix array size from field_types*/
"Character", "Number", "Logical", "Date", "Memo", "Floating point",
"Character name variable", "Binary", "General", "Picture", "Currency",
"DateTime", "Integer"
};
/**
* Newly allocated pointer to record, initialised as first in database.
*/
......@@ -228,7 +238,6 @@ xbase_open (const char *filename)
void
xbase_close (XBfile *x)
{
guint i=0;
printf("Closing Xbase file\n");
fclose (x->f);
g_free (x->format);
......
static const char *field_types = "CNLDMF?BGPYTI";
static const char *field_type_descriptions[] = { /* FIXME: fix array size from field_types*/
"Character", "Number", "Logical", "Date", "Memo", "Floating point",
"Character name variable", "Binary", "General", "Picture", "Currency",
"DateTime", "Integer"
};
typedef struct { /* field format */
guint8 name[11]; /* name, including terminating '\0' */
guint8 type; /* type (single ASCII char) */
......@@ -34,8 +27,3 @@ guint8 *record_get_field (const XBrecord *record, guint num);
XBfile *xbase_open (const char *filename);
void xbase_close (XBfile *file);
static gboolean xbase_read_header (XBfile *file);
static XBfield *xbase_read_field (XBfile *file);
......@@ -54,6 +54,7 @@ get_value_class (FunctionEvalInfo *ei, ExprTree *expr)
res = VALUE_CLASS_BOGUS;
break;
}
value_release (value);
} else
res = VALUE_CLASS_ERROR;
......
......@@ -53,7 +53,11 @@ gnumeric_iserror (FunctionEvalInfo *eval_info, GList *expr_node_list)
if (err != NULL)
return err;
return value_new_bool (res != NULL);
if (res) {
value_release (res);
return value_new_bool (TRUE);
} else
return value_new_bool (FALSE);
}
......@@ -75,13 +79,15 @@ static Value *
gnumeric_isna (FunctionEvalInfo *eval_info, GList *expr_node_list)
{
Value * res, *err = NULL;
gboolean b;
res = gnumeric_check_for_err (eval_info, expr_node_list, &err);
if (err != NULL)
return err;
return value_new_bool (res != NULL &&
strcmp (gnumeric_err_NA,
res->v.error.mesg->str) == 0);
b = (res && !strcmp (gnumeric_err_NA, res->v.error.mesg->str));
if (res) value_release (res);
return value_new_bool (b);
}
......@@ -99,13 +105,15 @@ static Value *
gnumeric_iserr (FunctionEvalInfo *eval_info, GList *expr_node_list)
{
Value * res, *err = NULL;
gboolean b;
res = gnumeric_check_for_err (eval_info, expr_node_list, &err);
if (err != NULL)
return err;
return value_new_bool (res != NULL &&
strcmp (gnumeric_err_NA,
res->v.error.mesg->str) != 0);
b = (res && strcmp (gnumeric_err_NA, res->v.error.mesg->str));
if (res) value_release (res);
return value_new_bool (b);
}
......@@ -147,9 +155,12 @@ gnumeric_error_type (FunctionEvalInfo *eval_info, GList *expr_node_list)
retval = 6;
else if (!strcmp (gnumeric_err_NA, mesg))
retval = 7;
else
else {
value_release (res);
return value_new_error (&eval_info->pos, gnumeric_err_NA);
}
value_release (res);
return value_new_int (retval);
}
......
......@@ -54,6 +54,7 @@ get_value_class (FunctionEvalInfo *ei, ExprTree *expr)
res = VALUE_CLASS_BOGUS;
break;
}
value_release (value);
} else
res = VALUE_CLASS_ERROR;
......
......@@ -53,7 +53,11 @@ gnumeric_iserror (FunctionEvalInfo *eval_info, GList *expr_node_list)
if (err != NULL)
return err;
return value_new_bool (res != NULL);
if (res) {
value_release (res);
return value_new_bool (TRUE);
} else
return value_new_bool (FALSE);
}
......@@ -75,13 +79,15 @@ static Value *
gnumeric_isna (FunctionEvalInfo *eval_info, GList *expr_node_list)
{
Value * res, *err = NULL;
gboolean b;
res = gnumeric_check_for_err (eval_info, expr_node_list, &err);
if (err != NULL)
return err;
return value_new_bool (res != NULL &&
strcmp (gnumeric_err_NA,
res->v.error.mesg->str) == 0);
b = (res && !strcmp (gnumeric_err_NA, res->v.error.mesg->str));
if (res) value_release (res);
return value_new_bool (b);
}
......@@ -99,13 +105,15 @@ static Value *
gnumeric_iserr (FunctionEvalInfo *eval_info, GList *expr_node_list)
{
Value * res, *err = NULL;
gboolean b;
res = gnumeric_check_for_err (eval_info, expr_node_list, &err);
if (err != NULL)
return err;
return value_new_bool (res != NULL &&
strcmp (gnumeric_err_NA,
res->v.error.mesg->str) != 0);
b = (res && strcmp (gnumeric_err_NA, res->v.error.mesg->str));
if (res) value_release (res);
return value_new_bool (b);
}
......@@ -147,9 +155,12 @@ gnumeric_error_type (FunctionEvalInfo *eval_info, GList *expr_node_list)
retval = 6;
else if (!strcmp (gnumeric_err_NA, mesg))
retval = 7;
else
else {
value_release (res);
return value_new_error (&eval_info->pos, gnumeric_err_NA);
}
value_release (res);
return value_new_int (retval);
}
......
......@@ -96,6 +96,7 @@ summary_item_free (SummaryItem *sit)
g_warning ("unknown / unimplemented summary type");
break;
}
g_free (sit->name);
g_free (sit);
}
......@@ -210,6 +211,7 @@ summary_info_free (SummaryInfo *sin)
NULL);
g_hash_table_destroy (sin->names);
sin->names = NULL;
g_free (sin);
}
static void
......
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