[metacity/test: 2/3] libmetacity: use temporary variable to promote int to double
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity/test: 2/3] libmetacity: use temporary variable to promote int to double
- Date: Mon, 2 Mar 2020 21:07:51 +0000 (UTC)
commit 92be827d81818c2450c04b4fd9a2ac503b227e84
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Mar 2 21:08:49 2020 +0200
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.
libmetacity/meta-draw-spec.c | 11 +++++++++--
1 file 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]