[darwinbuild-changes] [304] trunk/darwinxref/plugins/register.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Oct 4 02:02:30 PDT 2006
Revision: 304
http://trac.macosforge.org/projects/darwinbuild/changeset/304
Author: kevin
Date: 2006-10-04 02:02:29 -0700 (Wed, 04 Oct 2006)
Log Message:
-----------
- support ppc64
Modified Paths:
--------------
trunk/darwinxref/plugins/register.c
Modified: trunk/darwinxref/plugins/register.c
===================================================================
--- trunk/darwinxref/plugins/register.c 2005-11-30 00:35:44 UTC (rev 303)
+++ trunk/darwinxref/plugins/register.c 2006-10-04 09:02:29 UTC (rev 304)
@@ -373,23 +373,23 @@
static int register_libraries(int fd, char* build, char* project, int* isMachO) {
int res;
- struct mach_header mh;
- struct fat_header fh;
+ uint32_t magic;
- // The magic logic assumes mh is bigger than fh.
- assert(sizeof(mh) >= sizeof(fh));
- res = read(fd, &mh, sizeof(mh));
- if (res < sizeof(mh)) { goto error_out; }
-
+ res = read(fd, &magic, sizeof(uint32_t));
+ if (res < sizeof(uint32_t)) { goto error_out; }
+
// It's a fat file. copy mh over to fh, and dereference.
- if (mh.magic == FAT_MAGIC || mh.magic == FAT_CIGAM) {
+ if (magic == FAT_MAGIC || magic == FAT_CIGAM) {
+ struct fat_header fh;
int swap = 0;
- memcpy(&fh, &mh, sizeof(fh));
- if (fh.magic == FAT_CIGAM) {
+
+ res = read(fd, &fh.nfat_arch, sizeof(struct fat_header) - sizeof(uint32_t));
+ if (res < sizeof(uint32_t)) { goto error_out; }
+
+ if (magic == FAT_CIGAM) {
swap = 1;
swap_fat_header(&fh, NXHostByteOrder());
}
- lseek(fd, (off_t)sizeof(fh), SEEK_SET);
int i;
for (i = 0; i < fh.nfat_arch; ++i) {
@@ -407,6 +407,7 @@
lseek(fd, save, SEEK_SET);
}
} else {
+ lseek(fd, 0, SEEK_SET);
register_mach_header(build, project, fd, isMachO);
}
error_out:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/c7f79074/attachment-0001.html
More information about the darwinbuild-changes
mailing list