From 62f08cabe916deb898358b59287fa93cce2896e7 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 23 Apr 2006 02:30:33 +0000 Subject: [PATCH] Define a MAXQUOTELEN as 64 and use that instead of specific limits git-svn-id: https://svn.eduke32.com/eduke32@93 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/duke3d.h | 2 ++ polymer/eduke32/source/gamedef.c | 8 ++++---- polymer/eduke32/source/gameexec.c | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 86732198f..93e560dec 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -431,6 +431,8 @@ extern short int global_random; extern long scaredfallz; extern char buf[1024]; //My own generic input buffer +#define MAXQUOTELEN 64 + extern char *fta_quotes[NUMOFFIRSTTIMEACTIVE]; extern char scantoasc[128],ready2send; extern char scantoascwithshift[128]; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 7c890a562..e4f30aaa4 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -4541,7 +4541,7 @@ repeatcase: if (tw == CON_DEFINEQUOTE) { if(fta_quotes[k] == NULL) - fta_quotes[k] = Bmalloc(sizeof(char) * 64); + fta_quotes[k] = Bmalloc(sizeof(char) * MAXQUOTELEN); scriptptr--; } @@ -4554,7 +4554,7 @@ repeatcase: { redefined_quote_count++; if(redefined_quotes[redefined_quote_count] == NULL) - redefined_quotes[redefined_quote_count] = Bmalloc(sizeof(char) * 64); + redefined_quotes[redefined_quote_count] = Bmalloc(sizeof(char) * MAXQUOTELEN); } while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) @@ -4571,9 +4571,9 @@ repeatcase: else *(redefined_quotes[redefined_quote_count]+i) = *textptr; textptr++,i++; - if(i >= 63) + if(i >= MAXQUOTELEN-1) { - initprintf("%s:%ld: error: quote text exceeds limit of %ld characters.\n",compilefile,line_number,63); + initprintf("%s:%ld: error: quote text exceeds limit of %ld characters.\n",compilefile,line_number,MAXQUOTELEN-1); error++; while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 4832a059f..9d77c8479 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -4113,10 +4113,10 @@ SKIPJIBS: Bsprintf(fta_quotes[i],"%d",j); break; case CON_QSTRCAT: - Bmemcpy(tempbuf,fta_quotes[i],64); - Bmemcpy(buf,fta_quotes[j],64); - Bstrncat(tempbuf,buf,63-Bstrlen(tempbuf)); - Bmemcpy(fta_quotes[i],tempbuf,64); + Bmemcpy(tempbuf,fta_quotes[i],MAXQUOTELEN); + Bmemcpy(buf,fta_quotes[j],MAXQUOTELEN); + Bstrncat(tempbuf,buf,(MAXQUOTELEN-1)-Bstrlen(tempbuf)); + Bmemcpy(fta_quotes[i],tempbuf,MAXQUOTELEN); break; case CON_QSTRCPY: Bstrcpy(fta_quotes[j],fta_quotes[i]);