From a9b3da5904d7e1f53accdb930a5d5fca00580380 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 1 Aug 2006 19:49:33 +0000 Subject: [PATCH] fixed a bug with stub offsets being calculated wrong --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4050 --- sourcepawn/compiler/pawncc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sourcepawn/compiler/pawncc.c b/sourcepawn/compiler/pawncc.c index 43030f13..a64ac5aa 100644 --- a/sourcepawn/compiler/pawncc.c +++ b/sourcepawn/compiler/pawncc.c @@ -174,17 +174,19 @@ int main(int argc, char *argv[]) { sp_file_publics_t *pbtbl; AMX_FUNCSTUBNT *stub; + unsigned char *stubptr; uint32_t publics = sections[FS_Publics]; pbtbl = (sp_file_publics_t *)malloc(sizeof(sp_file_publics_t) * publics); - stub = (AMX_FUNCSTUBNT *)((unsigned char *)hdr + hdr->publics); + stubptr = (unsigned char *)hdr + hdr->publics; for (i=0; iaddress; pbtbl[i].name = stub->nameofs - (hdr->nametable + sizeof(uint16_t)); - stub += hdr->defsize; + stubptr += hdr->defsize; } if (publics) { @@ -199,17 +201,19 @@ int main(int argc, char *argv[]) { sp_file_pubvars_t *pbvars; AMX_FUNCSTUBNT *stub; + unsigned char *stubptr; uint32_t pubvars = sections[FS_Pubvars]; pbvars = (sp_file_pubvars_t *)malloc(sizeof(sp_file_pubvars_t) * pubvars); - stub = (AMX_FUNCSTUBNT *)((unsigned char *)hdr + hdr->pubvars); + stubptr = (unsigned char *)hdr + hdr->pubvars; for (i=0; iaddress; pbvars[i].name = stub->nameofs - (hdr->nametable + sizeof(uint16_t)); - stub += hdr->defsize; + stubptr += hdr->defsize; } if (pubvars) { @@ -223,16 +227,18 @@ int main(int argc, char *argv[]) { sp_file_natives_t *nvtbl; AMX_FUNCSTUBNT *stub; + unsigned char *stubptr; uint32_t natives = (hdr->libraries - hdr->natives) / hdr->defsize; nvtbl = (sp_file_natives_t *)malloc(sizeof(sp_file_natives_t) * natives); - stub = (AMX_FUNCSTUBNT *)((unsigned char *)hdr + hdr->natives); + stubptr = (unsigned char *)hdr + hdr->natives; for (i=0; inameofs - (hdr->nametable + sizeof(uint16_t)); - stub += hdr->defsize; + stubptr += hdr->defsize; } if (natives) {