pkgsrc/emulators/palmosemulator/patches/patch-an
dsainty 6d650c60d5 Building POSE under gcc 3.3.3 with optimisation as default (g++ -O2) leads to
a malfunction where POSE will go into an apparent infinite loop after the
first pen operation.  This patch codes around the problem.
2004-08-16 12:36:38 +00:00

35 lines
1.3 KiB
Text

$NetBSD: patch-an,v 1.1 2004/08/16 12:36:38 dsainty Exp $
Building POSE under gcc 3.3.3 with optimisation as default (g++ -O2) leads to
a malfunction where POSE will go into an apparent infinite loop after the
first pen operation.
This appears to be due to pointer coordinate corruption, fixed by the patch
below.
The only user of the patched type coercion is
SrcShared/Patches/EmPatchMgr.cpp, which says:
PointType palmPen = pen;
I haven't entirely traced this through, but I suspect that the palmPen
coordinates are corrupted on the "pen up" event, leading the hosted Palm OS to
believe the stylus is being perpetually dragged around the screen.
The issue appears to be resolved by the below patch, which is a somewhat less
dodgy (but only just!) implementation, and appears to be enough to convince
the compiler to keep the target class uncorrupted.
Another option is: EmPatchMgr.cpp: PointType palmPen = { pen.fX, pen.fY };
--- SrcShared/EmPoint.cpp.orig 2002-03-30 01:11:14.000000000 +1200
+++ SrcShared/EmPoint.cpp 2004-08-16 00:11:31.000000000 +1200
@@ -233,7 +233,7 @@
#undef FOR_POINT
#define FOR_POINT(cls, size, x, y) \
EmPoint::operator cls() const \
- { size pt[2]; pt[x] = fX; pt[y] = fY; return *(cls*) pt; }
+ { union { size pt[2]; cls bar; } foo; foo.pt[x] = fX; foo.pt[y] = fY; return foo.bar; }
POINT_LIST_XY_LONG
POINT_LIST_YX_LONG