star-3d

Surface structuring for efficient 3D geometric queries
git clone git://git.meso-star.fr/star-3d.git
Log | Files | Refs | README | LICENSE

commit 9e5a4eb0bb76b28fcc5ab8d08563af6dba327e87
parent 6eb8e09b01b17b98d304e0565025afd718993552
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 25 Jul 2016 10:11:30 +0200

Fix uninitialized & unused variable warnings

Diffstat:
Msrc/s3d_mesh.c | 1+
Msrc/s3d_scene.c | 31+++++++++++++++++--------------
2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/s3d_mesh.c b/src/s3d_mesh.c @@ -56,6 +56,7 @@ mesh_setup_indices ntris_prev = (unsigned)mesh_get_ntris(mesh); ASSERT(get_indices != S3D_KEEP || ntris == ntris_prev); + (void)ntris_prev; if(get_indices == S3D_KEEP) return; diff --git a/src/s3d_scene.c b/src/s3d_scene.c @@ -743,7 +743,6 @@ scene_sync const int session_mask, const int internal) /* Is the synchronized session internal? */ { - struct htable_shape_iterator it, it2, end; res_T res = RES_OK; ASSERT(scn); @@ -752,6 +751,8 @@ scene_sync goto exit; if(scn->session_mask == 0) { /* Are the scene shapes already commited ? */ + struct htable_shape_iterator it, end; + /* Commit the shape data to the back-end */ htable_shape_begin(&scn->shapes, &it); htable_shape_end(&scn->shapes, &end); @@ -768,8 +769,22 @@ scene_sync break; default: FATAL("Unreachable code\n"); break; } - if(res != RES_OK) + if(res != RES_OK) { + struct htable_shape_iterator it2; + /* Clear the session on instances that are already registered into the + * current session to invalidate */ + htable_shape_begin(&scn->shapes, &it2); + while(!htable_shape_iterator_eq(&it2, &it)) { + struct s3d_shape** pshape = htable_shape_iterator_data_get(&it2); + struct s3d_shape* shape = *pshape; + htable_shape_iterator_next(&it2); + + if(shape->type == GEOM_INSTANCE) { + scene_session_clear(shape->data.instance->scene, 1); + } + } goto error; + } htable_shape_iterator_next(&it); } @@ -802,18 +817,6 @@ exit: } return res; error: - /* Clear the session on instances that are already registered into the - * current session to invalidate */ - htable_shape_begin(&scn->shapes, &it2); - while(!htable_shape_iterator_eq(&it2, &it)) { - struct s3d_shape** pshape = htable_shape_iterator_data_get(&it2); - struct s3d_shape* shape = *pshape; - htable_shape_iterator_next(&it2); - - if(shape->type == GEOM_INSTANCE) { - scene_session_clear(shape->data.instance->scene, 1); - } - } goto exit; }