scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 81111ecaf950ecfa89c3869ce65bcc0991af712a
parent dbf3b13007e75ee9c262775c84a3cf2a6b964c21
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 27 Nov 2017 19:26:54 +0100

[lib/scc] Fix read myro header

Diffstat:
Mlib/scc/lunpack.c | 2+-
Mlib/scc/rmyro.c | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/scc/lunpack.c b/lib/scc/lunpack.c @@ -53,5 +53,5 @@ lunpack(unsigned char *src, char *fmt, ...) } va_end(va); - return src - bp; + return bp - src; } diff --git a/lib/scc/rmyro.c b/lib/scc/rmyro.c @@ -16,15 +16,15 @@ rdmyrohdr(FILE *fp, struct myrohdr *hdr) fread(buf, sizeof(buf), 1, fp); if (ferror(fp)) return EOF; - strncpy(hdr->magic, buf, MYROMAGIC_SIZ); - len = lunpack(buf + MYROMAGIC_SIZ, "lqqqqq", + len = lunpack(buf, "cccclqqqqq", + hdr->magic+0, hdr->magic+1, + hdr->magic+2, hdr->magic+3, &hdr->format, &hdr->entry, &hdr->strsize, &hdr->secsize, &hdr->symsize, &hdr->relsize); - len += MYROMAGIC_SIZ; assert(len == MYROHDR_SIZ); return len;