]> git.saurik.com Git - apple/boot.git/blobdiff - i386/util/machOconv.c
boot-111.1.tar.gz
[apple/boot.git] / i386 / util / machOconv.c
index 78aac622ffc79166337c590d49e9ab21a9d14dda..66e8bd45d0119034a5c4d563de770541826f5d7e 100644 (file)
@@ -27,7 +27,7 @@
 #include <mach/mach_error.h>
 #include <sys/file.h>
 #include <mach-o/loader.h>
-#include <architecture/byte_order.h>
+#include <libkern/OSByteOrder.h>
 #include <unistd.h>
 
 int    infile, outfile;
@@ -42,7 +42,7 @@ static unsigned long swap(
 )
 {
     if (swap_ends)
-       return NXSwapLong(x);
+       return OSSwapInt32(x);
     else
        return x;
 }
@@ -80,7 +80,7 @@ usage:
        perror("read mach header");
        exit(1);
     }
-    if (nc < sizeof (mh)) {
+    if (nc < (int)sizeof (mh)) {
        fprintf(stderr, "read mach header: premature EOF %d\n", nc);
        exit(1);
     }
@@ -89,7 +89,7 @@ usage:
     else if (mh.magic == MH_CIGAM)
        swap_ends = TRUE;
     else {
-       fprintf(stderr, "bad magic number %lx\n", mh.magic);
+       fprintf(stderr, "bad magic number %lx\n", (unsigned long)mh.magic);
        exit(1);
     }
 
@@ -103,7 +103,7 @@ usage:
        perror("read load commands");
        exit(1);
     }
-    if (nc < swap(mh.sizeofcmds)) {
+    if (nc < (int)swap(mh.sizeofcmds)) {
        fprintf(stderr, "read load commands: premature EOF %d\n", nc);
        exit(1);
     }
@@ -135,13 +135,13 @@ usage:
                perror("read segment data");
                exit(1);
            }
-           if (nc < swap(scp->filesize)) {
+           if (nc < (int)swap(scp->filesize)) {
                fprintf(stderr, "read segment data: premature EOF %d\n", nc);
                exit(1);
            }
 
            nc = write(outfile, (void *)data, vmsize);
-           if (nc < vmsize) {
+           if (nc < (int)vmsize) {
                perror("write segment data");
                exit(1);
            }