[79538] branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Pextlib.c

Joshua Root jmr at macports.org
Thu Jun 16 23:44:00 PDT 2011


On 2011-6-17 10:44 , Ryan Schmidt wrote:
> On Jun 16, 2011, at 18:41, cal at macports.org wrote:
> 
>> Revision: 79538
>>          http://trac.macports.org/changeset/79538
>> Author:   cal at macports.org
>> Date:     2011-06-16 16:41:48 -0700 (Thu, 16 Jun 2011)
>> Log Message:
>> -----------
>> rev-upgrade: new pextlib command to find out whether a file is binary
>>
>> Modified Paths:
>> --------------
>>    branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Pextlib.c
> 
>> +#define MH_MAGIC    (0xfeedface)
>> +#define MH_MAGIC_64 (0xfeedfacf)
>> +#define FAT_MAGIC   (0xcafebabe)
> 
> Aren't there 5 Mach-O magic numbers?
> 
> 0xFEEDFACE: ppc
> 0xFEEDFACF: ppc64
> 0xCEFAEDFE: i386
> 0xCFFAEDFE: x86_64
> 0xCAFEBABE: any combination of two or more architectures

6 since you're counting the byteswapped versions.
#define FAT_CIGAM	0xbebafeca

But you only strictly need 3 and you can derive the other 3.

Of course, since this code is only going to work on Mach-O platforms
anyway, you might as well wrap the whole thing in #ifdef __MACH__ and
include the headers mentioned in the comment.

- Josh


More information about the macports-dev mailing list