From 68d656c61badd7a88d7271600a59f24b05fbc36e Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 11 Oct 2010 13:51:12 +0100 Subject: [PATCH] paint-volume: Add arguments checks In some cases we access the arguments in public functions without, or prior to checking the arguments. --- clutter/clutter-paint-volume.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/clutter/clutter-paint-volume.c b/clutter/clutter-paint-volume.c index 969bef7..ef35db1 100644 --- a/clutter/clutter-paint-volume.c +++ b/clutter/clutter-paint-volume.c @@ -201,15 +201,17 @@ void clutter_paint_volume_set_origin (ClutterPaintVolume *pv, const ClutterVertex *origin) { - float dx = origin->x - pv->vertices[0].x; - float dy = origin->y - pv->vertices[0].y; - float dz = origin->z - pv->vertices[0].z; - int key_vertices[4] = {0, 1, 3, 4}; + static const int key_vertices[4] = { 0, 1, 3, 4 }; + float dx, dy, dz; int i; g_return_if_fail (pv != NULL); g_return_if_fail (pv->is_axis_aligned); + dx = origin->x - pv->vertices[0].x; + dy = origin->y - pv->vertices[0].y; + dz = origin->z - pv->vertices[0].z; + /* If we change the origin then all the key vertices of the paint * volume need to be shifted too... */ for (i = 0; i < 4; i++) @@ -448,7 +450,7 @@ void clutter_paint_volume_union (ClutterPaintVolume *pv, const ClutterPaintVolume *another_pv) { - int key_vertices[4] = {0, 1, 3, 4}; + static const int key_vertices[4] = { 0, 1, 3, 4 }; g_return_if_fail (pv != NULL); g_return_if_fail (pv->is_axis_aligned); @@ -761,6 +763,8 @@ _clutter_paint_volume_axis_align (ClutterPaintVolume *pv) float max_y; float max_z; + g_return_if_fail (pv != NULL); + if (pv->is_empty) return; -- 2.7.4