Kaynağa Gözat

-Fixes from source code analyzizer, closes #1768

Juan Linietsky 10 yıl önce
ebeveyn
işleme
4804462ee0

+ 2 - 2
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;
 
 		}
 

+ 2 - 2
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

+ 1 - 1
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;
 				}
 			}
 

+ 1 - 1
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 );

+ 4 - 4
platform/android/export/export.cpp

@@ -641,11 +641,11 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& 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);

+ 2 - 2
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() {

+ 1 - 1
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:

+ 8 - 8
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();
 			}
 		

+ 1 - 1
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;

+ 1 - 1
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;j<cd.binds.size();i++)
+		for(int j=0;j<cd.binds.size();j++)
 			rconns.push_back(cd.binds[j]);
 
 	}

+ 1 - 1
servers/physics/joints/generic_6dof_joint_sw.cpp

@@ -536,7 +536,7 @@ void Generic6DOFJointSW::set_param(Vector3::Axis p_axis,PhysicsServer::G6DOFJoin
 		} break;
 		case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: {
 
-			m_angularLimits[p_axis].m_limitSoftness;
+			m_angularLimits[p_axis].m_limitSoftness=p_value;
 
 		} break;
 		case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING: {

+ 1 - 1
servers/physics_2d_server.cpp

@@ -285,7 +285,7 @@ Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParam
 	Array ret(true);
 	ret.resize(2);
 	ret[0]=closest_safe;
-	ret[0]=closest_unsafe;
+	ret[1]=closest_unsafe;
 	return ret;
 
 }

+ 1 - 1
servers/physics_server.cpp

@@ -303,7 +303,7 @@ Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameter
 	Array ret(true);
 	ret.resize(2);
 	ret[0]=closest_safe;
-	ret[0]=closest_unsafe;
+	ret[1]=closest_unsafe;
 	return ret;
 
 }

+ 1 - 1
servers/visual/shader_language.cpp

@@ -1279,7 +1279,7 @@ ShaderLanguage::Node* ShaderLanguage::validate_function_call(Parser&parser, Oper
 
 		if (p_func->op==OP_CONSTRUCT && all_const) {
 
-			bool all_const=false;
+
 			Vector<float> cdata;
 			for(int i=0;i<argcount;i++) {
 

+ 1 - 1
tools/collada/collada.cpp

@@ -979,7 +979,7 @@ void Collada::_parse_curve_geometry(XMLParser& parser,String p_id,String p_name)
 				current_source=id;
 				COLLADA_PRINT("source data: "+id);
 
-			} else if (section=="float_array" || section=="array" || section=="float_array") {
+			} else if (section=="float_array" || section=="array") {
 				// create a new array and read it.
 				if (curvedata.sources.has(current_source)) {
 

+ 1 - 1
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--;;
+						selected_track--;;
 
 					if (selected_track<0)
 						selected_track=0;

+ 2 - 2
tools/editor/io_plugins/editor_sample_import_plugin.cpp

@@ -719,8 +719,8 @@ void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& 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;