commit 1eb321597433fa8d044beabfa1c03fdf8bc284fd
parent 7eb36783851709ac69bc70b187f8734635173bea
Author: Colin Leroy <colin@colino.net>
Date: Mon, 10 Mar 2008 18:32:39 +0000
2008-03-10 [colin] 3.3.1cvs20
* src/common/xml.c
Handle comments
Diffstat:
4 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-10 [colin] 3.3.1cvs20
+
+ * src/common/xml.c
+ Handle comments
+
2008-03-07 [colin] 3.3.1cvs19
* src/mainwindow.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -3254,3 +3254,4 @@
( cvs diff -u -r 1.1.2.46 -r 1.1.2.47 src/gtk/authors.h; ) > 3.3.1cvs17.patchset
( cvs diff -u -r 1.274.2.234 -r 1.274.2.235 src/mainwindow.c; ) > 3.3.1cvs18.patchset
( cvs diff -u -r 1.274.2.235 -r 1.274.2.236 src/mainwindow.c; ) > 3.3.1cvs19.patchset
+( cvs diff -u -r 1.1.4.23 -r 1.1.4.24 src/common/xml.c; ) > 3.3.1cvs20.patchset
diff --git a/configure.ac b/configure.ac
@@ -11,7 +11,7 @@ MINOR_VERSION=3
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=19
+EXTRA_VERSION=20
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/common/xml.c b/src/common/xml.c
@@ -207,6 +207,7 @@ gint xml_parse_next_tag(XMLFile *file)
XMLTag *tag;
gint len;
+next:
if (file->is_empty_element == TRUE) {
file->is_empty_element = FALSE;
xml_pop_tag(file);
@@ -218,6 +219,8 @@ gint xml_parse_next_tag(XMLFile *file)
return -1;
}
+ len = strlen(buf);
+
/* end-tag */
if (buf[0] == '/') {
if (strcmp(xml_get_current_tag(file)->tag, buf + 1) != 0) {
@@ -228,15 +231,20 @@ gint xml_parse_next_tag(XMLFile *file)
return 0;
}
+ if (len >= 7 && !strncmp(buf, "!-- ", 4) && !strncmp(buf+len-3, " --", 3)) {
+ /* skip comment */
+ goto next;
+ }
+
tag = xml_tag_new(NULL);
xml_push_tag(file, tag);
- len = strlen(buf);
if (len > 0 && buf[len - 1] == '/') {
file->is_empty_element = TRUE;
buf[len - 1] = '\0';
g_strchomp(buf);
}
+
if (strlen(buf) == 0) {
g_warning("xml_parse_next_tag(): Tag name is empty\n");
return -1;
@@ -280,7 +288,7 @@ gint xml_parse_next_tag(XMLFile *file)
while (g_ascii_isspace(*bufp)) bufp++;
attr_name = bufp;
if ((p = strchr(attr_name, '=')) == NULL) {
- g_warning("xml_parse_next_tag(): Syntax error in tag\n");
+ g_warning("xml_parse_next_tag(): Syntax error in tag (a) %s\n", attr_name);
return -1;
}
bufp = p;
@@ -288,14 +296,14 @@ gint xml_parse_next_tag(XMLFile *file)
while (g_ascii_isspace(*bufp)) bufp++;
if (*bufp != '"' && *bufp != '\'') {
- g_warning("xml_parse_next_tag(): Syntax error in tag\n");
+ g_warning("xml_parse_next_tag(): Syntax error in tag (b) %s\n", bufp);
return -1;
}
quote = *bufp;
bufp++;
attr_value = bufp;
if ((p = strchr(attr_value, quote)) == NULL) {
- g_warning("xml_parse_next_tag(): Syntax error in tag\n");
+ g_warning("xml_parse_next_tag(): Syntax error in tag (c) %s\n", attr_value);
return -1;
}
bufp = p;