← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Fix typing problems with GR_KB_* constants

 

Le 15/01/2016 00:53, Chris Pavlina a écrit :
> Hi,
> 
> We have a few minor typing issues with the GR_KB_* constants in 
> include/common.h:
> 
> - Type is a signed int32 on most platforms, yet we use 0x80000000 
>   (greater than INT_MAX) as a constant.
> 
>   This has caused people some trouble before: 
>   https://bugs.launchpad.net/kicad/+bug/1445606
> 
> - In a few places, we're even using (-1) as a "special" value, which is 
>   a /bug/, not just me being picky about types - if one of these were to 
>   make it into a section that doesn't know to check for that (and 
>   there's nothing preventing this), it would come up as a valid key with 
>   all modifier flags, not a special value.
> 
> I've made a few minor changes in the attached patch. Hopefully someone 
> can review and commit this; I don't think it's particularly 
> controversial, but still big enough that it should be seen.
> 
> - Change these to 64-bit unsigned integers. Making them 64-bit gives 
>   plenty of space for flags, and making them unsigned resolves the 
>   bitmasking issue above.
> 
> - Use a typedef EDA_KEY to simplify making similar changes in the 
>   future.
> 
> - Add a positive constant (GR_KEY_INVALID) to represent what (-1) did 
>   before.
> 
> - Just in case any code I missed is still trying to pass in (-1), 
>   continue handling this in release builds. Fail with a helpful message 
>   in debug builds.
> 

It does not work on my 32 bit install (W7 32 bits)

When dragging mouse + Alt key pressed (flip bloc) I have this error:
"EDA_DRAW_PANEL::OnMouseEvent() Block Error"


-- 
Jean-Pierre CHARRAS


References