From bf3dfc16773f631131f5dcce265acd9fc70c22d0 Mon Sep 17 00:00:00 2001 From: jdgordon Date: Sun, 13 Jun 2010 03:13:01 +0000 Subject: [PATCH] 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 --- utils/themeeditor/parsetreenode.cpp | 8 +++++++- utils/themeeditor/skin_debug.c | 3 +++ utils/themeeditor/skin_parser.c | 1 + utils/themeeditor/skin_parser.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/utils/themeeditor/parsetreenode.cpp b/utils/themeeditor/parsetreenode.cpp index d3a1a71c9..397031aee 100644 --- a/utils/themeeditor/parsetreenode.cpp +++ b/utils/themeeditor/parsetreenode.cpp @@ -106,7 +106,8 @@ QString ParseTreeNode::genCode() const { switch(element->type) { - + case UNKNOWN: + break; case VIEWPORT: /* Generating the Viewport tag, if necessary */ if(element->tag) @@ -263,6 +264,8 @@ int ParseTreeNode::genHash() const hash += element->type; switch(element->type) { + case UNKNOWN: + break; case VIEWPORT: case LINE: case SUBLINES: @@ -346,6 +349,8 @@ QVariant ParseTreeNode::data(int column) const { switch(element->type) { + case UNKNOWN: + return QObject::tr("Unknown"); case VIEWPORT: return QObject::tr("Viewport"); @@ -397,6 +402,7 @@ QVariant ParseTreeNode::data(int column) const { switch(element->type) { + case UNKNOWN: case VIEWPORT: case LINE: case SUBLINES: diff --git a/utils/themeeditor/skin_debug.c b/utils/themeeditor/skin_debug.c index 9a463c91e..549f7b9e6 100644 --- a/utils/themeeditor/skin_debug.c +++ b/utils/themeeditor/skin_debug.c @@ -112,6 +112,9 @@ void skin_debug_tree(struct skin_element* root) switch(current->type) { + case UNKNOWN: + printf("[ Unknown element.. error\n]"); + break; case VIEWPORT: printf("[ Viewport \n"); diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c index bf7ca8d7f..93a71919b 100644 --- a/utils/themeeditor/skin_parser.c +++ b/utils/themeeditor/skin_parser.c @@ -860,6 +860,7 @@ struct skin_element* skin_alloc_element() { struct skin_element* retval = (struct skin_element*) skin_alloc(sizeof(struct skin_element)); + retval->type = UNKNOWN; retval->next = NULL; retval->tag = NULL; retval->params_count = 0; diff --git a/utils/themeeditor/skin_parser.h b/utils/themeeditor/skin_parser.h index c15ba9da8..1fc4a7ae6 100644 --- a/utils/themeeditor/skin_parser.h +++ b/utils/themeeditor/skin_parser.h @@ -35,6 +35,7 @@ extern "C" /* Possible types of element in a WPS file */ enum skin_element_type { + UNKNOWN = -1, VIEWPORT, LINE, SUBLINES, -- 2.11.4.GIT