acid: don't get fooled by spaces in convflt()
This commit is contained in:
parent
5aa224c153
commit
79fbfbff48
1 changed files with 14 additions and 7 deletions
|
@ -213,18 +213,25 @@ bool(Node *n)
|
|||
void
|
||||
convflt(Node *r, char *flt)
|
||||
{
|
||||
char c;
|
||||
char *s;
|
||||
|
||||
c = flt[0];
|
||||
if(('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
|
||||
while(*flt == ' ')
|
||||
flt++;
|
||||
|
||||
s = flt;
|
||||
if(*s == '-' || *s == '+')
|
||||
s++;
|
||||
if(*s == '.')
|
||||
s++;
|
||||
|
||||
if(*s >= '0' && *s <= '9'){
|
||||
r->type = TFLOAT;
|
||||
r->fval = atof(flt);
|
||||
} else {
|
||||
r->type = TSTRING;
|
||||
r->fmt = 's';
|
||||
r->string = strnode(flt);
|
||||
}
|
||||
else {
|
||||
r->type = TFLOAT;
|
||||
r->fval = atof(flt);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue