Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | From e3bce98a60d6db3b719bbf5d71f732f9b86cb566 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 9 Feb 2019 08:28:09 -0800 |
| 4 | Subject: [PATCH] Explicit typecast to avoid implicit double to float |
| 5 | conversion |
| 6 | |
| 7 | fixes compile errors e.g. |
| 8 | |
| 9 | ../../ftgl-2.1.3~rc5/demo/simple.cpp:110:27: error: non-constant-expression cannot be narrowed from type 'double' to |
| 10 | 'float' in initializer list [-Wc++11-narrowing] |
| 11 | (t3 + 2.0) / 3, 0.3 }; |
| 12 | ^~~~~~~~~~~~~~ |
| 13 | Upstream-Status: Pending |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | demo/simple.cpp | 6 +++--- |
| 17 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 18 | |
| 19 | diff --git a/demo/simple.cpp b/demo/simple.cpp |
| 20 | index 532e862..aba55b4 100644 |
| 21 | --- a/demo/simple.cpp |
| 22 | +++ b/demo/simple.cpp |
| 23 | @@ -105,9 +105,9 @@ static void RenderScene(void) |
| 24 | float t2 = sin(n / 50 + 1); |
| 25 | float t3 = sin(n / 30 + 2); |
| 26 | |
| 27 | - float ambient[4] = { (t1 + 2.0) / 3, |
| 28 | - (t2 + 2.0) / 3, |
| 29 | - (t3 + 2.0) / 3, 0.3 }; |
| 30 | + float ambient[4] = { float(t1 + 2.0) / 3, |
| 31 | + float(t2 + 2.0) / 3, |
| 32 | + float(t3 + 2.0) / 3, 0.3 }; |
| 33 | float diffuse[4] = { 1.0, 0.9, 0.9, 1.0 }; |
| 34 | float specular[4] = { 1.0, 0.7, 0.7, 1.0 }; |
| 35 | float position[4] = { 100.0, 100.0, 0.0, 1.0 }; |
| 36 | -- |
| 37 | 2.20.1 |
| 38 | |