summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2012-03-25 11:03:52 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2012-03-25 11:03:52 +0000
commitf6ed6dc34b0827cc9d9d21a5f8527acabda95654 (patch)
treea51435e57a236d892c9a06a58ede10848728dd8b
parentbc2984efe2149758799d317aa6157badc4942d54 (diff)
downloadlibdom-f6ed6dc34b0827cc9d9d21a5f8527acabda95654.tar.gz
libdom-f6ed6dc34b0827cc9d9d21a5f8527acabda95654.tar.bz2
Fix hubbub binding to cope with attributes with bad names
svn path=/trunk/libdom/; revision=13674
-rw-r--r--bindings/hubbub/parser.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/bindings/hubbub/parser.c b/bindings/hubbub/parser.c
index 1b14672..d1e69c3 100644
--- a/bindings/hubbub/parser.c
+++ b/bindings/hubbub/parser.c
@@ -110,6 +110,14 @@ static void *dom_hubbub_alloc(void *ptr, size_t len, void *pw)
return realloc(ptr, len);
}
+static void dom_hubbub_parser_default_msg(uint32_t severity, void *ctx,
+ const char *msg, ...)
+{
+ UNUSED(severity);
+ UNUSED(ctx);
+ UNUSED(msg);
+}
+
/**
* Create a Hubbub parser instance
*
@@ -141,8 +149,13 @@ dom_hubbub_parser *dom_hubbub_parser_create(
: DOM_HUBBUB_ENCODING_SOURCE_DETECTED;
parser->complete = false;
- parser->msg = msg;
- parser->mctx = mctx;
+ if (msg == NULL) {
+ parser->msg = dom_hubbub_parser_default_msg;
+ parser->mctx = NULL;
+ } else {
+ parser->msg = msg;
+ parser->mctx = mctx;
+ }
error = hubbub_parser_create(enc, fix_enc, dom_hubbub_alloc, NULL,
&parser->parser);
@@ -725,7 +738,6 @@ static hubbub_error add_attributes(void *parser, void *node,
dom_parser->msg(DOM_MSG_CRITICAL,
dom_parser->mctx,
"Can't add attribute");
- goto fail;
}
} else {
err = dom_element_set_attribute_ns(
@@ -738,7 +750,6 @@ static hubbub_error add_attributes(void *parser, void *node,
dom_parser->msg(DOM_MSG_CRITICAL,
dom_parser->mctx,
"Can't add attribute ns");
- goto fail;
}
}
}