]> granicus.if.org Git - graphviz/commitdiff
common emit_html_rules: perform base calculation uniformly on doubles
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 18 Aug 2022 01:28:15 +0000 (18:28 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 23 Aug 2022 04:38:16 +0000 (21:38 -0700)
It is unclear to me why 070d24215a27219b33581c96c39e6e8811ba52a7 chose to
perform these intermediate calculations truncating to unsigned char. This
resulted in loss of accuracy and multiple possibilities for overflow. This
change makes the computation more natural, squashing 7 compiler warnings.

lib/common/htmltable.c

index a13274d363742481611089cd371e94e1340b018c..960801f739b3ee88e86c85ae0f4742bd882ec312 100644 (file)
@@ -454,7 +454,7 @@ emit_html_rules(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env, char *color, html
 {
     pointf rule_pt;
     double rule_length;
-    unsigned char base;
+    double base;
     boxf pts = cp->data.box;
     pointf pos = env->pos;