On Sat, 1 Dec 2007, Gerald Pfeifer wrote:
This change of mine is obvious since InExt and OutExt are DWORD, thus unsigned, and thus always greater or equal zero so my patch should be fine in any case.
However, looking at the else-part of the if-statement, I have some doubts this is working as designed, and in general the abs() invocations are bogus.
Any expert who could help with a more extensive patch?
Both the two <0 checks and the abs() invocations are needless since DWORDS are positive by definition.
(I did not get _any_ response for my first mail a month ago and I still believe the else-part looks bogus, but can we get at least this first cleanup in?)
Gerald
ChangeLog: Simplify condition in ScaleForContext().
Index: dlls/wintab32/context.c =================================================================== RCS file: /home/wine/wine/dlls/wintab32/context.c,v retrieving revision 1.26 diff -u -3 -p -r1.26 context.c --- dlls/wintab32/context.c 31 Dec 2007 18:34:43 -0000 1.26 +++ dlls/wintab32/context.c 1 Jan 2008 16:59:56 -0000 @@ -160,10 +160,10 @@ int TABLET_PostTabletMessage(LPOPENCONTE static inline DWORD ScaleForContext(DWORD In, DWORD InOrg, DWORD InExt, DWORD OutOrg, DWORD OutExt) { - if (((InExt > 0 )&&(OutExt > 0)) || ((InExt<0) && (OutExt < 0))) - return ((In - InOrg) * abs(OutExt) / abs(InExt)) + OutOrg; + if ((InExt > 0) && (OutExt > 0)) + return ( (In - InOrg) * OutExt / InExt ) + OutOrg; else - return ((abs(InExt) - (In - InOrg))*abs(OutExt) / abs(InExt)) + OutOrg; + return ( (InExt - (In - InOrg)) * OutExt / InExt ) + OutOrg; }
LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd)