diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-06-01 21:25:02 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-01 21:25:02 +0000 |
| commit | a9848ce3fed7862d52b299b604535781e440eb4a (patch) | |
| tree | 775608b8fb1de72985a96ccdd288a971ceeea34a /utils/themeeditor/skin_parser.c | |
| parent | f52c9aae3a04ae4c767c2da1d788421686805fea (diff) | |
| download | rockbox-a9848ce3fed7862d52b299b604535781e440eb4a.zip rockbox-a9848ce3fed7862d52b299b604535781e440eb4a.tar.gz rockbox-a9848ce3fed7862d52b299b604535781e440eb4a.tar.bz2 rockbox-a9848ce3fed7862d52b299b604535781e440eb4a.tar.xz | |
Theme Editor: Put together a simple GUI to test going back and forth between a tree view and a text edit box
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26455 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/skin_parser.c')
| -rw-r--r-- | utils/themeeditor/skin_parser.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c index c0f1849..8e4bc88 100644 --- a/utils/themeeditor/skin_parser.c +++ b/utils/themeeditor/skin_parser.c @@ -53,7 +53,7 @@ int skin_parse_newline(struct skin_element* element, char** document); int skin_parse_comment(struct skin_element* element, char** document); struct skin_element* skin_parse_code_as_arg(char** document); -struct skin_element* skin_parse(char* document) +struct skin_element* skin_parse(const char* document) { struct skin_element* root = NULL; @@ -61,7 +61,7 @@ struct skin_element* skin_parse(char* document) struct skin_element** to_write = 0; - char* cursor = document; /* Keeps track of location in the document */ + char* cursor = (char*)document; /*Keeps track of location in the document*/ skin_line = 1; @@ -738,18 +738,20 @@ int skin_parse_comment(struct skin_element* element, char** document) */ for(length = 0; cursor[length] != '\n' && cursor[length] != '\0'; length++); - length--; element->type = COMMENT; element->line = skin_line; element->text = skin_alloc_string(length); /* We copy from one char past cursor to leave out the # */ - memcpy((void*)(element->text), (void*)(cursor + 1), sizeof(char) * length); - element->text[length] = '\0'; + memcpy((void*)(element->text), (void*)(cursor + 1), + sizeof(char) * (length-1)); + element->text[length - 1] = '\0'; - if(cursor[length + 1] == '\n') + if(cursor[length] == '\n') skin_line++; - *document += (length + 2); /* Move cursor up past # and all text */ + *document += (length); /* Move cursor up past # and all text */ + if(**document == '\n') + (*document)++; return 1; } |