Commit 5570aef3 authored by Morten Welinder's avatar Morten Welinder

Remove trailing white-space from files that have it.

(The following command was done in src/ and plugins/.  Note, that the
grep has a space and a tab.)

for i in `find . -name '*.[ch]' -print`; do if grep '[         ]$' $i >/dev/null; then echo $i; perl -pi -e 's/[ \t]+$//' $i; fi; done
parent ad531019
......@@ -597,10 +597,10 @@ applix_parse_style (ApplixReadState *state, char **buffer)
if (color == NULL)
return NULL;
mstyle_set_color (style, MSTYLE_COLOR_BACK, color);
}
}
} else if (sep[0] == 'T' || sep[0] == 'B' || sep[0] == 'L' || sep[0] == 'R') {
/* A map from applix border indicies to gnumeric. */
static StyleBorderType const map[] = {0,
static StyleBorderType const map[] = {0,
STYLE_BORDER_THIN,
STYLE_BORDER_MEDIUM,
STYLE_BORDER_THICK,
......@@ -678,7 +678,7 @@ applix_read_attributes (ApplixReadState *state)
if (!strncmp (buffer, "Attr Table End", 14))
return 0;
if (buffer[0] != '<')
if (buffer[0] != '<')
return applix_parse_error (state, "Invalid attribute");
/* TODO : The first style seems to be a different format */
......@@ -966,7 +966,7 @@ applix_read_cells (ApplixReadState *state)
ParsePos pos;
ExprTree *expr;
Value *val = NULL;
Range r;
Range r;
char *expr_string;
ptr = applix_parse_value (ptr+2, &expr_string);
......
......@@ -104,7 +104,7 @@ init_plugin (CommandContext *context, PluginData *pd)
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
file_format_register_open (100,
file_format_register_open (100,
_("Applix (*.as) file format"),
&applix_probe, &applix_load);
......
......@@ -301,7 +301,7 @@ dif_write_cell (FILE *f, Cell const *cell)
/* FIXME : I have no idea the original code was trying to
* do but it was definitely wrong. This is only marginally
* better. It will dump the rendered string as a single line.
* with the magic prefix and quotes from the original. At
* with the magic prefix and quotes from the original. At
* least it will not completely disregard negatives.
*/
fputs("1,0\n\"", f);
......@@ -344,7 +344,7 @@ dif_write_workbook (IOContext *context,
if (sheet_list) {
Sheet *sheet = sheet_list->data;
Range r = sheet_get_extent (sheet);
/*
* Write out the standard headers
*/
......@@ -384,7 +384,7 @@ out:
fclose (f);
if (rc < 0)
gnumeric_io_error_save (context, "");
return rc; /* Q: what do we have to return here?? */
}
......@@ -410,10 +410,10 @@ init_plugin (CommandContext *context, PluginData * pd)
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
file_format_register_open (1,
file_format_register_open (1,
_("Data Interchange Format (*.dif) file format"),
NULL, &dif_read_workbook);
file_format_register_save (".dif",
file_format_register_save (".dif",
_("Data Interchange Format (*.dif)"),
FILE_FL_MANUAL, &dif_write_workbook);
......
......@@ -121,7 +121,7 @@ excel_save (IOContext *context, WorkbookView *wb_view, const char *filename,
struct stat s;
MsOleErr result;
void *state = NULL;
if ((stat (filename, &s) != -1)) {
gnumeric_io_error_save (context,
_("Saving over old files disabled for safety"));
......@@ -129,7 +129,7 @@ excel_save (IOContext *context, WorkbookView *wb_view, const char *filename,
}
if (ms_excel_check_write (context, &state, wb_view, ver) != 0)
return -1;
return -1;
result = ms_ole_create (&f, filename);
......@@ -177,15 +177,15 @@ void
excel_init (void)
{
/* We register Excel format with a precendence of 100 */
file_format_register_open (100,
file_format_register_open (100,
_("Microsoft(R) Excel file format"),
&excel_probe, &excel_load);
if (gnumeric_debugging > 0)
file_format_register_save (".xls",
file_format_register_save (".xls",
_("Excel(R) 97 file format"),
FILE_FL_MANUAL, &excel_save_98);
file_format_register_save (".xls",
file_format_register_save (".xls",
_("Excel(R) 95 file format"),
FILE_FL_MANUAL, &excel_save_95);
}
......
......@@ -1742,7 +1742,7 @@ BC_R(tick)(ExcelChartHandler const *handle,
guint16 const position = MS_OLE_GET_GUINT8 (q->data+2);
guint16 const flags = MS_OLE_GET_GUINT8 (q->data+24);
switch (major_type) {
case 0: puts ("no major tick;"); break;
case 1: puts ("major tick inside axis;"); break;
......
......@@ -290,11 +290,11 @@ sst_bound_check (BiffQuery *q, guint32 offset)
if (offset >= q->length) {
guint32 d = offset - q->length;
guint16 opcode;
if (!ms_biff_query_peek_next (q, &opcode) ||
opcode != BIFF_CONTINUE)
return 0;
if (!ms_biff_query_next (q))
return 0;
......@@ -336,7 +336,7 @@ get_string (char **output, BiffQuery *q, guint32 offset, MsBiffVersion ver)
do {
new_offset = sst_bound_check (q, new_offset);
header = biff_string_get_flags (q->data + new_offset,
&high_byte,
&ext_str,
......@@ -356,7 +356,7 @@ get_string (char **output, BiffQuery *q, guint32 offset, MsBiffVersion ver)
chars_left = (q->length - new_offset - pre_len) / (high_byte?2:1);
if (chars_left > total_len)
get_len = total_len;
else
else
get_len = chars_left;
total_len -= get_len;
g_assert (get_len >= 0);
......@@ -2331,7 +2331,7 @@ ms_sheet_obj_realize (MSContainer *container, MSObj *obj)
g_return_val_if_fail (container != NULL, TRUE);
g_return_val_if_fail (obj->anchor_set, TRUE);
sheet = (ExcelSheet *)container;
sheet = (ExcelSheet *)container;
if (ms_sheet_obj_anchor_to_pos (position, obj->raw_anchor,
sheet->gnum_sheet,
......
......@@ -2473,7 +2473,7 @@ repeat:
comment += MAX_BIFF_NOTE_CHUNK;
len -= MAX_BIFF_NOTE_CHUNK;
ms_biff_put_var_next (bp, BIFF_NOTE);
MS_OLE_SET_GUINT16 (data + 0, 0xffff);
MS_OLE_SET_GUINT16 (data + 2, 0);
......
......@@ -89,7 +89,7 @@ ms_read_TXO (BiffQuery *q)
ms_biff_query_next (q);
data = q->data;
if (unicode_flag) {
increment = 2;
data++;
......@@ -101,11 +101,11 @@ ms_read_TXO (BiffQuery *q)
if (q->length < increment * text_len) {
g_free (text);
text = g_strdup ("Broken continue");
} else {
} else {
for (i = 0; i < text_len ; ++i)
text [i] = data [i * increment];
text [text_len] = '\0';
}
}
if (ms_biff_query_peek_next (q, &peek_op) &&
peek_op == BIFF_CONTINUE)
......@@ -356,7 +356,7 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
printf("OBJ : unexpected extra data after Object End record;\n");
ms_ole_dump (data, data_len_left);
return TRUE;
}
}
/* Catch underflow too */
g_return_val_if_fail (data_len_left == 0, TRUE);
......
......@@ -83,7 +83,7 @@ static char *help_datevalue = {
"DATEVALUE(\"1/1/1999\") equals to 36160. "
"\n"
"@EXAMPLES=\n"
"\n"
"\n"
"@SEEALSO=DATE")
};
......@@ -546,7 +546,7 @@ gnumeric_month (FunctionEvalInfo *ei, Value **argv)
{
int res = 1;
GDate *date;
if (argv[0]->type == VALUE_ERROR)
return value_duplicate (argv[0]);
......@@ -707,7 +707,7 @@ gnumeric_days360 (FunctionEvalInfo *ei, Value **argv)
if (day1 == 31)
day1 = 30;
break;
break;
case METHOD_EUROPE:
if (day1 == 31)
......@@ -1010,7 +1010,7 @@ date_functions_init(void)
"time",
&help_hour, gnumeric_hour );
def = function_add_args (cat, "minute", "S",
def = function_add_args (cat, "minute", "S",
"time",
&help_minute, gnumeric_minute );
......
......@@ -29,7 +29,7 @@ static char *help_ = {
""
""
"\n"
""
""
""
......@@ -448,7 +448,7 @@ static char *help_besseli = {
"truncated."
"\n"
"If @x or @y are not numeric a #VALUE! error is returned. "
"If @y < 0 a #NUM! error is returned. "
"If @y < 0 a #NUM! error is returned. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
......@@ -464,7 +464,7 @@ gnumeric_besseli (FunctionEvalInfo *ei, Value **argv)
double x;
double order;
double result;
x = value_get_as_float (argv[0]); /* value to evaluate I_n at. */
order = value_get_as_float (argv[1]); /* the order */
......@@ -489,7 +489,7 @@ static char *help_besselk = {
"truncated."
"\n"
"If x or n are not numeric a #VALUE! error is returned. "
"If y < 0 a #NUM! error is returned. "
"If y < 0 a #NUM! error is returned. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
......@@ -504,7 +504,7 @@ gnumeric_besselk (FunctionEvalInfo *ei, Value **argv)
double x;
double order;
double result;
x = value_get_as_float (argv[0]); /* value to evaluate K_n at. */
order = value_get_as_float (argv[1]); /* the order */
......@@ -528,7 +528,7 @@ static char *help_besselj = {
"truncated."
"\n"
"If @x or @y are not numeric a #VALUE! error is returned. "
"If @y < 0 a #NUM! error is returned. "
"If @y < 0 a #NUM! error is returned. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
......@@ -565,7 +565,7 @@ static char *help_bessely = {
"truncated."
"\n"
"If x or n are not numeric a #VALUE! error is returned. "
"If n < 0 a #NUM! error is returned. "
"If n < 0 a #NUM! error is returned. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
......@@ -719,7 +719,7 @@ static char *help_imreal = {
static Value *
gnumeric_imreal (FunctionEvalInfo *ei, Value **argv)
gnumeric_imreal (FunctionEvalInfo *ei, Value **argv)
{
complex_t c;
char imunit;
......@@ -750,7 +750,7 @@ static char *help_imabs = {
static Value *
gnumeric_imabs (FunctionEvalInfo *ei, Value **argv)
gnumeric_imabs (FunctionEvalInfo *ei, Value **argv)
{
complex_t c;
char imunit;
......@@ -780,7 +780,7 @@ static char *help_imconjugate = {
};
static Value *
gnumeric_imconjugate (FunctionEvalInfo *ei, Value **argv)
gnumeric_imconjugate (FunctionEvalInfo *ei, Value **argv)
{
complex_t c, res;
char imunit;
......@@ -811,7 +811,7 @@ static char *help_imcos = {
};
static Value *
gnumeric_imcos (FunctionEvalInfo *ei, Value **argv)
gnumeric_imcos (FunctionEvalInfo *ei, Value **argv)
{
complex_t c, res;
char imunit;
......@@ -866,7 +866,7 @@ static char *help_imexp = {
};
static Value *
gnumeric_imexp (FunctionEvalInfo *ei, Value **argv)
gnumeric_imexp (FunctionEvalInfo *ei, Value **argv)
{
complex_t c, res;
char imunit;
......@@ -894,7 +894,7 @@ static char *help_imargument = {
};
static Value *
gnumeric_imargument (FunctionEvalInfo *ei, Value **argv)
gnumeric_imargument (FunctionEvalInfo *ei, Value **argv)
{
complex_t c;
char imunit;
......@@ -953,7 +953,7 @@ static char *help_imlog2 = {
};
static Value *
gnumeric_imlog2 (FunctionEvalInfo *ei, Value **argv)
gnumeric_imlog2 (FunctionEvalInfo *ei, Value **argv)
{
complex_t c, res;
char imunit;
......@@ -983,7 +983,7 @@ static char *help_imlog10 = {
};
static Value *
gnumeric_imlog10 (FunctionEvalInfo *ei, Value **argv)
gnumeric_imlog10 (FunctionEvalInfo *ei, Value **argv)
{
complex_t c, res;
char imunit;
......@@ -1015,7 +1015,7 @@ static char *help_impower = {
};
static Value *
gnumeric_impower (FunctionEvalInfo *ei, Value **argv)
gnumeric_impower (FunctionEvalInfo *ei, Value **argv)
{
complex_t a, b, res;
char imunit;
......@@ -1049,7 +1049,7 @@ static char *help_imdiv = {
};
static Value *
gnumeric_imdiv (FunctionEvalInfo *ei, Value **argv)
gnumeric_imdiv (FunctionEvalInfo *ei, Value **argv)
{
complex_t a, b, res;
char imunit;
......@@ -1083,7 +1083,7 @@ static char *help_imsin = {
};
static Value *
gnumeric_imsin (FunctionEvalInfo *ei, Value **argv)
gnumeric_imsin (FunctionEvalInfo *ei, Value **argv)
{
complex_t c, res;
char imunit;
......@@ -1111,7 +1111,7 @@ static char *help_imsqrt = {
};
static Value *
gnumeric_imsqrt (FunctionEvalInfo *ei, Value **argv)
gnumeric_imsqrt (FunctionEvalInfo *ei, Value **argv)
{
complex_t c, res;
char imunit;
......@@ -1139,7 +1139,7 @@ static char *help_imsub = {
};
static Value *
gnumeric_imsub (FunctionEvalInfo *ei, Value **argv)
gnumeric_imsub (FunctionEvalInfo *ei, Value **argv)
{
complex_t a, b, res;
char imunit;
......@@ -1240,7 +1240,7 @@ static char *help_imsum = {
};
static Value *
gnumeric_imsum (FunctionEvalInfo *ei, GList *expr_node_list)
gnumeric_imsum (FunctionEvalInfo *ei, GList *expr_node_list)
{
Value *v;
eng_imoper_t p;
......@@ -1366,7 +1366,7 @@ typedef struct {
static float_t
get_constant_of_unit(eng_convert_unit_t units[],
get_constant_of_unit(eng_convert_unit_t units[],
eng_convert_unit_t prefixes[],
char *unit_name, float_t *c, float_t *prefix)
{
......@@ -1386,7 +1386,7 @@ get_constant_of_unit(eng_convert_unit_t units[],
unit_name++;
break;
}
for (i = 0; units [i].str != NULL; i++)
if (strcmp (unit_name, units [i].str) == 0) {
*c = units [i].c;
......@@ -1406,7 +1406,7 @@ convert (eng_convert_unit_t units[],
if (get_constant_of_unit (units, prefixes, from_unit, &from_c,
&from_prefix)) {
if (!get_constant_of_unit (units, prefixes,
to_unit, &to_c, &to_prefix))
return value_new_error (ep, gnumeric_err_NUM);
......@@ -1414,16 +1414,16 @@ convert (eng_convert_unit_t units[],
if ( (from_c == 0) || (to_prefix == 0) )
return value_new_error (ep, gnumeric_err_NUM);
*v = value_new_float (((n*from_prefix) / from_c) *
*v = value_new_float (((n*from_prefix) / from_c) *
to_c / to_prefix);
return *v;
}
return NULL;
}
}
static Value *
gnumeric_convert (FunctionEvalInfo *ei, Value **argv)
gnumeric_convert (FunctionEvalInfo *ei, Value **argv)
{
/* Weight and mass constants */
#define one_g_to_sg 0.00006852205001
......@@ -1562,7 +1562,7 @@ gnumeric_convert (FunctionEvalInfo *ei, Value **argv)
{ "W", one_HP_to_W },
{ NULL, 0.0 }
};
static eng_convert_unit_t magnetism_units[] = {
{ "T", 1.0 },
{ "ga", one_T_to_ga },
......@@ -1701,7 +1701,7 @@ gnumeric_erf (FunctionEvalInfo *ei, Value **argv)
upper = value_get_as_float (argv [1]);
ans = erf(upper) - ans;
}
return value_new_float (ans);
}
......@@ -1839,7 +1839,7 @@ gnumeric_gestep (FunctionEvalInfo *ei, Value **argv)
default:
err = value_new_error (ei->pos, _("Impossible"));
}
if (!argv [1])
value_release (vy);
return (err != NULL) ? err : value_new_int (ans ? 1 : 0);
......
......@@ -241,7 +241,7 @@ coupdays (GDate *settlement, GDate *maturity, int freq, int basis)
} else if (g_date_is_leap_year (sy-1)) {
if (sm == 1 || sm == 2)
if (mm == 1 || mm == 2)
if (sm < mm ||
if (sm < mm ||
(sm == mm && sd < md))
return 366.0;
else
......@@ -268,7 +268,7 @@ coupdays (GDate *settlement, GDate *maturity, int freq, int basis)
}
/*
* Returns the number of days from the beginning of the coupon period to
* Returns the number of days from the beginning of the coupon period to
* the settlement date. Currently, returns negative numbers if the branch
* is not implemented.
*/
......@@ -487,7 +487,7 @@ coupncd(GDate *settlement, GDate *maturity, int freq, int basis)
} else {
days = md - sd;
months = mm - sm;
if ((months > 0 || (months == 0 && days > 0)) &&
(months < 3 || (months == 3 && days <= 0))) {
month = mm;
......
......@@ -192,7 +192,7 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
* contains right-aligned text, caret (^) if the cell contains
* centered text, backslash (\) if the cell contains
* fill-aligned text, and empty text ("") if the cell contains
* anything else.
* anything else.
*/
return value_new_error (ei->pos, _("Unimplemented"));
} else if (!g_strcasecmp (info_type, "protect")) {
......@@ -355,7 +355,7 @@ static char *help_iserror = {
};
/* A utility routine to evaluate a single argument and return any errors
* directly
* directly
*/
static Value *
gnumeric_check_for_err (FunctionEvalInfo *ei, GList *expr_node_list,
......@@ -491,7 +491,7 @@ gnumeric_error_type (FunctionEvalInfo *ei, GList *expr_node_list)
return err;
if (res == NULL)
return value_new_error (ei->pos, gnumeric_err_NA);
mesg = res->v_err.mesg->str;
if (!strcmp (gnumeric_err_NULL, mesg))
retval = 1;
......
......@@ -18,28 +18,28 @@
/* Useful routines for multiple functions */
static gboolean
find_type_valid (const Value *find)
find_type_valid (const Value *find)
{
/* Excel does not lookup errors or blanks */
if (VALUE_IS_NUMBER (find) || find->type == VALUE_STRING) {
return TRUE;
}
return FALSE;
}
static gboolean
find_compare_type_valid (const Value *find, const Value *val)
find_compare_type_valid (const Value *find, const Value *val)
{
if (!val) {
return FALSE;
}
if ((VALUE_IS_NUMBER (find) && VALUE_IS_NUMBER (val)) ||
if ((VALUE_IS_NUMBER (find) && VALUE_IS_NUMBER (val)) ||
(find->type == val->type)) {
return TRUE;
}
return FALSE;
}
......@@ -50,7 +50,7 @@ find_compare_type_valid (const Value *find, const Value *val)
* @start: starting point
* @up: is first step incrementing
* @reset: reset static values
*
*
* This function takes and upper and lower integer bound
* and then walks that range starting with the given
* starting point. The walk is done by incrementing or
......@@ -58,11 +58,11 @@ find_compare_type_valid (const Value *find, const Value *val)
* until the upper or lower bound is reached. At this
* point the step is reversed and the values move to the
* opposite boundary (not repeating any values of course)
*
*
* Return value: the next value in the range
**/
static int
find_bound_walk (int l, int h, int start, gboolean up, gboolean reset)
find_bound_walk (int l, int h, int start, gboolean up, gboolean reset)
{
static int low, high, current, orig;
static gboolean sup, started;
......@@ -72,7 +72,7 @@ find_bound_walk (int l, int h, int start, gboolean up, gboolean reset)
g_return_val_if_fail (h >= l, -1);
g_return_val_if_fail (start >= l, -1);
g_return_val_if_fail (start <= h, -1);
if (reset) {
low = l;
high = h;
......@@ -82,7 +82,7 @@ find_bound_walk (int l, int h, int start, gboolean up, gboolean reset)
started = up;
return current;
}
if (sup) {
current++;
if (current > high && sup == started) {
......@@ -104,19 +104,19 @@ find_bound_walk (int l, int h, int start, gboolean up, gboolean reset)
}
static int
find_index_linear (FunctionEvalInfo *ei, Value *find, Value *data,
gint type, gboolean height)
find_index_linear (FunctionEvalInfo *ei, Value *find, Value *data,
gint type, gboolean height)
{
const Value *index_val = NULL;
ValueCompare comp;
int length, lp, index = -1;
if (height) {
length = value_area_get_height (ei->pos, data);
} else {
length = value_area_get_width (ei->pos, data);
}
for (lp = 0; lp < length; lp++){
const Value *v;
......@@ -131,17 +131,17 @@ find_index_linear (FunctionEvalInfo *ei, Value *find, Value *data,
if (!find_compare_type_valid (find, v)) {
continue;
}
comp = value_compare (find, v, FALSE);
if (type >= 1 && comp == IS_GREATER) {
ValueCompare comp = TYPE_MISMATCH;
if (index >= 0) {
if (index >= 0) {
comp = value_compare (v, index_val, FALSE);
}
if (index < 0 ||
if (index < 0 ||
(index >= 0 && comp == IS_GREATER)) {
index = lp;
index_val = v;
......@@ -149,26 +149,26 @@ find_index_linear (FunctionEvalInfo *ei, Value *find, Value *data,