Gerald Pfeifer wrote on Tuesday, January 01, 2008 6:03 PM:
This code obviously was written with signed operands in mind. I wonder if they could get signed somewhere and this function simply uses the wrong datatype.
(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?)
In the else statement InExt could be 0 (either that or OutExt would be 0) which would cause a division by 0 exception. Definitely doesn't sound right to me. But I have no idea what that code is supposed to do.
@@ -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))
elsereturn ( (In - InOrg) * OutExt / InExt ) + OutOrg;
return ((abs(InExt) - (In - InOrg))*abs(OutExt) /
abs(InExt)) + OutOrg;
return ( (InExt - (In - InOrg)) * OutExt / InExt ) + OutOrg;
}
LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd)
Rolf Kalbermatter