Re: Orphaning emile
On Tue, 13 Dec 2011, Thorsten Glaser wrote:
> Hi,
>
> I can try to update the package and build it with gcc-4.4 (which is our
> current standard although people would love to switch to gcc-4.6), if
> that works.
I was able to built it (without docs, I didn't have the tools) from the
gitorious source. http://gitorious.org/projects/emile/
It fails to build with "error: dereferencing type-punned pointer will
break strict-aliasing rules". An untested patch follows.
Finn
>
> However, I cannot test the resulting binaries. Laurent or Finn, I?d need
> your help with that then. Preferably before uploading, of course ;-)
>
> I do not volunteer to maintain it after fixing these issues.
>
> bye,
> //mirabilos
>
diff --git a/libmacos/SerGetBuf.c b/libmacos/SerGetBuf.c
index f775833..174d085 100644
--- a/libmacos/SerGetBuf.c
+++ b/libmacos/SerGetBuf.c
@@ -13,6 +13,7 @@ OSErr SerGetBuf(short refNum, long *count)
{
int res;
CntrlParam param;
+ long p;
param.ioCompletion = 0;
param.ioVRefNum = 0;
@@ -21,7 +22,9 @@ OSErr SerGetBuf(short refNum, long *count)
res = PBStatusSync((ParmBlkPtr)¶m);
- *count = *(long*)param.csParam;
+ p = (((unsigned)param.csParam[0] & 0xFFFF) << 16) +
+ (((unsigned)param.csParam[1] & 0xFFFF) << 0);
+ *count = *(long *)p;
return res;
}
diff --git a/libmacos/macos/video.h b/libmacos/macos/video.h
index 54015f5..e9f8be8 100644
--- a/libmacos/macos/video.h
+++ b/libmacos/macos/video.h
@@ -83,7 +83,8 @@ static inline OSErr GetCurrentMode(short refNum, VDSwitchInfoRec *hwMode)
param.csCode = cscGetCurMode;
param.ioCRefNum = refNum;
- *((VDSwitchInfoRec **)¶m.csParam[0]) = hwMode;
+ param.csParam[0] = (*(unsigned long *)hwMode >> 16) & 0xFFFF;
+ param.csParam[1] = (*(unsigned long *)hwMode >> 0) & 0xFFFF;
return PBStatusSync((ParmBlkPtr)¶m);
}
Reply to: