[Bf-blender-cvs] [4d506c6] GPU_data_request: Compile fixes for strict C - no declarations allowed in for loops and in middle of blocks.

Antony Riakiotakis noreply at git.blender.org
Fri Apr 3 11:41:37 CEST 2015


Commit: 4d506c6303b1ecf595c6b60547aaa7efe87f1626
Author: Antony Riakiotakis
Date:   Fri Apr 3 11:41:23 2015 +0200
Branches: GPU_data_request
https://developer.blender.org/rB4d506c6303b1ecf595c6b60547aaa7efe87f1626

Compile fixes for strict C - no declarations allowed in for loops and in
middle of blocks.

===================================================================

M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/gpu/GPUx_state.h
M	source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

===================================================================

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 4ea884b..f9fb613 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2012,7 +2012,7 @@ static void drawcamera_new(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *
 }
 
 static void drawcamera_new_new(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
-                               const short dflag, const unsigned char ob_wire_col[4])
+                               const short UNUSED(dflag), const unsigned char UNUSED(ob_wire_col[4]))
 {
 #if MCE_TRACE
 	printf("- %s\n", __FUNCTION__);
@@ -2037,11 +2037,11 @@ static void drawcamera_new_new(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ba
 
 	if (is_view) {
 		VertexBuffer *verts = vertex_buffer_create(1, 4);
+		ElementList *elem = element_list_create(GL_LINES, 4, 3);
 		specify_attrib(verts, 0, GL_VERTEX_ARRAY, GL_FLOAT, 3, KEEP_FLOAT);
 		fill_attrib(verts, 0, vec);
 		vertex_buffer_prime(verts);
 
-		ElementList *elem = element_list_create(GL_LINES, 4, 3);
 		/* camera frame */
 		set_line_vertices(elem, 0,  0,1);
 		set_line_vertices(elem, 1,  1,2);
@@ -2054,6 +2054,9 @@ static void drawcamera_new_new(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ba
 		vertex_buffer_discard(verts);
 	}
 	else {
+		VertexBuffer *verts = vertex_buffer_create(1, 8);
+		ElementList *elem = element_list_create(GL_LINES, 11, 7);
+
 		zero_v3(vec[4]); /* center point */
 
 		/* arrow on top */
@@ -2074,12 +2077,10 @@ static void drawcamera_new_new(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ba
 			copy_v3_v3(vec[7], tvec); /* top */
 		}
 
-		VertexBuffer *verts = vertex_buffer_create(1, 8);
 		specify_attrib(verts, 0, GL_VERTEX_ARRAY, GL_FLOAT, 3, KEEP_FLOAT);
 		fill_attrib(verts, 0, vec);
 		vertex_buffer_prime(verts);
 
-		ElementList *elem = element_list_create(GL_LINES, 11, 7);
 		/* camera frame */
 		set_line_vertices(elem, 0,  0,1);
 		set_line_vertices(elem, 1,  1,2);
@@ -4313,13 +4314,14 @@ static bool draw_mesh_object_new(Scene *scene, ARegion *ar, View3D *v3d, RegionV
 	Object *obedit = scene->obedit;
 	Mesh *me = ob->data;
 	bool do_alpha_after = false, drawlinked = false, retval = false;
+	int i;
 
 	BLI_assert(ob != obedit); /* should be caught by draw_object_new() before here */
 
 	/* If we are drawing shadows and any of the materials don't cast a shadow,
 	 * then don't draw the object */
 	if (v3d->flag2 & V3D_RENDER_SHADOW) {
-		for (int i = 0; i < ob->totcol; ++i) {
+		for (i = 0; i < ob->totcol; ++i) {
 			Material *ma = give_current_material(ob, i);
 			if (ma && !(ma->mode2 & MA_CASTSHADOW)) {
 				return true;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 0504e68..99f07da 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3532,14 +3532,17 @@ static void update_lods(Scene *scene, float camera_pos[3])
 #endif
 
 /* uploads and caches view dependent state such as view/projection matrix */
-static void view3d_update_view_dependent_uniforms()
+static void view3d_update_view_dependent_uniforms(void)
 {
 
 }
 
-static void view3d_main_area_draw_viewport_new(const bContext *C, Scene *scene, View3D *v3d,
+static void view3d_main_area_draw_viewport_new(const bContext *UNUSED(C), Scene *scene, View3D *v3d,
                                                ARegion *ar, const char **grid_unit)
 {
+	unsigned int lay_used = 0;
+	Base *base, *base_edit = NULL; /* object being edited, if any */
+
 #if MCE_TRACE
 	printf("> %s\n", __FUNCTION__);
 #endif /* MCE_TRACE */
@@ -3588,7 +3591,6 @@ static void view3d_main_area_draw_viewport_new(const bContext *C, Scene *scene,
 	 * not perfect but it does let us see objects positioned in space
 	 * TODO: draw objects prettier/better/faster/stronger
 	 */
-	unsigned int lay_used = 0;
 
 	/* XXX merwin
 	 *
@@ -3599,12 +3601,10 @@ static void view3d_main_area_draw_viewport_new(const bContext *C, Scene *scene,
 	 * Hand-crafted logic here is tricky; will simplify later.
 	 */
 
-	Base* base_edit = NULL; /* object being edited, if any */
-
 	reset_draw_state(); /* for code below which uses GPUx_state */
 
 	/* draw meshes (and cameras) not being edited (selected or not) */
-	for (Base* base = scene->base.first; base; base = base->next) {
+	for (base = scene->base.first; base; base = base->next) {
 		lay_used |= base->lay;
 
 		if (base->object == scene->obedit) {
@@ -3622,7 +3622,7 @@ static void view3d_main_area_draw_viewport_new(const bContext *C, Scene *scene,
 	reset_draw_state(); /* for code below which does NOT use GPUx_state */
 
 	/* draw non-meshes not being edited nor selected */
-	for (Base* base = scene->base.first; base; base = base->next) {
+	for (base = scene->base.first; base; base = base->next) {
 		if (base == base_edit)
 			continue;
 
@@ -3637,7 +3637,7 @@ static void view3d_main_area_draw_viewport_new(const bContext *C, Scene *scene,
 	v3d->lay_used = lay_used & ((1 << 20) - 1);
 
 	/* draw selected non-meshes */
-	for (Base *base = scene->base.first; base; base = base->next) {
+	for (base = scene->base.first; base; base = base->next) {
 		if (base == base_edit)
 			continue;
 
diff --git a/source/blender/gpu/GPUx_state.h b/source/blender/gpu/GPUx_state.h
index 9bf6087..b57509f 100644
--- a/source/blender/gpu/GPUx_state.h
+++ b/source/blender/gpu/GPUx_state.h
@@ -45,7 +45,7 @@ typedef struct {
 extern const DrawState default_state;
 
 
-void reset_draw_state(); /* to defaults */
+void reset_draw_state(void); /* to defaults */
 /* ^-- call this before using set_*_state functions below */
 
 /* incrementally update current GL state */
@@ -55,6 +55,6 @@ void set_line_state(const LineDrawState*);
 void set_polygon_state(const PolygonDrawState*);
 
 /* update everything regardless of current GL state */
-void force_state_update();
+void force_state_update(void);
 
 #endif /* BLENDER_GL_STATE */
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 6d3f6d9..f60af7d 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -3663,7 +3663,7 @@ void CcdPhysicsEnvironment::SetupObjectConstraints(KX_GameObject *obj_src, KX_Ga
 			break;
 	}
 
-	for (dof; dof < dof_max; dof++) {
+	for (; dof < dof_max; dof++) {
 		if (dat->flag & dofbit) {
 			phys_env->SetConstraintParam(constraintId, dof, dat->minLimit[dof], dat->maxLimit[dof]);
 		}




More information about the Bf-blender-cvs mailing list