paint-volume: Add arguments checks

In some cases we access the arguments in public functions without, or
prior to checking the arguments.
This commit is contained in:
Emmanuele Bassi 2010-10-11 13:51:12 +01:00
parent 8089af3c1b
commit 68d656c61b

View File

@ -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;