Commit 423ca346 authored by Morten Welinder's avatar Morten Welinder
Browse files

Fix all isdigit/... usages.

parent 8bd27877
1999-06-10 Morten Welinder <terra@diku.dk>
* src/parser.y (return_cellref): Surprise: isdigit and friends
take unsigned chars (effectively). The results are *undefined*
(and weird) for signed chars.
(yylex): Ditto.
* src/fn-string.c (gnumeric_proper): Ditto.
* src/utils.c (parse_cell_name): Ditto.
* src/sheet-autofill.c (string_has_number): Ditto.
(autofill_cell): Ditto.
* src/cell.c (cell_set_text_simple): Ditto. Also fix long/int
confusion.
1999-06-10 James Henstridge <james@daa.com.au>
* src/main.c (gnumeric_main): changed call to glade_init() to a call
......@@ -146,9 +163,9 @@
* src/gnumeric-util.c (font_change_component): Extend the size of
the array components[] so that it can handle very long fontset
names.
* src/style.c: Change the default font names.
* src/workbook.c: Add gtk_widget_ensure_style() call, which is
necessary to knowing if a fontset is supplied for the label
widget.
......@@ -195,7 +212,7 @@
1999-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/file.c (dialog_query_load_file):
* src/file.c (dialog_query_load_file):
(workbook_save_as): Prettify these. Thanks to Andrew for pointing
this out.
......@@ -365,7 +382,7 @@
* src/dialog-zoom.c (dialog_zoom): Handle window manager close
here (it comes in the form of return value being NULL).
* src/dialog-insert-cells.c (dialog_insert_cells): ditto.
* src/dialog-delete-cells.c (dialog_delete_cells): ditto.
......
1999-06-10 Morten Welinder <terra@diku.dk>
* src/parser.y (return_cellref): Surprise: isdigit and friends
take unsigned chars (effectively). The results are *undefined*
(and weird) for signed chars.
(yylex): Ditto.
* src/fn-string.c (gnumeric_proper): Ditto.
* src/utils.c (parse_cell_name): Ditto.
* src/sheet-autofill.c (string_has_number): Ditto.
(autofill_cell): Ditto.
* src/cell.c (cell_set_text_simple): Ditto. Also fix long/int
confusion.
1999-06-10 James Henstridge <james@daa.com.au>
* src/main.c (gnumeric_main): changed call to glade_init() to a call
......@@ -146,9 +163,9 @@
* src/gnumeric-util.c (font_change_component): Extend the size of
the array components[] so that it can handle very long fontset
names.
* src/style.c: Change the default font names.
* src/workbook.c: Add gtk_widget_ensure_style() call, which is
necessary to knowing if a fontset is supplied for the label
widget.
......@@ -195,7 +212,7 @@
1999-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/file.c (dialog_query_load_file):
* src/file.c (dialog_query_load_file):
(workbook_save_as): Prettify these. Thanks to Andrew for pointing
this out.
......@@ -365,7 +382,7 @@
* src/dialog-zoom.c (dialog_zoom): Handle window manager close
here (it comes in the form of return value being NULL).
* src/dialog-insert-cells.c (dialog_insert_cells): ditto.
* src/dialog-delete-cells.c (dialog_delete_cells): ditto.
......
1999-06-10 Morten Welinder <terra@diku.dk>
* src/parser.y (return_cellref): Surprise: isdigit and friends
take unsigned chars (effectively). The results are *undefined*
(and weird) for signed chars.
(yylex): Ditto.
* src/fn-string.c (gnumeric_proper): Ditto.
* src/utils.c (parse_cell_name): Ditto.
* src/sheet-autofill.c (string_has_number): Ditto.
(autofill_cell): Ditto.
* src/cell.c (cell_set_text_simple): Ditto. Also fix long/int
confusion.
1999-06-10 James Henstridge <james@daa.com.au>
* src/main.c (gnumeric_main): changed call to glade_init() to a call
......@@ -146,9 +163,9 @@
* src/gnumeric-util.c (font_change_component): Extend the size of
the array components[] so that it can handle very long fontset
names.
* src/style.c: Change the default font names.
* src/workbook.c: Add gtk_widget_ensure_style() call, which is
necessary to knowing if a fontset is supplied for the label
widget.
......@@ -195,7 +212,7 @@
1999-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/file.c (dialog_query_load_file):
* src/file.c (dialog_query_load_file):
(workbook_save_as): Prettify these. Thanks to Andrew for pointing
this out.
......@@ -365,7 +382,7 @@
* src/dialog-zoom.c (dialog_zoom): Handle window manager close
here (it comes in the form of return value being NULL).
* src/dialog-insert-cells.c (dialog_insert_cells): ditto.
* src/dialog-delete-cells.c (dialog_delete_cells): ditto.
......
1999-06-10 Morten Welinder <terra@diku.dk>
* src/parser.y (return_cellref): Surprise: isdigit and friends
take unsigned chars (effectively). The results are *undefined*
(and weird) for signed chars.
(yylex): Ditto.
* src/fn-string.c (gnumeric_proper): Ditto.
* src/utils.c (parse_cell_name): Ditto.
* src/sheet-autofill.c (string_has_number): Ditto.
(autofill_cell): Ditto.
* src/cell.c (cell_set_text_simple): Ditto. Also fix long/int
confusion.
1999-06-10 James Henstridge <james@daa.com.au>
* src/main.c (gnumeric_main): changed call to glade_init() to a call
......@@ -146,9 +163,9 @@
* src/gnumeric-util.c (font_change_component): Extend the size of
the array components[] so that it can handle very long fontset
names.
* src/style.c: Change the default font names.
* src/workbook.c: Add gtk_widget_ensure_style() call, which is
necessary to knowing if a fontset is supplied for the label
widget.
......@@ -195,7 +212,7 @@
1999-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/file.c (dialog_query_load_file):
* src/file.c (dialog_query_load_file):
(workbook_save_as): Prettify these. Thanks to Andrew for pointing
this out.
......@@ -365,7 +382,7 @@
* src/dialog-zoom.c (dialog_zoom): Handle window manager close
here (it comes in the form of return value being NULL).
* src/dialog-insert-cells.c (dialog_insert_cells): ditto.
* src/dialog-delete-cells.c (dialog_delete_cells): ditto.
......
......@@ -606,7 +606,7 @@ gnumeric_proper (struct FunctionDefinition *i,
s = p = argv[0]->v.str->str;
while (*s) {
if (isalpha(*s)) {
if (isalpha((unsigned char)*s)) {
if (inword) {
*s = tolower(*s);
} else {
......
......@@ -637,22 +637,16 @@ cell_set_text_simple (Cell *cell, const char *text)
if (text [0] == '=' && text [1] != 0){
cell_set_formula (cell, text);
} else {
const char *p;
char *end;
long l;
/* Skip spaces, just in case. */
p = text;
while (isspace (*p)) p++;
l = strtol (p, &end, 10);
if (p != end && *end == 0){
/* It is an int. FIXME: long/int confusion here. */
l = strtol (text, &end, 10);
if (text != end && *end == 0 && l == (int)l) {
cell->value = value_new_int (l);
} else {
double d;
d = strtod (p, &end);
if (p != end && *end == 0){
d = strtod (text, &end);
if (text != end && *end == 0){
/* It is a floating point number. */
cell->value = value_new_float ((float_t)d);
} else {
......
......@@ -606,7 +606,7 @@ gnumeric_proper (struct FunctionDefinition *i,
s = p = argv[0]->v.str->str;
while (*s) {
if (isalpha(*s)) {
if (isalpha((unsigned char)*s)) {
if (inword) {
*s = tolower(*s);
} else {
......
......@@ -606,7 +606,7 @@ gnumeric_proper (struct FunctionDefinition *i,
s = p = argv[0]->v.str->str;
while (*s) {
if (isalpha(*s)) {
if (isalpha((unsigned char)*s)) {
if (inword) {
*s = tolower(*s);
} else {
......
......@@ -165,7 +165,7 @@ parse_cell_name (const char *cell_str, int *col, int *row)
/* Parse row number: a sequence of digits. */
for (*row = 0; *cell_str; cell_str++) {
if (!isdigit (*cell_str))
if (!isdigit ((unsigned char)*cell_str))
return FALSE;
*row = *row * 10 + (*cell_str - '0');
if (*row > SHEET_MAX_ROWS) /* Note: ">" is deliberate. */
......
......@@ -220,7 +220,7 @@ return_cellref (char *p)
if (!(*p >= '1' && *p <= '9'))
return 0;
while (isdigit (*p)){
while (isdigit ((unsigned char)*p)){
row = row * 10 + *p - '0';
p++;
}
......@@ -378,7 +378,7 @@ int yylex (void)
const char *p, *tmp;
int is_float, digits;
while(isspace (*parser_expr))
while(isspace ((unsigned char)*parser_expr))
parser_expr++;
c = *parser_expr++;
......@@ -401,7 +401,8 @@ int yylex (void)
tmp = parser_expr;
digits = 1;
while (isdigit (*tmp) || (!is_float && *tmp=='.' && ++is_float)) {
while (isdigit ((unsigned char)*tmp) ||
(!is_float && *tmp=='.' && ++is_float)) {
tmp++;
digits++;
}
......@@ -414,7 +415,7 @@ int yylex (void)
tmp++;
if (*tmp == '-' || *tmp == '+')
tmp++;
while (isdigit (*tmp))
while (isdigit ((unsigned char)*tmp))
tmp++;
}
......@@ -469,12 +470,12 @@ int yylex (void)
}
}
if (isalpha (c) || c == '_' || c == '$'){
if (isalpha ((unsigned char)c) || c == '_' || c == '$'){
const char *start = parser_expr - 1;
char *str;
int len;
while (isalnum (*parser_expr) || *parser_expr == '_' ||
while (isalnum ((unsigned char)*parser_expr) || *parser_expr == '_' ||
*parser_expr == '$' || *parser_expr == '.')
parser_expr++;
......
......@@ -159,7 +159,7 @@ string_has_number (String *str, int *num, int *pos)
int l = strlen (s);
gboolean found_number = FALSE;
if (isdigit (*s)){
if (isdigit ((unsigned char)*s)){
*num = atoi (s);
*pos = 0;
return TRUE;
......@@ -167,7 +167,7 @@ string_has_number (String *str, int *num, int *pos)
if (l <= 1)
return FALSE;
for (p = s + l - 1; p > str->str && isdigit (*p); p--)
for (p = s + l - 1; p > str->str && isdigit ((unsigned char)*p); p--)
found_number = TRUE;
if (!found_number)
......@@ -455,7 +455,7 @@ autofill_cell (Cell *cell, int idx, FillItem *fi)
if (last->v.numstr.pos == 0){
char *p = last->v.numstr.str->str;
while (*p && isdigit (*p))
while (*p && isdigit ((unsigned char)*p))
p++;
v = g_strconcat (buffer, p, NULL);
......
......@@ -165,7 +165,7 @@ parse_cell_name (const char *cell_str, int *col, int *row)
/* Parse row number: a sequence of digits. */
for (*row = 0; *cell_str; cell_str++) {
if (!isdigit (*cell_str))
if (!isdigit ((unsigned char)*cell_str))
return FALSE;
*row = *row * 10 + (*cell_str - '0');
if (*row > SHEET_MAX_ROWS) /* Note: ">" is deliberate. */
......
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