Commit 3687100c authored by Guy Albertelli's avatar Guy Albertelli Committed by Alexandre Julliard

Added NULL checks on all rectangle pointers.

parent 1e55094e
......@@ -29,6 +29,7 @@ void WINAPI SetRect16( LPRECT16 rect, INT16 left, INT16 top,
BOOL WINAPI SetRect( LPRECT rect, INT left, INT top,
INT right, INT bottom )
{
if (!rect) return FALSE;
rect->left = left;
rect->right = right;
rect->top = top;
......@@ -51,6 +52,7 @@ void WINAPI SetRectEmpty16( LPRECT16 rect )
*/
BOOL WINAPI SetRectEmpty( LPRECT rect )
{
if (!rect) return FALSE;
rect->left = rect->right = rect->top = rect->bottom = 0;
return TRUE;
}
......@@ -96,6 +98,7 @@ BOOL16 WINAPI IsRectEmpty16( const RECT16 *rect )
*/
BOOL WINAPI IsRectEmpty( const RECT *rect )
{
if (!rect) return TRUE;
return ((rect->left >= rect->right) || (rect->top >= rect->bottom));
}
......@@ -115,6 +118,7 @@ BOOL16 WINAPI PtInRect16( const RECT16 *rect, POINT16 pt )
*/
BOOL WINAPI PtInRect( const RECT *rect, POINT pt )
{
if (!rect) return FALSE;
return ((pt.x >= rect->left) && (pt.x < rect->right) &&
(pt.y >= rect->top) && (pt.y < rect->bottom));
}
......@@ -137,6 +141,7 @@ void WINAPI OffsetRect16( LPRECT16 rect, INT16 x, INT16 y )
*/
BOOL WINAPI OffsetRect( LPRECT rect, INT x, INT y )
{
if (!rect) return FALSE;
rect->left += x;
rect->right += x;
rect->top += y;
......@@ -162,6 +167,7 @@ void WINAPI InflateRect16( LPRECT16 rect, INT16 x, INT16 y )
*/
BOOL WINAPI InflateRect( LPRECT rect, INT x, INT y )
{
if (!rect) return FALSE;
rect->left -= x;
rect->top -= y;
rect->right += x;
......@@ -197,6 +203,7 @@ BOOL16 WINAPI IntersectRect16( LPRECT16 dest, const RECT16 *src1,
BOOL WINAPI IntersectRect( LPRECT dest, const RECT *src1,
const RECT *src2 )
{
if (!dest || !src1 || !src2) return FALSE;
if (IsRectEmpty(src1) || IsRectEmpty(src2) ||
(src1->left >= src2->right) || (src2->left >= src1->right) ||
(src1->top >= src2->bottom) || (src2->top >= src1->bottom))
......@@ -248,6 +255,7 @@ BOOL16 WINAPI UnionRect16( LPRECT16 dest, const RECT16 *src1,
BOOL WINAPI UnionRect( LPRECT dest, const RECT *src1,
const RECT *src2 )
{
if (!dest) return FALSE;
if (IsRectEmpty(src1))
{
if (IsRectEmpty(src2))
......@@ -287,6 +295,7 @@ BOOL16 WINAPI EqualRect16( const RECT16* rect1, const RECT16* rect2 )
*/
BOOL WINAPI EqualRect( const RECT* rect1, const RECT* rect2 )
{
if (!rect1 || !rect2) return FALSE;
return ((rect1->left == rect2->left) && (rect1->right == rect2->right) &&
(rect1->top == rect2->top) && (rect1->bottom == rect2->bottom));
}
......@@ -336,6 +345,7 @@ BOOL WINAPI SubtractRect( LPRECT dest, const RECT *src1,
{
RECT tmp;
if (!dest) return FALSE;
if (IsRectEmpty( src1 ))
{
SetRectEmpty( dest );
......
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