dlls/wintab32/context.c -- simpflication and HEADS UP!

Gerald Pfeifer gerald at pfeifer.com
Fri Nov 30 17:57:24 CST 2007


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?

Gerald

ChangeLog:
Simplify condition in ScaleForContext().

Index: dlls/wintab32/context.c
===================================================================
RCS file: /home/wine/wine/dlls/wintab32/context.c,v
retrieving revision 1.22
diff -u -3 -p -r1.22 context.c
--- dlls/wintab32/context.c	21 Sep 2007 12:24:49 -0000	1.22
+++ dlls/wintab32/context.c	30 Nov 2007 23:53:47 -0000
@@ -176,7 +176,7 @@ 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)))
+    if ((InExt > 0) && (OutExt > 0))
         return ((In - InOrg) * abs(OutExt) / abs(InExt)) + OutOrg;
     else
         return ((abs(InExt) - (In - InOrg))*abs(OutExt) / abs(InExt)) + OutOrg;



More information about the wine-devel mailing list