From af6f75dd04a98c5ee804a8f22d438d635291375f Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 22 Jun 2024 19:51:34 +0800 Subject: [PATCH] [server] Match `printstring(...)` --- server/amx/amxcons.c | 58 +++----------------------------------------- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/server/amx/amxcons.c b/server/amx/amxcons.c index 51fd36d..472c9cf 100644 --- a/server/amx/amxcons.c +++ b/server/amx/amxcons.c @@ -729,27 +729,7 @@ static int printstring(AMX *amx,cell *cstr,cell *params,int num) TCHAR cache[100]; int idx=0; - if ((ucell)*cstr>UNPACKEDMAX) { - int j=sizeof(cell)-sizeof(char); - char c; - /* the string is packed */ - i=0; - for ( ; ; ) { - c=(char)((ucell)cstr[i] >> 8*j); - if (c==0) - break; - assert(idx0) { cache[idx]='\0'; amx_putstr(cache); @@ -767,38 +747,7 @@ static int printstring(AMX *amx,cell *cstr,cell *params,int num) } else { - /* check whether this is a packed string */ - if ((ucell)*cstr>UNPACKEDMAX) { - int j=sizeof(cell)-sizeof(char); - char c; - /* the string is packed */ - i=0; - for ( ; ; ) { - c=(char)((ucell)cstr[i] >> 8*j); - if (c==0) - break; - switch (formatstate(c,&fmtstate,&sign,&decpoint,&width,&digits)) { - case -1: - amx_putchar(c); - break; - case 1: - assert(params!=NULL); - if (digits>25) - digits=25; - paramidx+=dochar(amx,c,params[paramidx],sign,decpoint,width,digits); - fmtstate=FMT_NONE; - break; - case 0: - if (params==NULL || paramidx>=num) /* insufficient parameters passed */ - amx_RaiseError(amx, AMX_ERR_NATIVE); - break; - } /* switch */ - if (j==0) - i++; - j=(j+sizeof(cell)-sizeof(char)) % sizeof(cell); - } /* for */ - } else { - /* the string is unpacked */ + /* unpacked */ for (i=0; cstr[i]!=0; i++) { switch (formatstate((TCHAR)cstr[i],&fmtstate,&sign,&decpoint,&width,&digits)) { case -1: @@ -815,7 +764,6 @@ static int printstring(AMX *amx,cell *cstr,cell *params,int num) break; } /* switch */ } /* for */ - } /* if */ } /* if (params==NULL) */