summaryrefslogtreecommitdiff
path: root/libmetacity
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2020-03-02 21:08:49 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2020-03-02 21:08:49 +0200
commit92be827d81818c2450c04b4fd9a2ac503b227e84 (patch)
tree8946e648281629b3232e36312d50e526a87da0e4 /libmetacity
parent2be06e7c4da3e7d2fb75e602de6fd9c31b1a33a6 (diff)
downloadmetacity-92be827d81818c2450c04b4fd9a2ac503b227e84.tar.gz
libmetacity: use temporary variable to promote int to double
This is attempt to fix/silence coverity overlapping assignment issues - CID 1491451 and CID 1491452. In practice this does not seem to change anything, in both cases clang and gcc generates same assembly output with optimization level 1 or higher.
Diffstat (limited to 'libmetacity')
-rw-r--r--libmetacity/meta-draw-spec.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libmetacity/meta-draw-spec.c b/libmetacity/meta-draw-spec.c
index 39ee30b1..db478525 100644
--- a/libmetacity/meta-draw-spec.c
+++ b/libmetacity/meta-draw-spec.c
@@ -602,15 +602,22 @@ do_operation (PosExpr *a,
if (a->type == POS_EXPR_DOUBLE ||
b->type == POS_EXPR_DOUBLE)
{
+ int int_val;
+
if (a->type != POS_EXPR_DOUBLE)
{
+ int_val = a->d.int_val;
+
a->type = POS_EXPR_DOUBLE;
- a->d.double_val = a->d.int_val;
+ a->d.double_val = int_val;
}
+
if (b->type != POS_EXPR_DOUBLE)
{
+ int_val = b->d.int_val;
+
b->type = POS_EXPR_DOUBLE;
- b->d.double_val = b->d.int_val;
+ b->d.double_val = int_val;
}
}