lseg - clean up endian bug.

This commit is contained in:
Kelvin Sherlock 2016-07-25 17:06:15 -04:00
parent 4fc03aab47
commit 6c1391d142

10
LSeg.c
View File

@ -138,7 +138,7 @@ int readSegRec(int fd)
if ( *(cp++) == 0x3B && *(cp++) == 0x38 && *(cp++) == 0xE9 ) if ( *(cp++) == 0x3B && *(cp++) == 0x38 && *(cp++) == 0xE9 )
/* This is the preamble we're looking for! */ /* This is the preamble we're looking for! */
/* Next two bytes are size of local variables */ /* Next two bytes are size of local variables */
return *(int*)cp + base_size; return le16dec(cp) + base_size;
else else
return -1; /* Give up */ return -1; /* Give up */
} }
@ -247,7 +247,7 @@ void scanOMF(int fd, char *fname)
OMFhead header; OMFhead header;
uint32_t off = 0l; uint32_t off = 0l;
int kind; int kind;
int i; //int i;
uint32_t eof; uint32_t eof;
char *bname; char *bname;
@ -284,9 +284,9 @@ char *bname;
name[0] = header.LABLEN; name[0] = header.LABLEN;
read(fd, name+1, header.LABLEN); read(fd, name+1, header.LABLEN);
} }
printf("%s",bname); printf("%-20s",bname);
i = strlen(bname); //i = strlen(bname);
while (i++ < 20) putchar(' '); //while (i++ < 20) putchar(' ');
kind = header.KIND & 0x1F; kind = header.KIND & 0x1F;
switch (kind) { switch (kind) {