summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-oe/recipes-graphics/ftgl/ftgl/0001-Explicit-typecast-to-avoid-implicit-double-to-float-.patch
blob: 385bff8dd100a6c1e5738c99633a7d3661b9adaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From e3bce98a60d6db3b719bbf5d71f732f9b86cb566 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 9 Feb 2019 08:28:09 -0800
Subject: [PATCH] Explicit typecast to avoid implicit double to float
 conversion

fixes compile errors e.g.

../../ftgl-2.1.3~rc5/demo/simple.cpp:110:27: error: non-constant-expression cannot be narrowed from type 'double' to
      'float' in initializer list [-Wc++11-narrowing]
                          (t3 + 2.0) / 3, 0.3 };
                          ^~~~~~~~~~~~~~
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 demo/simple.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/demo/simple.cpp b/demo/simple.cpp
index 532e862..aba55b4 100644
--- a/demo/simple.cpp
+++ b/demo/simple.cpp
@@ -105,9 +105,9 @@ static void RenderScene(void)
     float t2 = sin(n / 50 + 1);
     float t3 = sin(n / 30 + 2);
 
-    float ambient[4]  = { (t1 + 2.0) / 3,
-                          (t2 + 2.0) / 3,
-                          (t3 + 2.0) / 3, 0.3 };
+    float ambient[4]  = { float(t1 + 2.0) / 3,
+                          float(t2 + 2.0) / 3,
+                          float(t3 + 2.0) / 3, 0.3 };
     float diffuse[4]  = { 1.0, 0.9, 0.9, 1.0 };
     float specular[4] = { 1.0, 0.7, 0.7, 1.0 };
     float position[4] = { 100.0, 100.0, 0.0, 1.0 };
-- 
2.20.1

OpenPOWER on IntegriCloud