[OPW] Generated swapping and size-checking code integration

Christian Linhart chris at DemoRecorder.com
Sun Feb 22 04:19:06 PST 2015


Hi Asalle,

Some more comments for your proposed changes in shape.c
I have inserted them below within:

On 02/16/15 22:53, chris at demorecorder.com wrote:
> Here's my review of your changes to Xext/shape.c:
>> diff --git a/Xext/shape.c b/Xext/shape.c
>> index bb479b1..54e71d6 100644
>> --- a/Xext/shape.c
>> +++ b/Xext/shape.c
>> @@ -1025,9 +1025,25 @@ ProcShapeGetRectangles(ClientPtr client)
>>      return Success;
>>  }
>>  
>> +#include "xcb/swapcheck_shape.h"
>> +
>>  static int
>>  ProcShapeDispatch(ClientPtr client)
>>  {
>> +	REQUEST(xReq);
>> +	if(xcb_shape_Check_dispatch(client) == Success)
> This should be "stuff" instead of "client" because your function processes a request-ptr directly.
> The return-type of xcb_shape_Check_dispatch is not a BOOL 
> but a status. So you'd need to add "== Success".
>
>
>> +	{
>> +		return ProcShapeDispatch_Unchecked(client);
>> +	}
>> +	else
>> +	{
>> +		return BadLength;
Please return the actual error-status returned by
xcb_shape_Check_dispatch.

It can return "BadRequest" in addition to "BadLength",
when you implement the "default:"-branches of the dispatch functions.
In the future it may use other error codes as well.

For that Ppease assign the returnvalue of xcb_shape_Check_dispatch
to a local variable first.

>> @@ -1073,6 +1089,22 @@ ProcShapeDispatch(ClientPtr client)
>>      }
>>  }
>>  
>> +static int
>> +SProcShapeDispatch(ClientPtr client)
>> +{
>> +    REQUEST(xReq);
>> +    
>> +    if(xcb_shape_SwapFromClient_dispatch(client))
> This should be "stuff" instead of "client".
> The return-type of xcb_shape_SwapFromClient_dispatch is not a BOOL 
> but a status. So you'd need to add "== Success".
>
>> +    {
>> +		return ProcShapeDispatch_Unchecked(client);
>> +	}
>> +	else
>> +	{
>> +		return BadLength;
Same here: Please return the actual error-status returned by
xcb_shape_SwapFromClient_dispatch.
>> +	}
>> +}
>> +
>> +
>>  static void
>>  SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
>>  {
>> -- 
>> 2.1.1

Best Regards,

Chris


More information about the xorg-devel mailing list