Fixed some errors

This commit is contained in:
ceriel 1991-09-18 09:48:15 +00:00
parent abb71310d2
commit 3a0c239091
2 changed files with 44 additions and 22 deletions

View file

@ -196,11 +196,11 @@ wr_ohead(head)
BEGINSEEK(PARTDBUG, off);
#endif
}
#if BYTE_ORDER == 0x0123
if (sizeof(struct outhead) != SZ_HEAD)
#endif
if (BYTE_ORDER != 0x0123 || sizeof(struct outhead) != SZ_HEAD)
{
register char *c = (char *) head;
char buf[SZ_HEAD];
register char *c = &buf[0];
put2(head->oh_magic, c); c += 2;
put2(head->oh_stamp, c); c += 2;
@ -210,36 +210,57 @@ wr_ohead(head)
put2(head->oh_nname, c); c += 2;
put4(head->oh_nemit, c); c += 4;
put4(head->oh_nchar, c);
OUTWRITE(PARTEMIT, buf, (long)SZ_HEAD);
}
OUTWRITE(PARTEMIT, (char *)head, (long)SZ_HEAD);
else OUTWRITE(PARTEMIT, (char *)head, (long)SZ_HEAD);
}
wr_sect(s, cnt1)
struct outsect *s;
unsigned int cnt1;
wr_sect(sect, cnt)
register struct outsect *sect;
register unsigned int cnt;
{
register unsigned int cnt = cnt1;
register struct outsect *sect = s;
register char *c = (char *) sect;
{ register unsigned int i = cnt;
while (cnt--) {
while (i--) {
if (offcnt >= 1 && offcnt < SECTCNT) {
BEGINSEEK(PARTEMIT+offcnt, sect->os_foff);
}
offset[offcnt++] = sect->os_foff;
sect++;
}
sect -= cnt;
}
#if BYTE_ORDER == 0x0123
if (sizeof(struct outsect) != SZ_SECT)
#endif
while (cnt)
{
register char *c;
register unsigned int i;
i = __parts[PARTEMIT].cnt/SZ_SECT;
c = __parts[PARTEMIT].pnow;
if (i > cnt) i = cnt;
cnt -= i;
__parts[PARTEMIT].cnt -= (i*SZ_SECT);
while (i--) {
put4(sect->os_base, c); c += 4;
put4(sect->os_size, c); c += 4;
put4(sect->os_foff, c); c += 4;
put4(sect->os_flen, c); c += 4;
put4(sect->os_lign, c); c += 4;
}
sect++;
}
OUTWRITE(PARTEMIT, (char *) s, (long) cnt1 * SZ_SECT);
__parts[PARTEMIT].pnow = c;
if (cnt) {
__wr_flush(&__parts[PARTEMIT]);
}
}
#if BYTE_ORDER == 0x0123
else {
OUTWRITE(PARTEMIT, (char *) sect, (long) cnt * SZ_SECT);
}
#endif
}
wr_outsect(s)

View file

@ -6,14 +6,15 @@
#include <ranlib.h>
#include "object.h"
wr_ranlib(fd, ran, cnt)
wr_ranlib(fd, ran, cnt1)
struct ranlib *ran;
register long cnt;
long cnt1;
{
#if BYTE_ORDER == 0x0123
if (sizeof (struct ranlib) != SZ_RAN)
#endif
{
register long cnt = cnt1;
register struct ranlib *r = ran;
register char *c = (char *) r;
@ -23,5 +24,5 @@ wr_ranlib(fd, ran, cnt)
r++;
}
}
wr_bytes(fd, (char *) ran, cnt * SZ_RAN);
wr_bytes(fd, (char *) ran, cnt1 * SZ_RAN);
}