]> granicus.if.org Git - graphviz/commitdiff
Fix bugs related to the type of functions (the return type was being set to the
authorerg <devnull@localhost>
Thu, 10 Jan 2008 18:35:18 +0000 (18:35 +0000)
committererg <devnull@localhost>
Thu, 10 Jan 2008 18:35:18 +0000 (18:35 +0000)
last type declared in its body) and casting from a string to a double.

lib/expr/exgram.h
lib/expr/exparse.y

index 63594ab011c92a7d8b2c1b7f10f3b91d7a153b28..ac82c752f30e9efe576cc9f12797061c1181f2df 100644 (file)
@@ -479,17 +479,16 @@ extern "C" {
                        vmstrdup(p->vm, sfstruse(p->tmp));
                    break;
                case S2F:
-                   x->data.constant.value.floating =
-                       strtod(x->data.constant.value.string, &e);
+                   s = x->data.constant.value.string;
+                   x->data.constant.value.floating = strtod (s, &e);
                    if (*e)
-                       x->data.constant.value.floating =
-                           *x->data.constant.value.string != 0;
+                       x->data.constant.value.floating = (*s != 0);
                    break;
                case S2I:
                    s = x->data.constant.value.string;
                    x->data.constant.value.integer = strToL(s, &e);
                    if (*e)
-                       x->data.constant.value.integer = *s != 0;
+                       x->data.constant.value.integer = (*s != 0);
                    break;
                default:
                    exerror("internal error: %d: unknown cast op", t2t);
index fb124678ed3cc258ab51aefe8bdd78374c185d23..a9cd392cc4e52088269c09f6bbf7cf5b6d992a8f 100644 (file)
@@ -456,6 +456,7 @@ dcl_item    :       dcl_name {checkName ($1); expr.id=$1;} array initialize
                        if ($4 && $4->op == PROCEDURE)
                        {
                                $1->lex = PROCEDURE;
+                               $1->type = $4->type;
                                $1->value = $4;
                        }
                        else