scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit cb030d7568ec1aa5483c07f127f8c5db3cfb9f68
parent a175b3caf5123f49cca0593c4be90f882451ad65
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 30 Oct 2021 05:49:29 +0200

libmach/coff32: Use int for index in coff32getsym()

The prototype of getsym() includes an integer pointer
for the index. Several binary formats use bigger data
types for indexes, but in practical cases having a bigger
value does not work because it would require too much
memory to have the full symbol table in memory. Coff32
was converting the index value into long, because the
index value used by coff32 has long type, but it does
not make sense because it will not increase the range
already limited by the prototype of the function.

Diffstat:
Msrc/libmach/coff32/coff32getsym.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libmach/coff32/coff32getsym.c b/src/libmach/coff32/coff32getsym.c @@ -55,7 +55,7 @@ symname(Coff32 *coff, SYMENT *ent) Symbol * coff32getsym(Obj *obj, int *idx, Symbol *sym) { - long n = *idx; + int n = *idx; SYMENT *ent; Coff32 *coff = obj->data; FILHDR *hdr = &coff->hdr;