summaryrefslogtreecommitdiff
path: root/utils/themeeditor/skin_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/skin_parser.c')
-rw-r--r--utils/themeeditor/skin_parser.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c
index c0f1849523..8e4bc88e96 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);
53int skin_parse_comment(struct skin_element* element, char** document); 53int skin_parse_comment(struct skin_element* element, char** document);
54struct skin_element* skin_parse_code_as_arg(char** document); 54struct skin_element* skin_parse_code_as_arg(char** document);
55 55
56struct skin_element* skin_parse(char* document) 56struct skin_element* skin_parse(const char* document)
57{ 57{
58 58
59 struct skin_element* root = NULL; 59 struct skin_element* root = NULL;
@@ -61,7 +61,7 @@ struct skin_element* skin_parse(char* document)
61 61
62 struct skin_element** to_write = 0; 62 struct skin_element** to_write = 0;
63 63
64 char* cursor = document; /* Keeps track of location in the document */ 64 char* cursor = (char*)document; /*Keeps track of location in the document*/
65 65
66 skin_line = 1; 66 skin_line = 1;
67 67
@@ -738,18 +738,20 @@ int skin_parse_comment(struct skin_element* element, char** document)
738 */ 738 */
739 for(length = 0; cursor[length] != '\n' && cursor[length] != '\0'; length++); 739 for(length = 0; cursor[length] != '\n' && cursor[length] != '\0'; length++);
740 740
741 length--;
742 element->type = COMMENT; 741 element->type = COMMENT;
743 element->line = skin_line; 742 element->line = skin_line;
744 element->text = skin_alloc_string(length); 743 element->text = skin_alloc_string(length);
745 /* We copy from one char past cursor to leave out the # */ 744 /* We copy from one char past cursor to leave out the # */
746 memcpy((void*)(element->text), (void*)(cursor + 1), sizeof(char) * length); 745 memcpy((void*)(element->text), (void*)(cursor + 1),
747 element->text[length] = '\0'; 746 sizeof(char) * (length-1));
747 element->text[length - 1] = '\0';
748 748
749 if(cursor[length + 1] == '\n') 749 if(cursor[length] == '\n')
750 skin_line++; 750 skin_line++;
751 751
752 *document += (length + 2); /* Move cursor up past # and all text */ 752 *document += (length); /* Move cursor up past # and all text */
753 if(**document == '\n')
754 (*document)++;
753 755
754 return 1; 756 return 1;
755} 757}