From fdaa2920eb21fff3320a17e9239e04dfadecdb00 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 18 Apr 2015 14:38:54 -0300 Subject: Updated copyright year in all headers --- core/math/math_funcs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/math/math_funcs.cpp') diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index ad48ceaac..490e529d8 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ -- cgit v1.2.3-70-g09d2 From 4804462ee06c1b3e2d1b50b857ce8693d3c0936d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 1 May 2015 10:44:08 -0300 Subject: -Fixes from source code analyzizer, closes #1768 --- bin/tests/test_physics_2d.cpp | 4 ++-- core/math/math_funcs.cpp | 4 ++-- core/variant_op.cpp | 2 +- drivers/unix/memory_pool_static_malloc.cpp | 2 +- platform/android/export/export.cpp | 8 ++++---- scene/3d/mesh_instance.cpp | 4 ++-- scene/animation/tween.cpp | 2 +- scene/gui/scroll_bar.cpp | 16 ++++++++-------- scene/gui/text_edit.cpp | 2 +- scene/resources/scene_preloader.cpp | 2 +- servers/physics/joints/generic_6dof_joint_sw.cpp | 2 +- servers/physics_2d_server.cpp | 2 +- servers/physics_server.cpp | 2 +- servers/visual/shader_language.cpp | 2 +- tools/collada/collada.cpp | 2 +- tools/editor/animation_editor.cpp | 2 +- tools/editor/io_plugins/editor_sample_import_plugin.cpp | 4 ++-- 17 files changed, 31 insertions(+), 31 deletions(-) (limited to 'core/math/math_funcs.cpp') diff --git a/bin/tests/test_physics_2d.cpp b/bin/tests/test_physics_2d.cpp index a441bed43..70a7d868b 100644 --- a/bin/tests/test_physics_2d.cpp +++ b/bin/tests/test_physics_2d.cpp @@ -191,7 +191,7 @@ class TestPhysics2DMainLoop : public MainLoop { Image image(convex_png); - body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].image=vs->texture_create_from_image(image); + body_shape_data[Physics2DServer::SHAPE_CUSTOM+1].image=vs->texture_create_from_image(image); RID convex_polygon_shape = ps->shape_create(Physics2DServer::SHAPE_CONVEX_POLYGON); @@ -206,7 +206,7 @@ class TestPhysics2DMainLoop : public MainLoop { arr.push_back(Point2(11,7)-sb); ps->shape_set_data(convex_polygon_shape,arr); - body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].shape = convex_polygon_shape; + body_shape_data[Physics2DServer::SHAPE_CUSTOM+1].shape = convex_polygon_shape; } diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index 490e529d8..6ad5c7499 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -48,8 +48,8 @@ uint32_t Math::rand_from_seed(uint32_t *seed) { s = 0x12345987; k = s / 127773; s = 16807 * (s - k * 127773) - 2836 * k; - if (s < 0) - s += 2147483647; +// if (s < 0) +// s += 2147483647; (*seed) = s; return (s & Math::RANDOM_MAX); #else diff --git a/core/variant_op.cpp b/core/variant_op.cpp index dafe3bd02..f68652b8c 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -2433,7 +2433,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { } else if (str == "pressed") { valid=true; - ie.action.pressed; + return ie.action.pressed; } } diff --git a/drivers/unix/memory_pool_static_malloc.cpp b/drivers/unix/memory_pool_static_malloc.cpp index 62abe7d26..e0bab27a6 100644 --- a/drivers/unix/memory_pool_static_malloc.cpp +++ b/drivers/unix/memory_pool_static_malloc.cpp @@ -153,7 +153,7 @@ void* MemoryPoolStaticMalloc::_realloc(void *p_memory,size_t p_bytes) { return alloc( p_bytes ); } - if (p_bytes<=0) { + if (p_bytes==0) { this->free(p_memory); ERR_FAIL_COND_V( p_bytes < 0 , NULL ); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 4d3f8f110..35ea7f15f 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -641,11 +641,11 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector& p_manifest) { int iofs=ofs+8; - uint32_t string_count=decode_uint32(&p_manifest[iofs]); - uint32_t styles_count=decode_uint32(&p_manifest[iofs+4]); + string_count=decode_uint32(&p_manifest[iofs]); + styles_count=decode_uint32(&p_manifest[iofs+4]); uint32_t string_flags=decode_uint32(&p_manifest[iofs+8]); - uint32_t string_data_offset=decode_uint32(&p_manifest[iofs+12]); - uint32_t styles_offset=decode_uint32(&p_manifest[iofs+16]); + string_data_offset=decode_uint32(&p_manifest[iofs+12]); + styles_offset=decode_uint32(&p_manifest[iofs+16]); /* printf("string count: %i\n",string_count); printf("flags: %i\n",string_flags); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 66e29627c..62b32729c 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -168,7 +168,7 @@ Node* MeshInstance::create_trimesh_collision_node() { static_body->add_shape( shape ); return static_body; - return NULL; + } void MeshInstance::create_trimesh_collision() { @@ -202,7 +202,7 @@ Node* MeshInstance::create_convex_collision_node() { static_body->add_shape( shape ); return static_body; - return NULL; + } void MeshInstance::create_convex_collision() { diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index ffa1c09ab..a7a4129a5 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -269,7 +269,7 @@ Variant Tween::_run_equation(InterpolateData& p_data) { { case Variant::BOOL: - result = ((int) _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, (int) initial_val, (int) delta_val, p_data.times_in_sec)) >= 0.5; + result = ( _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, initial_val, delta_val, p_data.times_in_sec)) >= 0.5; break; case Variant::INT: diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 04a559124..b1fd914fc 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -51,20 +51,20 @@ void ScrollBar::_input_event(InputEvent p_event) { if (b.button_index==5 && b.pressed) { - if (orientation==VERTICAL) - set_val( get_val() + get_page() / 4.0 ); - else - set_val( get_val() + get_page() / 4.0 ); + //if (orientation==VERTICAL) + // set_val( get_val() + get_page() / 4.0 ); + //else + set_val( get_val() + get_page() / 4.0 ); accept_event(); } if (b.button_index==4 && b.pressed) { - if (orientation==HORIZONTAL) - set_val( get_val() - get_page() / 4.0 ); - else - set_val( get_val() - get_page() / 4.0 ); + //if (orientation==HORIZONTAL) + // set_val( get_val() - get_page() / 4.0 ); + //else + set_val( get_val() - get_page() / 4.0 ); accept_event(); } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index c54333856..1e8243216 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1552,7 +1552,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { case KEY_HOME: case KEY_END: // ignore arrows if any modifiers are held (shift = selecting, others may be used for editor hotkeys) - if (k.mod.command || k.mod.shift || k.mod.alt || k.mod.command) + if (k.mod.command || k.mod.shift || k.mod.alt) break; unselect=true; break; diff --git a/scene/resources/scene_preloader.cpp b/scene/resources/scene_preloader.cpp index 08e88b32c..09001c1a9 100644 --- a/scene/resources/scene_preloader.cpp +++ b/scene/resources/scene_preloader.cpp @@ -407,7 +407,7 @@ Dictionary ScenePreloader::_get_bundled_scene() const { rconns.push_back(cd.signal); rconns.push_back(cd.method); rconns.push_back(cd.binds.size()); - for(int j=0;jop==OP_CONSTRUCT && all_const) { - bool all_const=false; + Vector cdata; for(int i=0;iis_visible() && p_input.is_action("ui_page_up")) - selected_track=selected_track--;; + selected_track--;; if (selected_track<0) selected_track=0; diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index 49b8af67f..d1fe10df0 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -719,8 +719,8 @@ void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector& p_data,D xm_sample=CLAMP(in[i]*32767.0,-32768,32767); - if (xm_sample==32767 || xm_sample==-32768) - printf("clippy!\n",xm_sample); + //if (xm_sample==32767 || xm_sample==-32768) + // printf("clippy!\n",xm_sample); } // xm_sample=xm_sample+xm_prev; -- cgit v1.2.3-70-g09d2 From 897a1aade5332753d9fda950d80495798cdc85b4 Mon Sep 17 00:00:00 2001 From: ehriche Date: Wed, 6 May 2015 00:56:59 +0200 Subject: optional formal changes --- core/io/resource_format_xml.cpp | 2 +- core/math/math_funcs.cpp | 7 ++++--- platform/x11/os_x11.cpp | 4 ++-- scene/2d/camera_2d.cpp | 3 +-- scene/gui/line_edit.cpp | 2 +- scene/gui/text_edit.cpp | 4 ++-- servers/physics/collision_object_sw.h | 4 +++- servers/visual/rasterizer.h | 10 +++++----- servers/visual/visual_server_raster.cpp | 2 +- tools/docdump/doc_dump.cpp | 2 +- tools/editor/animation_editor.cpp | 2 +- tools/editor/editor_file_system.cpp | 8 ++++---- tools/editor/io_plugins/editor_texture_import_plugin.cpp | 2 ++ tools/editor/plugins/shader_graph_editor_plugin.cpp | 1 - tools/editor/spatial_editor_gizmos.cpp | 3 ++- 15 files changed, 30 insertions(+), 26 deletions(-) (limited to 'core/math/math_funcs.cpp') diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 9de33e7ef..3e625ba6f 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -1850,7 +1850,7 @@ void ResourceFormatSaverXMLInstance::escape(String& p_str) { p_str=p_str.replace(">","<"); p_str=p_str.replace("'","'"); p_str=p_str.replace("\"","""); - for (int i=1;i<32;i++) { + for (char i=1;i<32;i++) { char chr[2]={i,0}; const char hexn[16]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index 6ad5c7499..3c94ac5bc 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -36,8 +36,9 @@ uint32_t Math::default_seed=1; #define PHI 0x9e3779b9 -static uint32_t Q[4096], c = 362436; - +#if 0 +static uint32_t Q[4096]; +#endif uint32_t Math::rand_from_seed(uint32_t *seed) { @@ -269,7 +270,7 @@ bool Math::is_inf(double p_val) { uint32_t Math::larger_prime(uint32_t p_val) { - static const int primes[] = { + static const uint32_t primes[] = { 5, 13, 23, diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 67ec33f3a..28427fa2f 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -317,8 +317,8 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi /* set the name and class hints for the window manager to use */ classHint = XAllocClassHint(); if (classHint) { - classHint->res_name = "Godot"; - classHint->res_class = "Godot"; + classHint->res_name = (char *)"Godot"; + classHint->res_class = (char *)"Godot"; } XSetClassHint(x11_display, x11_window, classHint); XFree(classHint); diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 27a512845..70b88a661 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -132,8 +132,7 @@ Matrix32 Camera2D::get_camera_transform() { } - Point2 screen_offset = (centered ? (screen_size * 0.5 * zoom) : Point2());; - screen_offset; + Point2 screen_offset = (centered ? (screen_size * 0.5 * zoom) : Point2()); float angle = get_global_transform().get_rotation(); if(rotating){ diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 14aa3da85..fec9e401f 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -272,7 +272,7 @@ void LineEdit::_input_event(InputEvent p_event) { if (editable) { selection_delete(); - CharType ucodestr[2]={k.unicode,0}; + CharType ucodestr[2]={(CharType)k.unicode,0}; append_at_cursor(ucodestr); emit_signal("text_changed",text); _change_notify("text"); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 681c33652..db8fbf7a6 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1440,7 +1440,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } else { //different char, go back - const CharType chr[2] = {k.unicode, 0}; + const CharType chr[2] = {(CharType)k.unicode, 0}; if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) { _consume_pair_symbol(chr[0]); } else { @@ -2062,7 +2062,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (readonly) break; - const CharType chr[2] = {k.unicode, 0}; + const CharType chr[2] = {(CharType)k.unicode, 0}; if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) { _consume_pair_symbol(chr[0]); diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h index 70fc3e8fc..c018ab622 100644 --- a/servers/physics/collision_object_sw.h +++ b/servers/physics/collision_object_sw.h @@ -34,8 +34,10 @@ #include "self_list.h" #include "broad_phase_sw.h" -#define MAX_OBJECT_DISTANCE 10000000 +#ifdef DEBUG_ENABLED +#define MAX_OBJECT_DISTANCE 10000000.0 #define MAX_OBJECT_DISTANCE_X2 (MAX_OBJECT_DISTANCE*MAX_OBJECT_DISTANCE) +#endif class SpaceSW; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 81862fb3a..79365f7db 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -863,17 +863,17 @@ public: if (polygon->indices != NULL) { r.pos=polygon->points[polygon->indices[0]]; - for (int i=1; icount; i++) { + for (int i=1; ipoints[polygon->indices[i]]); - }; + } } else { r.pos=polygon->points[0]; - for (int i=1; icount; i++) { + for (int i=1; ipoints[i]); - }; - }; + } + } } break; case CanvasItem::Command::TYPE_CIRCLE: { diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 6556f8bc4..a547da9b6 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -7281,7 +7281,7 @@ void VisualServerRaster::_draw_viewports() { if (r.size.width==0) r.size.width=window_w; if (r.size.height==0) - r.size.height=window_w; + r.size.height=window_h; _draw_viewport(vp,r.pos.x,r.pos.y,r.size.width,r.size.height); diff --git a/tools/docdump/doc_dump.cpp b/tools/docdump/doc_dump.cpp index d10f6c9ce..17aff3dc7 100644 --- a/tools/docdump/doc_dump.cpp +++ b/tools/docdump/doc_dump.cpp @@ -65,7 +65,7 @@ static String _escape_string(const String& p_str) { ret=ret.replace(">","<"); ret=ret.replace("'","'"); ret=ret.replace("\"","""); - for (int i=1;i<32;i++) { + for (char i=1;i<32;i++) { char chr[2]={i,0}; ret=ret.replace(chr,"&#"+String::num(i)+";"); diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 39eec4e69..63ab186a3 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -1375,7 +1375,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { if (p_input.is_action("ui_up")) selected_track--; if (v_scroll->is_visible() && p_input.is_action("ui_page_up")) - selected_track--;; + selected_track--; if (selected_track<0) selected_track=0; diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 94e887c3e..8e96123c3 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -940,19 +940,19 @@ String EditorFileSystem::get_file_type(const String& p_file) const { EditorFileSystemDirectory *EditorFileSystem::get_path(const String& p_path) { if (!filesystem || scanning) - return false; + return NULL; String f = Globals::get_singleton()->localize_path(p_path); if (!f.begins_with("res://")) - return false; + return NULL; f=f.substr(6,f.length()); f=f.replace("\\","/"); if (f==String()) - return filesystem; + return filesystem; if (f.ends_with("/")) f=f.substr(0,f.length()-1); @@ -960,7 +960,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_path(const String& p_path) { Vector path = f.split("/"); if (path.size()==0) - return false; + return NULL; EditorFileSystemDirectory *fs=filesystem; diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 64b5d5b33..3add30d81 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -51,6 +51,7 @@ static const char *flag_names[]={ NULL }; +#if 0 // not used static const char *flag_short_names[]={ "Stream", "FixBorder", @@ -65,6 +66,7 @@ static const char *flag_short_names[]={ "Anisoropic", NULL }; +#endif void EditorImportTextureOptions::set_format(EditorTextureImportPlugin::ImageFormat p_format) { diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 1db901e56..03fcbffa2 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -539,7 +539,6 @@ void GraphCurveMapEdit::_plot_curve(const Vector2& p_a,const Vector2& p_b,const if ((lastx != newx) || (lasty != newy)) { #if 0 - /* if(fix255) { /* use fixed array size (for the curve graph) */ diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index f9d92c8d8..521a10bbd 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -1257,7 +1257,8 @@ void SkeletonSpatialGizmo::redraw() { //find closest axis int closest=-1; - float closest_d; + float closest_d = 0.0; + for(int j=0;j<3;j++) { float dp = Math::abs(grests[parent].basis[j].normalized().dot(d)); if (j==0 || dp>closest_d) -- cgit v1.2.3-70-g09d2