diff options
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 07f38bbee5..5ecbda1315 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -668,7 +668,8 @@ static int parse_viewport(const char *wps_bufptr, | |||
668 | skin_vp->label = VP_NO_LABEL; | 668 | skin_vp->label = VP_NO_LABEL; |
669 | skin_vp->pb = NULL; | 669 | skin_vp->pb = NULL; |
670 | skin_vp->lines = NULL; | 670 | skin_vp->lines = NULL; |
671 | 671 | if (curr_line) | |
672 | curr_line->curr_subline->last_token_idx = wps_data->num_tokens; | ||
672 | curr_line = NULL; | 673 | curr_line = NULL; |
673 | if (!skin_start_new_line(skin_vp, wps_data->num_tokens)) | 674 | if (!skin_start_new_line(skin_vp, wps_data->num_tokens)) |
674 | return WPS_ERROR_INVALID_PARAM; | 675 | return WPS_ERROR_INVALID_PARAM; |
@@ -1346,7 +1347,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1346 | while (*wps_bufptr && !fail) | 1347 | while (*wps_bufptr && !fail) |
1347 | { | 1348 | { |
1348 | /* first make sure there is enough room for tokens */ | 1349 | /* first make sure there is enough room for tokens */ |
1349 | if (max_tokens -1 == data->num_tokens) | 1350 | if (max_tokens <= data->num_tokens + 5) |
1350 | { | 1351 | { |
1351 | int extra_tokens = TOKEN_BLOCK_SIZE; | 1352 | int extra_tokens = TOKEN_BLOCK_SIZE; |
1352 | size_t needed = extra_tokens * sizeof(struct wps_token); | 1353 | size_t needed = extra_tokens * sizeof(struct wps_token); |
@@ -1552,12 +1553,12 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1552 | fail = PARSE_FAIL_LIMITS_EXCEEDED; | 1553 | fail = PARSE_FAIL_LIMITS_EXCEEDED; |
1553 | 1554 | ||
1554 | /* Success! */ | 1555 | /* Success! */ |
1556 | curr_line->curr_subline->last_token_idx = data->num_tokens; | ||
1557 | data->tokens[data->num_tokens++].type = WPS_NO_TOKEN; | ||
1555 | /* freeup unused tokens */ | 1558 | /* freeup unused tokens */ |
1556 | skin_buffer_free_from_front(sizeof(struct wps_token) | 1559 | skin_buffer_free_from_front(sizeof(struct wps_token) |
1557 | * (max_tokens - data->num_tokens)); | 1560 | * (max_tokens - data->num_tokens)); |
1558 | /* close the last subline */ | 1561 | |
1559 | curr_line->curr_subline->last_token_idx = data->num_tokens; | ||
1560 | |||
1561 | #if defined(DEBUG) || defined(SIMULATOR) | 1562 | #if defined(DEBUG) || defined(SIMULATOR) |
1562 | if (debug) | 1563 | if (debug) |
1563 | print_debug_info(data, fail, line_number); | 1564 | print_debug_info(data, fail, line_number); |