1
0
Fork 0
forked from len0rd/rockbox

initialise the element->type value so TAG types dont accidently get VIEWPORT if it element->type == 0 at alloc time

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26825 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-06-13 03:13:01 +00:00
parent 3f06273e7c
commit 35b09cb615
4 changed files with 12 additions and 1 deletions

View file

@ -106,7 +106,8 @@ QString ParseTreeNode::genCode() const
{ {
switch(element->type) switch(element->type)
{ {
case UNKNOWN:
break;
case VIEWPORT: case VIEWPORT:
/* Generating the Viewport tag, if necessary */ /* Generating the Viewport tag, if necessary */
if(element->tag) if(element->tag)
@ -263,6 +264,8 @@ int ParseTreeNode::genHash() const
hash += element->type; hash += element->type;
switch(element->type) switch(element->type)
{ {
case UNKNOWN:
break;
case VIEWPORT: case VIEWPORT:
case LINE: case LINE:
case SUBLINES: case SUBLINES:
@ -346,6 +349,8 @@ QVariant ParseTreeNode::data(int column) const
{ {
switch(element->type) switch(element->type)
{ {
case UNKNOWN:
return QObject::tr("Unknown");
case VIEWPORT: case VIEWPORT:
return QObject::tr("Viewport"); return QObject::tr("Viewport");
@ -397,6 +402,7 @@ QVariant ParseTreeNode::data(int column) const
{ {
switch(element->type) switch(element->type)
{ {
case UNKNOWN:
case VIEWPORT: case VIEWPORT:
case LINE: case LINE:
case SUBLINES: case SUBLINES:

View file

@ -112,6 +112,9 @@ void skin_debug_tree(struct skin_element* root)
switch(current->type) switch(current->type)
{ {
case UNKNOWN:
printf("[ Unknown element.. error\n]");
break;
case VIEWPORT: case VIEWPORT:
printf("[ Viewport \n"); printf("[ Viewport \n");

View file

@ -860,6 +860,7 @@ struct skin_element* skin_alloc_element()
{ {
struct skin_element* retval = (struct skin_element*) struct skin_element* retval = (struct skin_element*)
skin_alloc(sizeof(struct skin_element)); skin_alloc(sizeof(struct skin_element));
retval->type = UNKNOWN;
retval->next = NULL; retval->next = NULL;
retval->tag = NULL; retval->tag = NULL;
retval->params_count = 0; retval->params_count = 0;

View file

@ -35,6 +35,7 @@ extern "C"
/* Possible types of element in a WPS file */ /* Possible types of element in a WPS file */
enum skin_element_type enum skin_element_type
{ {
UNKNOWN = -1,
VIEWPORT, VIEWPORT,
LINE, LINE,
SUBLINES, SUBLINES,