From d7372533d07c3168715f9efdace76da1d3983fee Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 25 Sep 2011 07:43:36 +0000 Subject: [PATCH] Partial fix for FS#12289 - comment lines would waste lots of buffer space. Still not perfect but should get 90+% of comments completly ignored now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30596 a1c6a512-1295-4272-9138-f99709370657 --- lib/skin_parser/skin_parser.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c index c4bd78c8ee..7408252949 100644 --- a/lib/skin_parser/skin_parser.c +++ b/lib/skin_parser/skin_parser.c @@ -93,7 +93,6 @@ struct skin_element* skin_parse(const char* document) while(*cursor != '\0') { - if(!root) to_write = &root; else @@ -227,7 +226,17 @@ static struct skin_element* skin_parse_viewport(const char** document) } else { - +#ifdef ROCKBOX + /* strip all leading comments */ + while(*cursor == '#') + { + skip_comment(&cursor); + skin_line++; + + } + if (check_viewport(cursor)) + break; +#endif *to_write = skin_parse_line(&cursor); last = *to_write; if(!last) @@ -243,6 +252,18 @@ static struct skin_element* skin_parse_viewport(const char** document) cursor++; skin_line++; } +#ifdef ROCKBOX + /* strip all comments */ + while(*cursor == '#') + { + skip_comment(&cursor); + skin_line++; + + } + if (check_viewport(cursor)) + break; +#endif + } while(*cursor != '\0' && !(check_viewport(cursor) && cursor != *document)); @@ -359,7 +380,6 @@ static struct skin_element* skin_parse_line_optional(const char** document, } } - /* Moving up the calling function's pointer */ *document = cursor;