Merge pull request #25032 from akien-mga/static-analysis

Fix some errors found by static analysis
This commit is contained in:
Rémi Verschelde 2019-01-16 11:18:53 +01:00 committed by GitHub
commit f0893235a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 20 deletions

View File

@ -444,14 +444,11 @@ MainLoop *test() {
float bb = (rgbe >> 18) & 0x1ff; float bb = (rgbe >> 18) & 0x1ff;
float eb = (rgbe >> 27); float eb = (rgbe >> 27);
float mb = Math::pow(2, eb - 15.0 - 9.0); float mb = Math::pow(2, eb - 15.0 - 9.0);
;
float rd = rb * mb; float rd = rb * mb;
float gd = gb * mb; float gd = gb * mb;
float bd = bb * mb; float bd = bb * mb;
print_line("RGBE: " + Color(rd, gd, bd)); print_line("RGBE: " + Color(rd, gd, bd));
return NULL;
} }
print_line("Dvectors: " + itos(MemoryPool::allocs_used)); print_line("Dvectors: " + itos(MemoryPool::allocs_used));
@ -482,8 +479,6 @@ MainLoop *test() {
print_line("later Mem used: " + itos(MemoryPool::total_memory)); print_line("later Mem used: " + itos(MemoryPool::total_memory));
print_line("Mlater Ax mem used: " + itos(MemoryPool::max_memory)); print_line("Mlater Ax mem used: " + itos(MemoryPool::max_memory));
return NULL;
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args(); List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
if (cmdlargs.empty()) { if (cmdlargs.empty()) {
@ -492,6 +487,11 @@ MainLoop *test() {
} }
String test = cmdlargs.back()->get(); String test = cmdlargs.back()->get();
if (test == "math") {
// Not a file name but the test name, abort.
// FIXME: This test is ugly as heck, needs fixing :)
return NULL;
}
FileAccess *fa = FileAccess::open(test, FileAccess::READ); FileAccess *fa = FileAccess::open(test, FileAccess::READ);
@ -516,8 +516,6 @@ MainLoop *test() {
print_line("Found class: " + getclass.get_class()); print_line("Found class: " + getclass.get_class());
} }
return NULL;
{ {
Vector<int> hashes; Vector<int> hashes;
@ -557,13 +555,10 @@ MainLoop *test() {
} }
print_line("DONE"); print_line("DONE");
return NULL;
} }
{
{
print_line("NUM: " + itos(-128)); print_line("NUM: " + itos(-128));
return NULL;
} }
{ {
@ -593,7 +588,6 @@ MainLoop *test() {
print_line("after v: " + v + " a: " + rtos(a)); print_line("after v: " + v + " a: " + rtos(a));
} }
return NULL;
String ret; String ret;
List<String> args; List<String> args;
@ -602,7 +596,6 @@ MainLoop *test() {
print_line("error: " + itos(err)); print_line("error: " + itos(err));
print_line(ret); print_line(ret);
return NULL;
Basis m3; Basis m3;
m3.rotate(Vector3(1, 0, 0), 0.2); m3.rotate(Vector3(1, 0, 0), 0.2);
m3.rotate(Vector3(0, 1, 0), 1.77); m3.rotate(Vector3(0, 1, 0), 1.77);
@ -611,17 +604,13 @@ MainLoop *test() {
m32.set_euler(m3.get_euler()); m32.set_euler(m3.get_euler());
print_line("ELEULEEEEEEEEEEEEEEEEEER: " + m3.get_euler() + " vs " + m32.get_euler()); print_line("ELEULEEEEEEEEEEEEEEEEEER: " + m3.get_euler() + " vs " + m32.get_euler());
return NULL;
{ {
Dictionary d; Dictionary d;
d["momo"] = 1; d["momo"] = 1;
Dictionary b = d; Dictionary b = d;
b["44"] = 4; b["44"] = 4;
} }
return NULL;
print_line("inters: " + rtos(Geometry::segment_intersects_circle(Vector2(-5, 0), Vector2(-2, 0), Vector2(), 1.0))); print_line("inters: " + rtos(Geometry::segment_intersects_circle(Vector2(-5, 0), Vector2(-2, 0), Vector2(), 1.0)));
print_line("cross: " + Vector3(1, 2, 3).cross(Vector3(4, 5, 7))); print_line("cross: " + Vector3(1, 2, 3).cross(Vector3(4, 5, 7)));

View File

@ -1132,9 +1132,9 @@ CSGBrush *CSGBox::_build_brush() {
for (int k = 0; k < 3; k++) { for (int k = 0; k < 3; k++) {
if (i < 3) if (i < 3)
face_points[j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1); face_points[j][(i + k) % 3] = v[k];
else else
face_points[3 - j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1); face_points[3 - j][(i + k) % 3] = -v[k];
} }
} }

View File

@ -110,7 +110,7 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref<AnimationRootNode> &p_
if (p_at_index == -1 || p_at_index == blend_points_used) { if (p_at_index == -1 || p_at_index == blend_points_used) {
p_at_index = blend_points_used; p_at_index = blend_points_used;
} else { } else {
for (int i = blend_points_used - 1; i > p_at_index; i++) { for (int i = blend_points_used - 1; i > p_at_index; i--) {
blend_points[i] = blend_points[i - 1]; blend_points[i] = blend_points[i - 1];
} }
} }