From 806413e887d6013aacf51a43f5e911d9a530bd55 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 21 Jan 2016 19:35:14 +0000 Subject: [PATCH] Fix compilation of malformed statements using array style notation. git-svn-id: https://svn.eduke32.com/eduke32@5575 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 12a67af41..55c6d4e4d 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -2038,13 +2038,16 @@ static int32_t C_GetNextValue(int32_t type) return 0; // literal value } -static int32_t C_GetStructureIndexes(int32_t labelsonly, hashtable_t *table) +static int32_t C_GetStructureIndexes(int32_t const labelsonly, hashtable_t const * const table) { - while ((*textptr != '[')) - textptr++; + C_SkipComments(); - if (*textptr == '[') - textptr++; + if (EDUKE32_PREDICT_FALSE(*textptr++ != '[')) + { + g_numCompilerErrors++; + C_ReportError(ERROR_SYNTAXERROR); + return -1; + } C_SkipComments(); @@ -2060,24 +2063,19 @@ static int32_t C_GetStructureIndexes(int32_t labelsonly, hashtable_t *table) g_labelsOnly = 0; } + textptr++; + + C_SkipComments(); + // now get name of .xxx - while (*textptr != '.') - { - if (*textptr == 0xa || !*textptr) - break; - textptr++; - } - - if (EDUKE32_PREDICT_FALSE(*textptr != '.')) + if (EDUKE32_PREDICT_FALSE(*textptr++ != '.')) { g_numCompilerErrors++; C_ReportError(ERROR_SYNTAXERROR); return -1; } - textptr++; - if (!table) return 0;