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
This commit is contained in:
terminx 2006-04-23 02:30:33 +00:00
parent 8d6f8eecda
commit 62f08cabe9
3 changed files with 10 additions and 8 deletions

View file

@ -431,6 +431,8 @@ extern short int global_random;
extern long scaredfallz; extern long scaredfallz;
extern char buf[1024]; //My own generic input buffer extern char buf[1024]; //My own generic input buffer
#define MAXQUOTELEN 64
extern char *fta_quotes[NUMOFFIRSTTIMEACTIVE]; extern char *fta_quotes[NUMOFFIRSTTIMEACTIVE];
extern char scantoasc[128],ready2send; extern char scantoasc[128],ready2send;
extern char scantoascwithshift[128]; extern char scantoascwithshift[128];

View file

@ -4541,7 +4541,7 @@ repeatcase:
if (tw == CON_DEFINEQUOTE) if (tw == CON_DEFINEQUOTE)
{ {
if(fta_quotes[k] == NULL) if(fta_quotes[k] == NULL)
fta_quotes[k] = Bmalloc(sizeof(char) * 64); fta_quotes[k] = Bmalloc(sizeof(char) * MAXQUOTELEN);
scriptptr--; scriptptr--;
} }
@ -4554,7 +4554,7 @@ repeatcase:
{ {
redefined_quote_count++; redefined_quote_count++;
if(redefined_quotes[redefined_quote_count] == NULL) 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 ) while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 )
@ -4571,9 +4571,9 @@ repeatcase:
else else
*(redefined_quotes[redefined_quote_count]+i) = *textptr; *(redefined_quotes[redefined_quote_count]+i) = *textptr;
textptr++,i++; 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++; error++;
while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++;
break; break;

View file

@ -4113,10 +4113,10 @@ SKIPJIBS:
Bsprintf(fta_quotes[i],"%d",j); Bsprintf(fta_quotes[i],"%d",j);
break; break;
case CON_QSTRCAT: case CON_QSTRCAT:
Bmemcpy(tempbuf,fta_quotes[i],64); Bmemcpy(tempbuf,fta_quotes[i],MAXQUOTELEN);
Bmemcpy(buf,fta_quotes[j],64); Bmemcpy(buf,fta_quotes[j],MAXQUOTELEN);
Bstrncat(tempbuf,buf,63-Bstrlen(tempbuf)); Bstrncat(tempbuf,buf,(MAXQUOTELEN-1)-Bstrlen(tempbuf));
Bmemcpy(fta_quotes[i],tempbuf,64); Bmemcpy(fta_quotes[i],tempbuf,MAXQUOTELEN);
break; break;
case CON_QSTRCPY: case CON_QSTRCPY:
Bstrcpy(fta_quotes[j],fta_quotes[i]); Bstrcpy(fta_quotes[j],fta_quotes[i]);