forked from len0rd/rockbox
[Fix Yellow] remove DEBUGF from skin_parser.c cleanup spaces
move const to the proper side Change-Id: Ide7c1878281eaee28d06426eee43041ad61acbc4
This commit is contained in:
parent
68d4fd0e5b
commit
793c797447
8 changed files with 54 additions and 58 deletions
|
|
@ -71,7 +71,7 @@ static void skip_whitespace(const char** document)
|
|||
}
|
||||
|
||||
#ifdef ROCKBOX
|
||||
struct skin_element* skin_parse(const char* document,
|
||||
struct skin_element* skin_parse(const char* document,
|
||||
skin_callback cb, void* cb_data)
|
||||
{
|
||||
callback = cb;
|
||||
|
|
@ -84,7 +84,7 @@ struct skin_element* skin_parse(const char* document)
|
|||
struct skin_element* last = NULL;
|
||||
|
||||
const char* cursor = document; /*Keeps track of location in the document*/
|
||||
|
||||
|
||||
skin_line = 1;
|
||||
skin_start = (char*)document;
|
||||
viewport_line = 0;
|
||||
|
|
@ -227,7 +227,7 @@ static struct skin_element* skin_parse_viewport(const char** document)
|
|||
{
|
||||
skip_comment(&cursor);
|
||||
skin_line++;
|
||||
|
||||
|
||||
}
|
||||
if (check_viewport(cursor))
|
||||
break;
|
||||
|
|
@ -263,7 +263,7 @@ static struct skin_element* skin_parse_viewport(const char** document)
|
|||
{
|
||||
skip_comment(&cursor);
|
||||
skin_line++;
|
||||
|
||||
|
||||
}
|
||||
if (check_viewport(cursor))
|
||||
break;
|
||||
|
|
@ -394,7 +394,7 @@ static struct skin_element* skin_parse_line_optional(const char** document,
|
|||
|
||||
/* Moving up the calling function's pointer */
|
||||
*document = cursor;
|
||||
|
||||
|
||||
if(root)
|
||||
{
|
||||
children[0] = skin_buffer_to_offset(root);
|
||||
|
|
@ -540,7 +540,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
|
|||
|| (tag_args[0] == '|' && *cursor != ARGLISTOPENSYM)
|
||||
|| (qmark && *cursor != ARGLISTOPENSYM))
|
||||
{
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
if (callback)
|
||||
{
|
||||
|
|
@ -622,7 +622,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
|
|||
|
||||
if (*tag_args == '[')
|
||||
{
|
||||
/* we need to guess which type of param it is.
|
||||
/* we need to guess which type of param it is.
|
||||
* guess using this priority:
|
||||
* default > decimal/integer > single tag/code > string
|
||||
*/
|
||||
|
|
@ -644,7 +644,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
|
|||
{
|
||||
haspercent = haspercent || (cursor[j] == '%');
|
||||
hasdecimal = hasdecimal || (cursor[j] == '.');
|
||||
number = number && (isdigit(cursor[j]) ||
|
||||
number = number && (isdigit(cursor[j]) ||
|
||||
(cursor[j] == '.') ||
|
||||
(cursor[j] == '-') ||
|
||||
(cursor[j] == '%'));
|
||||
|
|
@ -664,12 +664,12 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
|
|||
{
|
||||
type_code = 'p';
|
||||
}
|
||||
else if (number &&
|
||||
else if (number &&
|
||||
(strchr(temp_params, 'i') || strchr(temp_params, 'd')))
|
||||
{
|
||||
type_code = strchr(temp_params, 'i') ? 'i' : 'd';
|
||||
}
|
||||
else if (haspercent &&
|
||||
else if (haspercent &&
|
||||
(strchr(temp_params, 't') || strchr(temp_params, 'c')))
|
||||
{
|
||||
type_code = strchr(temp_params, 't') ? 't' : 'c';
|
||||
|
|
@ -682,7 +682,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
|
|||
{
|
||||
skin_error(INSUFFICIENT_ARGS, cursor);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
type_code = *tag_args;
|
||||
|
|
@ -778,7 +778,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
|
|||
params[i].type = CODE;
|
||||
params[i].data.code = skin_buffer_to_offset(child);
|
||||
}
|
||||
|
||||
|
||||
|
||||
skip_whitespace(&cursor);
|
||||
|
||||
|
|
@ -884,7 +884,7 @@ static int skin_parse_text(struct skin_element* element, const char** document,
|
|||
element->data = skin_buffer_to_offset(text);
|
||||
if (element->data < 0)
|
||||
return 0;
|
||||
|
||||
|
||||
for(dest = 0; dest < length; dest++)
|
||||
{
|
||||
/* Advancing cursor if we've encountered an escaped character */
|
||||
|
|
@ -895,7 +895,7 @@ static int skin_parse_text(struct skin_element* element, const char** document,
|
|||
cursor++;
|
||||
}
|
||||
text[length] = '\0';
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
if (callback)
|
||||
{
|
||||
|
|
@ -918,7 +918,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
|
|||
const char* bookmark;
|
||||
int children = 1;
|
||||
int i;
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
bool feature_available = true;
|
||||
const char *false_branch = NULL;
|
||||
|
|
@ -953,7 +953,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Counting the children */
|
||||
if(*(cursor++) != ENUMLISTOPENSYM)
|
||||
{
|
||||
|
|
@ -991,7 +991,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
|
|||
}
|
||||
}
|
||||
#ifdef ROCKBOX
|
||||
if (*cursor == ENUMLISTCLOSESYM &&
|
||||
if (*cursor == ENUMLISTCLOSESYM &&
|
||||
false_branch == NULL && !feature_available)
|
||||
{
|
||||
false_branch = cursor+1;
|
||||
|
|
@ -1009,11 +1009,11 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
|
|||
cursor = bookmark;
|
||||
#endif
|
||||
/* Parsing the children */
|
||||
|
||||
|
||||
/* Feature tags could end up having 0 children which breaks
|
||||
* the render in dangerous ways. Minor hack, but insert an empty
|
||||
* child. (e.g %?xx<foo> when xx isnt available ) */
|
||||
|
||||
|
||||
if (children == 0)
|
||||
{
|
||||
const char* emptyline= "";
|
||||
|
|
@ -1025,7 +1025,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
|
|||
children_array[0] = skin_buffer_to_offset(skin_parse_code_as_arg(&emptyline));
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
children_array = skin_alloc_children(children);
|
||||
if (!children_array)
|
||||
return 0;
|
||||
|
|
@ -1085,9 +1085,9 @@ static int skin_parse_comment(struct skin_element* element, const char** documen
|
|||
|
||||
element->type = COMMENT;
|
||||
element->line = skin_line;
|
||||
#ifdef ROCKBOX
|
||||
#ifdef ROCKBOX
|
||||
element->data = INVALID_OFFSET;
|
||||
#else
|
||||
#else
|
||||
element->data = text = skin_alloc_string(length);
|
||||
if (!element->data)
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue