Commit 68d656c6 authored by Emmanuele Bassi's avatar Emmanuele Bassi

paint-volume: Add arguments checks

In some cases we access the arguments in public functions without, or
prior to checking the arguments.
parent 8089af3c
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment