forked from len0rd/rockbox
Theme Editor: Implemented JdGordon's tag newline-eating mechanism
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27210 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7da040bf22
commit
7dfd0c0651
3 changed files with 29 additions and 13 deletions
|
|
@ -456,8 +456,18 @@ static int skin_parse_tag(struct skin_element* element, char** document)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Eating a newline if necessary */
|
||||
if(tag_args[0] == '\n')
|
||||
{
|
||||
if(*cursor == '\n')
|
||||
cursor++;
|
||||
*document = cursor;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Checking the number of arguments and allocating args */
|
||||
if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|')
|
||||
if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|'
|
||||
&& tag_args[0] != '\n')
|
||||
{
|
||||
skin_error(ARGLIST_EXPECTED);
|
||||
return 0;
|
||||
|
|
@ -505,7 +515,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
|
|||
for(i = 0; i < num_args; i++)
|
||||
{
|
||||
/* Making sure we haven't run out of arguments */
|
||||
if(*tag_args == '\0')
|
||||
if(*tag_args == '\0' || *tag_args == '\n')
|
||||
{
|
||||
skin_error(TOO_MANY_ARGS);
|
||||
return 0;
|
||||
|
|
@ -604,12 +614,16 @@ static int skin_parse_tag(struct skin_element* element, char** document)
|
|||
}
|
||||
|
||||
/* Checking for a premature end */
|
||||
if(*tag_args != '\0' && !optional)
|
||||
if(*tag_args != '\0' && *tag_args != '\n' && !optional)
|
||||
{
|
||||
skin_error(INSUFFICIENT_ARGS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(*tag_args == '\n')
|
||||
if(*cursor == '\n')
|
||||
cursor++;
|
||||
|
||||
*document = cursor;
|
||||
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue