diff options
author | Thaer Razeq <RebelliousX@gmail.com> | 2017-02-23 02:28:09 -0600 |
---|---|---|
committer | REBELLIOUSX\Rebel_X <RebelliousX@gmail.com> | 2017-02-28 07:52:02 -0600 |
commit | f50488a36188d5975bfa8554687a1acdd394d6a9 (patch) | |
tree | 3b8712b9162aeb30e8eaaeeca63e6d04c7b9e3b5 /servers | |
parent | 0f8c6dd3822c38b8145f08265abb9eba479f4d15 (diff) |
Various fixes detected using PVS-Studio static analyzer.
- Add FIXME tags comments to some unfixed potential bugs
- Remove some checks (always false: unsigned never < 0)
- Fix some if statements based on reviews.
- Bunch of missing `else` statements
Diffstat (limited to 'servers')
-rw-r--r-- | servers/physics/shape_sw.cpp | 2 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index 10500a306f..dec1c75d9f 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -181,7 +181,7 @@ void RayShapeSW::get_supports(const Vector3& p_normal,int p_max,Vector3 *r_suppo r_amount=2; r_supports[0]=Vector3(0,0,0); r_supports[1]=Vector3(0,0,length); - } if (p_normal.z>0) { + } else if (p_normal.z>0) { r_amount=1; *r_supports=Vector3(0,0,length); } else { diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 7dfd9822f7..c680013efa 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -307,7 +307,7 @@ ShaderLanguage::Token ShaderLanguage::_get_token() { } if (GETCHAR(0)=='*' && GETCHAR(1)=='/') { char_idx+=2; break; - } if (GETCHAR(0)=='\n') { + } else if (GETCHAR(0)=='\n') { tk_line++; } @@ -3241,7 +3241,7 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Map<StringName,DataTy _set_error("void datatype not allowed here"); return ERR_PARSE_ERROR; } - if (!uniform && type<TYPE_FLOAT && type>TYPE_VEC4) { + if (!uniform && type<TYPE_FLOAT && type>TYPE_VEC4) { // FIXME: always false! should it be || instead? _set_error("Invalid type for varying, only float,vec2,vec3,vec4 allowed."); return ERR_PARSE_ERROR; } |