diff options
author | Zack Middleton <zturtleman@gmail.com> | 2013-06-02 21:55:19 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:32 +0100 |
commit | 9d80a63e44f513ec984375af62969a738a6bbee3 (patch) | |
tree | 417c1cfcd1b31256e7c4018918a0f8fb8f1a879c /src/qcommon | |
parent | f454aeaa8376d36e373eab69b877b67e8f9a661d (diff) |
Check for shaders without closing brace
Shaders without closing brace can eat shaders in other files.
Pass depth to SkipBracedSection instead of reparsing text as it messed up parse line numbers.
Diffstat (limited to 'src/qcommon')
-rw-r--r-- | src/qcommon/q_shared.c | 8 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c index 9cea9bda..ea365b55 100644 --- a/src/qcommon/q_shared.c +++ b/src/qcommon/q_shared.c @@ -553,16 +553,14 @@ void COM_MatchToken( char **buf_p, char *match ) { ================= SkipBracedSection -The next token should be an open brace. +The next token should be an open brace or set depth to 1 if already parsed it. Skips until a matching close brace is found. Internal brace depths are properly skipped. ================= */ -void SkipBracedSection (char **program) { +qboolean SkipBracedSection (char **program, int depth) { char *token; - int depth; - depth = 0; do { token = COM_ParseExt( program, qtrue ); if( token[1] == 0 ) { @@ -574,6 +572,8 @@ void SkipBracedSection (char **program) { } } } while( depth && *program ); + + return ( depth == 0 ); } /* diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index a85e3473..88322482 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -801,7 +801,7 @@ typedef struct pc_token_s void COM_MatchToken( char**buf_p, char *match ); -void SkipBracedSection (char **program); +qboolean SkipBracedSection (char **program, int depth); void SkipRestOfLine ( char **data ); void Parse1DMatrix (char **buf_p, int x, float *m); |