From ae0a8461b70e2d4edc7faa1378a3c61b6d3840d5 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 23 Jan 2008 00:37:56 +0000 Subject: [PATCH] Black's fix for #define macro parameters in fteqcc. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2868 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qcc_pr_lex.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index 7cd8e2325..b6519abf1 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -2026,6 +2026,13 @@ int QCC_PR_CheakCompConst(void) start = pr_file_p; while(1) { + // handle strings correctly by ignoring them + if (*pr_file_p == '\"') + { + do { + pr_file_p++; + } while( (pr_file_p[-1] == '\\' || pr_file_p[0] != '\"') && *pr_file_p && *pr_file_p != '\n' ); + } if (*pr_file_p == '(') plevel++; else if (!plevel && (*pr_file_p == ',' || *pr_file_p == ')')) @@ -2042,6 +2049,8 @@ int QCC_PR_CheakCompConst(void) pr_file_p++; while(*pr_file_p == ' ' || *pr_file_p == '\t') pr_file_p++; + // move back by one char because we move forward by one at the end of the loop + pr_file_p--; if (param == MAXCONSTANTPARAMS) QCC_PR_ParseError(ERR_TOOMANYPARAMS, "Too many parameters in macro call"); } else if (*pr_file_p == ')' ) @@ -2110,7 +2119,6 @@ int QCC_PR_CheakCompConst(void) for (p = 0; p < param; p++) { - if (!STRCMP(qcc_token, c->params[p])) { strcat(buffer, paramoffset[p]);