From ef255c9a3e29c6121e545221f5d0621814e48d68 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 30 May 2009 19:41:34 -0400 Subject: [PATCH] Fixed compiler erroring when tagging functions for string return (bug 3837, r+a12=fyren). --- sourcepawn/compiler/sc1.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 5df0aea5..28c6606d 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -6407,7 +6407,7 @@ static void doreturn(void) } /* if */ } else { int idxtag[sDIMEN_MAX]; - int argcount; + int argcount, slength=0; /* this function does not yet have an array attached; clone the * returned symbol beneath the current function */ @@ -6425,6 +6425,8 @@ static void doreturn(void) if (dim[numdim]<=0) error(46,sym->name); } /* for */ + if (sym->tag==pc_tag_string && numdim!=0) + slength=dim[numdim-1]; /* the address of the array is stored in a hidden parameter; the address * of this parameter is 1 + the number of parameters (times the size of * a cell) + the size of the stack frame and the return address @@ -6440,7 +6442,7 @@ static void doreturn(void) assert(curfunc->dim.arglist!=NULL); for (argcount=0; curfunc->dim.arglist[argcount].ident!=0; argcount++) /* nothing */; - sub=addvariable(curfunc->name,(argcount+3)*sizeof(cell),iREFARRAY,sGLOBAL,curfunc->tag,dim,numdim,idxtag); + sub=addvariable2(curfunc->name,(argcount+3)*sizeof(cell),iREFARRAY,sGLOBAL,curfunc->tag,dim,numdim,idxtag,slength); sub->parent=curfunc; } /* if */ /* get the hidden parameter, copy the array (the array is on the heap;