# HG changeset patch # User lost # Date 1235967229 0 # Node ID 0395e6fd67e960bd0067c461d03a328381f6ce7c # Parent 47427342e41dcdcbecf0d8ff0d6097bf06b34fd3 Fixed stupid errors with changes for archive handling diff -r 47427342e41d -r 0395e6fd67e9 lwlink/link.c --- a/lwlink/link.c Sun Mar 01 22:59:52 2009 +0000 +++ b/lwlink/link.c Mon Mar 02 04:13:49 2009 +0000 @@ -52,7 +52,7 @@ nsects++; } } - for (sn = 0; sn < fn -> nsubs; fn++) + for (sn = 0; sn < fn -> nsubs; sn++) { check_section_name(name, base, fn -> subs[sn]); } @@ -79,7 +79,7 @@ // and then continue looking for sections } - for (sn = 0; sn < fn -> nsubs; fn++) + for (sn = 0; sn < fn -> nsubs; sn++) { check_section_flags(yesflags, noflags, base, fn -> subs[sn]); } @@ -273,11 +273,14 @@ { // external symbol // read all files in order until found (or not found) - for (fp = sect -> file; fp; fp = fp -> parent) + if (sect) { - s = find_external_sym_recurse(sym, fp); - if (s) - return s; + for (fp = sect -> file; fp; fp = fp -> parent) + { + s = find_external_sym_recurse(sym, fp); + if (s) + return s; + } } for (fn = 0; fn < ninputfiles; fn++) diff -r 47427342e41d -r 0395e6fd67e9 lwlink/readfiles.c --- a/lwlink/readfiles.c Sun Mar 01 22:59:52 2009 +0000 +++ b/lwlink/readfiles.c Mon Mar 02 04:13:49 2009 +0000 @@ -340,9 +340,11 @@ if (cc >= fn -> filesize || !(fn -> filedata[cc])) return; - for (l = cc; cc < fn -> filesize && fn -> filedata[cc]; l++) + for (l = cc; cc < fn -> filesize && fn -> filedata[cc]; cc++) /* do nothing */ ; + cc++; + if (cc >= fn -> filesize) { fprintf(stderr, "Malformed archive file %s.\n", fn -> filename); @@ -352,8 +354,10 @@ if (cc + 4 > fn -> filesize) return; - flen = (fn -> filedata[cc++] << 24) | (fn -> filedata[cc++] << 16) - | (fn -> filedata[cc++] << 8) | (fn -> filedata[cc]); + flen = (fn -> filedata[cc++] << 24); + flen |= (fn -> filedata[cc++] << 16); + flen |= (fn -> filedata[cc++] << 8); + flen |= (fn -> filedata[cc++]); if (flen == 0) return; @@ -372,7 +376,9 @@ fn -> subs[fn -> nsubs] -> filesize = flen; fn -> subs[fn -> nsubs] -> filename = lw_strdup(fn -> filedata + l); fn -> subs[fn -> nsubs] -> parent = fn; + read_file(fn -> subs[fn -> nsubs]); fn -> nsubs++; + cc += flen; } }