mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
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:
parent
8089af3c1b
commit
68d656c61b
@ -201,15 +201,17 @@ void
|
|||||||
clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
||||||
const ClutterVertex *origin)
|
const ClutterVertex *origin)
|
||||||
{
|
{
|
||||||
float dx = origin->x - pv->vertices[0].x;
|
static const int key_vertices[4] = { 0, 1, 3, 4 };
|
||||||
float dy = origin->y - pv->vertices[0].y;
|
float dx, dy, dz;
|
||||||
float dz = origin->z - pv->vertices[0].z;
|
|
||||||
int key_vertices[4] = {0, 1, 3, 4};
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_return_if_fail (pv != NULL);
|
g_return_if_fail (pv != NULL);
|
||||||
g_return_if_fail (pv->is_axis_aligned);
|
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
|
/* If we change the origin then all the key vertices of the paint
|
||||||
* volume need to be shifted too... */
|
* volume need to be shifted too... */
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
@ -448,7 +450,7 @@ void
|
|||||||
clutter_paint_volume_union (ClutterPaintVolume *pv,
|
clutter_paint_volume_union (ClutterPaintVolume *pv,
|
||||||
const ClutterPaintVolume *another_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 != NULL);
|
||||||
g_return_if_fail (pv->is_axis_aligned);
|
g_return_if_fail (pv->is_axis_aligned);
|
||||||
@ -761,6 +763,8 @@ _clutter_paint_volume_axis_align (ClutterPaintVolume *pv)
|
|||||||
float max_y;
|
float max_y;
|
||||||
float max_z;
|
float max_z;
|
||||||
|
|
||||||
|
g_return_if_fail (pv != NULL);
|
||||||
|
|
||||||
if (pv->is_empty)
|
if (pv->is_empty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user