From d330bee1c237d28d7e84e25e9f33384c36ec54aa Mon Sep 17 00:00:00 2001 From: Xavier Cho Date: Tue, 17 Apr 2018 07:33:42 +0900 Subject: [PATCH] #18051: Do not use `var` in a for-loop, or where type is not obvious (cherry picked from commit e59fad39245de82cb243da38ba149ccd0ed957e5) --- modules/mono/glue/cs_files/AABB.cs | 4 ++-- modules/mono/glue/cs_files/Basis.cs | 10 +++++----- modules/mono/glue/cs_files/Color.cs | 4 ++-- modules/mono/glue/cs_files/DebuggingUtils.cs | 4 ++-- modules/mono/glue/cs_files/GD.cs | 8 ++++---- modules/mono/glue/cs_files/MarshalUtils.cs | 2 +- modules/mono/glue/cs_files/StringExtensions.cs | 12 ++++++------ 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/mono/glue/cs_files/AABB.cs b/modules/mono/glue/cs_files/AABB.cs index 3304e418c8b..f03d6403ef5 100644 --- a/modules/mono/glue/cs_files/AABB.cs +++ b/modules/mono/glue/cs_files/AABB.cs @@ -335,7 +335,7 @@ namespace Godot bool over = false; bool under = false; - for (var i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { if (plane.DistanceTo(points[i]) > 0) over = true; @@ -351,7 +351,7 @@ namespace Godot real_t min = 0f; real_t max = 1f; - for (var i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { real_t seg_from = from[i]; real_t seg_to = to[i]; diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs index f0f1644d46a..929b13d70cd 100644 --- a/modules/mono/glue/cs_files/Basis.cs +++ b/modules/mono/glue/cs_files/Basis.cs @@ -221,9 +221,9 @@ namespace Godot { var orth = this; - for (var i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { - for (var j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) { real_t v = orth[i, j]; @@ -238,7 +238,7 @@ namespace Godot } } - for (var i = 0; i < 24; i++) + for (int i = 0; i < 24; i++) { if (orthoBases[i] == orth) return i; @@ -413,8 +413,8 @@ namespace Godot (_x[2] - _z[0]) * inv_s ); } else { - var s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f; - var inv_s = 1f / s; + real_t s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f; + real_t inv_s = 1f / s; return new Quat( (_x[2] + _z[0]) * inv_s, (_y[2] + _z[1]) * inv_s, diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs index b527eee0f11..af94bb616ea 100644 --- a/modules/mono/glue/cs_files/Color.cs +++ b/modules/mono/glue/cs_files/Color.cs @@ -339,7 +339,7 @@ namespace Godot { int ig = 0; - for (var i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { int c = str[i + ofs]; int v; @@ -378,7 +378,7 @@ namespace Godot var ret = string.Empty; - for (var i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { char[] c = { (char)0, (char)0 }; int lv = v & 0xF; diff --git a/modules/mono/glue/cs_files/DebuggingUtils.cs b/modules/mono/glue/cs_files/DebuggingUtils.cs index a654c9b268e..b27816084e7 100644 --- a/modules/mono/glue/cs_files/DebuggingUtils.cs +++ b/modules/mono/glue/cs_files/DebuggingUtils.cs @@ -47,7 +47,7 @@ namespace Godot sb.Append("<"); - for (var j = 0; j < genericParams.Length; j++) + for (int j = 0; j < genericParams.Length; j++) { if (j > 0) sb.Append(", "); @@ -64,7 +64,7 @@ namespace Godot ParameterInfo[] parameter = methodBase.GetParameters(); - for (var i = 0; i < parameter.Length; i++) + for (int i = 0; i < parameter.Length; i++) { if (i > 0) sb.Append(", "); diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs index 8a300fbbd49..2384bc14326 100644 --- a/modules/mono/glue/cs_files/GD.cs +++ b/modules/mono/glue/cs_files/GD.cs @@ -93,7 +93,7 @@ namespace Godot { var ret = new int[length]; - for (var i = 0; i < length; i++) + for (int i = 0; i < length; i++) { ret[i] = i; } @@ -108,7 +108,7 @@ namespace Godot var ret = new int[to - from]; - for (var i = from; i < to; i++) + for (int i = from; i < to; i++) { ret[i - from] = i; } @@ -136,7 +136,7 @@ namespace Godot if (increment > 0) { int idx = 0; - for (var i = from; i < to; i += increment) + for (int i = from; i < to; i += increment) { ret[idx++] = i; } @@ -144,7 +144,7 @@ namespace Godot else { int idx = 0; - for (var i = from; i > to; i += increment) + for (int i = from; i > to; i += increment) { ret[idx++] = i; } diff --git a/modules/mono/glue/cs_files/MarshalUtils.cs b/modules/mono/glue/cs_files/MarshalUtils.cs index 661af3f8a20..ff4477cc6c6 100644 --- a/modules/mono/glue/cs_files/MarshalUtils.cs +++ b/modules/mono/glue/cs_files/MarshalUtils.cs @@ -9,7 +9,7 @@ namespace Godot { var ret = new Dictionary(); - for (var i = 0; i < keys.Length; i++) + for (int i = 0; i < keys.Length; i++) { ret.Add(keys[i], values[i]); } diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs index 38f7a0941f1..ef817699120 100644 --- a/modules/mono/glue/cs_files/StringExtensions.cs +++ b/modules/mono/glue/cs_files/StringExtensions.cs @@ -84,7 +84,7 @@ namespace Godot { var b = new string[instance.Length - 1]; - for (var i = 0; i < b.Length; i++) + for (int i = 0; i < b.Length; i++) { b[i] = instance.Substring(i, 2); } @@ -144,7 +144,7 @@ namespace Godot string aux = instance.Replace("_", " ").ToLower(); var cap = string.Empty; - for (var i = 0; i < aux.GetSliceCount(" "); i++) + for (int i = 0; i < aux.GetSliceCount(" "); i++) { string slice = aux.GetSlicec(' ', i); if (slice.Length > 0) @@ -446,7 +446,7 @@ namespace Godot if (len == 0) return false; - for (var i = 0; i < len; i++) + for (int i = 0; i < len; i++) { if (i == 0) { @@ -485,7 +485,7 @@ namespace Godot if (ip.Length != 4) return false; - for (var i = 0; i < ip.Length; i++) + for (int i = 0; i < ip.Length; i++) { string n = ip[i]; if (!n.IsValidInteger()) @@ -813,9 +813,9 @@ namespace Godot float sum = src_size + tgt_size; float inter = 0; - for (var i = 0; i < src_size; i++) + for (int i = 0; i < src_size; i++) { - for (var j = 0; j < tgt_size; j++) + for (int j = 0; j < tgt_size; j++) { if (srcBigrams[i] == tgtBigrams[j]) {