summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-04-17 00:54:27 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-04-17 00:54:27 +0000
commitdaf7a52dd67e7ac2149dba337cc156c9ba308987 (patch)
tree7514c0aaccc3c1ec2fc4b8b348e3249a043a6ff4 /render
parent5ae689a29633afc64474c414541c56a98a3876cf (diff)
downloadnetsurf-daf7a52dd67e7ac2149dba337cc156c9ba308987.tar.gz
netsurf-daf7a52dd67e7ac2149dba337cc156c9ba308987.tar.bz2
Hubbub is no longer optional.
Remove libxml2 parser binding. svn path=/trunk/netsurf/; revision=7115
Diffstat (limited to 'render')
-rw-r--r--render/box_construct.c264
-rw-r--r--render/directory.c4
-rw-r--r--render/html.c4
-rw-r--r--render/hubbub_binding.c4
-rw-r--r--render/libxml_binding.c312
-rw-r--r--render/parser_binding.h2
6 files changed, 1 insertions, 589 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index dc354586e..f31b51538 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -140,9 +140,6 @@ static bool box_a(BOX_SPECIAL_PARAMS);
static bool box_body(BOX_SPECIAL_PARAMS);
static bool box_br(BOX_SPECIAL_PARAMS);
static bool box_image(BOX_SPECIAL_PARAMS);
-#ifndef WITH_HUBBUB
-static bool box_form(BOX_SPECIAL_PARAMS);
-#endif
static bool box_textarea(BOX_SPECIAL_PARAMS);
static bool box_select(BOX_SPECIAL_PARAMS);
static bool box_input(BOX_SPECIAL_PARAMS);
@@ -176,9 +173,6 @@ static const struct element_entry element_table[] = {
{"br", box_br},
{"button", box_button},
{"embed", box_embed},
-#ifndef WITH_HUBBUB
- {"form", box_form},
-#endif
{"frameset", box_frameset},
{"iframe", box_iframe},
{"image", box_image},
@@ -2162,78 +2156,6 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
}
-#ifndef WITH_HUBBUB
-/**
- * Interactive form [17.3].
- */
-
-bool box_form(BOX_SPECIAL_PARAMS)
-{
- char *xmlaction, *action, *method, *enctype, *charset, *target;
- form_method fmethod;
- struct form *form;
- url_func_result result;
-
- if (!(xmlaction = (char *)
- xmlGetProp(n, (const xmlChar *) "action"))) {
- /* the action attribute is required, but many forms fail to
- * specify it. In the case where it is _not_ specified,
- * follow other browsers and make the form action the URI of
- * the page the form is contained in. */
- action = strdup(content->data.html.base_url);
- } else {
- result = url_join(xmlaction, content->data.html.base_url,
- &action);
-
- xmlFree(xmlaction);
-
- if (result != URL_FUNC_OK)
- return false;
- }
-
- if (!action)
- return false;
-
- fmethod = method_GET;
- if ((method = (char *) xmlGetProp(n, (const xmlChar *) "method"))) {
- if (strcasecmp(method, "post") == 0) {
- fmethod = method_POST_URLENC;
- if ((enctype = (char *) xmlGetProp(n,
- (const xmlChar *) "enctype"))) {
- if (strcasecmp(enctype,
- "multipart/form-data") == 0)
- fmethod = method_POST_MULTIPART;
- xmlFree(enctype);
- }
- }
- xmlFree(method);
- }
-
- /* acceptable encoding(s) for form data */
- charset = (char *) xmlGetProp(n, (const xmlChar *) "accept-charset");
-
- /* target for form data */
- target = (char *) xmlGetProp(n, (const xmlChar *) "target");
-
- form = form_new(n, action, target, fmethod, charset,
- content->data.html.encoding);
-
- free(action);
- if (charset)
- xmlFree(charset);
- if (target)
- xmlFree(target);
-
- if (!form)
- return false;
-
- form->prev = content->data.html.forms;
- content->data.html.forms = form;
-
- return true;
-}
-#endif
-
/**
* Form control [17.4].
*/
@@ -2246,67 +2168,24 @@ bool box_input(BOX_SPECIAL_PARAMS)
type = (char *) xmlGetProp(n, (const xmlChar *) "type");
-#ifdef WITH_HUBBUB
gadget = binding_get_control_for_node(content->data.html.parser_binding,
n);
if (!gadget)
goto no_memory;
box->gadget = gadget;
gadget->box = box;
-#endif
if (type && strcasecmp(type, "password") == 0) {
if (!box_input_text(n, content, box, 0, markup_track, author,
true))
goto no_memory;
-#ifndef WITH_HUBBUB
- gadget = box->gadget;
- gadget->box = box;
-#endif
} else if (type && strcasecmp(type, "file") == 0) {
box->type = BOX_INLINE_BLOCK;
-#ifndef WITH_HUBBUB
- box->gadget = gadget = form_new_control(n, GADGET_FILE);
- if (!gadget)
- goto no_memory;
- gadget->box = box;
-#endif
} else if (type && strcasecmp(type, "hidden") == 0) {
/* no box for hidden inputs */
box->style->display = CSS_DISPLAY_NONE;
-#ifndef WITH_HUBBUB
- gadget = form_new_control(n, GADGET_HIDDEN);
- if (!gadget)
- goto no_memory;
-
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "value"))) {
- gadget->value = strdup(s);
- xmlFree(s);
- if (!gadget->value)
- goto no_memory;
- gadget->length = strlen(gadget->value);
- }
-#endif
} else if (type && (strcasecmp(type, "checkbox") == 0 ||
strcasecmp(type, "radio") == 0)) {
-#ifndef WITH_HUBBUB
- box->gadget = gadget = form_new_control(n, type[0] == 'c' ||
- type[0] == 'C' ? GADGET_CHECKBOX :
- GADGET_RADIO);
- if (!gadget)
- goto no_memory;
- gadget->box = box;
-
- gadget->selected = xmlHasProp(n, (const xmlChar *) "checked");
-
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "value"))) {
- gadget->value = strdup(s);
- xmlFree(s);
- if (!gadget->value)
- goto no_memory;
- gadget->length = strlen(gadget->value);
- }
-#endif
} else if (type && (strcasecmp(type, "submit") == 0 ||
strcasecmp(type, "reset") == 0 ||
strcasecmp(type, "button") == 0)) {
@@ -2339,12 +2218,6 @@ bool box_input(BOX_SPECIAL_PARAMS)
box_add_child(inline_container, inline_box);
box_add_child(box, inline_container);
} else if (type && strcasecmp(type, "image") == 0) {
-#ifndef WITH_HUBBUB
- box->gadget = gadget = form_new_control(n, GADGET_IMAGE);
- if (!gadget)
- goto no_memory;
- gadget->box = box;
-#endif
gadget->type = GADGET_IMAGE;
if (box->style && box->style->display != CSS_DISPLAY_NONE) {
@@ -2378,39 +2251,17 @@ bool box_input(BOX_SPECIAL_PARAMS)
if (!box_input_text(n, content, box, 0, markup_track, author,
false))
goto no_memory;
-#ifndef WITH_HUBBUB
- gadget = box->gadget;
- gadget->box = box;
-#endif
}
if (type)
xmlFree(type);
-#ifndef WITH_HUBBUB
- if (gadget) {
- if (content->data.html.forms)
- form_add_control(content->data.html.forms, gadget);
- s = (char *) xmlGetProp(n, (const xmlChar *) "name");
- if (s) {
- gadget->name = strdup(s);
- xmlFree(s);
- if (!gadget->name)
- goto no_memory;
- }
- }
-#endif
-
*convert_children = false;
return true;
no_memory:
if (type)
xmlFree(type);
-#ifndef WITH_HUBBUB
- if (gadget)
- form_free_control(gadget);
-#endif
return false;
}
@@ -2421,37 +2272,9 @@ no_memory:
bool box_input_text(BOX_SPECIAL_PARAMS, bool password)
{
-#ifndef WITH_HUBBUB
- char *s;
-#endif
struct box *inline_container, *inline_box;
box->type = BOX_INLINE_BLOCK;
-#ifndef WITH_HUBBUB
- box->gadget = form_new_control(n, (password) ? GADGET_PASSWORD :
- GADGET_TEXTBOX);
- if (!box->gadget)
- return false;
- box->gadget->box = box;
-
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "maxlength"))) {
- if (s[0] != '\0')
- box->gadget->maxlength = atoi(s);
- xmlFree(s);
- }
-
- s = (char *) xmlGetProp(n, (const xmlChar *) "value");
- box->gadget->value = strdup((s != NULL) ? s : "");
- box->gadget->initial_value = strdup((box->gadget->value != NULL) ?
- box->gadget->value : "");
- if (s)
- xmlFree(s);
- if (box->gadget->value == NULL || box->gadget->initial_value == NULL) {
- box_free(box);
- return false;
- }
- box->gadget->length = strlen(box->gadget->value);
-#endif
inline_container = box_create(0, 0, 0, 0, 0, content);
if (!inline_container)
@@ -2494,41 +2317,6 @@ bool box_input_text(BOX_SPECIAL_PARAMS, bool password)
bool box_button(BOX_SPECIAL_PARAMS)
{
-#ifndef WITH_HUBBUB
- xmlChar *s;
- char *type = (char *) xmlGetProp(n, (const xmlChar *) "type");
-
- if (!type || strcasecmp(type, "submit") == 0) {
- box->gadget = form_new_control(n, GADGET_SUBMIT);
- } else if (strcasecmp(type, "reset") == 0) {
- box->gadget = form_new_control(n, GADGET_RESET);
- } else {
- box->gadget = form_new_control(n, GADGET_BUTTON);
- }
-
- if (type)
- xmlFree(type);
-
- if (!box->gadget)
- return false;
-
- if (content->data.html.forms)
- form_add_control(content->data.html.forms, box->gadget);
- box->gadget->box = box;
-
- if ((s = xmlGetProp(n, (const xmlChar *) "name")) != NULL) {
- box->gadget->name = strdup((char *) s);
- xmlFree(s);
- if (!box->gadget->name)
- return false;
- }
- if ((s = xmlGetProp(n, (const xmlChar *) "value")) != NULL) {
- box->gadget->value = strdup((char *) s);
- xmlFree(s);
- if (!box->gadget->value)
- return false;
- }
-#else
struct form_control *gadget;
gadget = binding_get_control_for_node(content->data.html.parser_binding,
@@ -2538,7 +2326,7 @@ bool box_button(BOX_SPECIAL_PARAMS)
box->gadget = gadget;
gadget->box = box;
-#endif
+
box->type = BOX_INLINE_BLOCK;
/* Just render the contents */
@@ -2556,25 +2344,13 @@ bool box_select(BOX_SPECIAL_PARAMS)
struct box *inline_container;
struct box *inline_box;
struct form_control *gadget;
-#ifndef WITH_HUBBUB
- char *s;
-#endif
xmlNode *c, *c2;
-#ifndef WITH_HUBBUB
- gadget = form_new_control(n, GADGET_SELECT);
-#else
gadget = binding_get_control_for_node(content->data.html.parser_binding,
n);
-#endif
if (!gadget)
return false;
-#ifndef WITH_HUBBUB
- gadget->data.select.multiple =
- xmlHasProp(n, (const xmlChar *) "multiple");
-#endif
-
for (c = n->children; c; c = c->next) {
if (strcmp((const char *) c->name, "option") == 0) {
if (!box_select_add_option(gadget, c))
@@ -2592,21 +2368,9 @@ bool box_select(BOX_SPECIAL_PARAMS)
if (gadget->data.select.num_items == 0) {
/* no options: ignore entire select */
-#ifndef WITH_HUBBUB
- form_free_control(gadget);
-#endif
return true;
}
-#ifndef WITH_HUBBUB
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "name"))) {
- gadget->name = strdup(s);
- xmlFree(s);
- if (!gadget->name)
- goto no_memory;
- }
-#endif
-
box->type = BOX_INLINE_BLOCK;
box->gadget = gadget;
gadget->box = box;
@@ -2644,18 +2408,10 @@ bool box_select(BOX_SPECIAL_PARAMS)
inline_box->length = strlen(inline_box->text);
-#ifndef WITH_HUBBUB
- if (content->data.html.forms)
- form_add_control(content->data.html.forms, box->gadget);
-#endif
-
*convert_children = false;
return true;
no_memory:
-#ifndef WITH_HUBBUB
- form_free_control(gadget);
-#endif
return false;
}
@@ -2736,25 +2492,12 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
size_t len;
box->type = BOX_INLINE_BLOCK;
-#ifndef WITH_HUBBUB
- box->gadget = form_new_control(n, GADGET_TEXTAREA);
-#else
box->gadget = binding_get_control_for_node(
content->data.html.parser_binding, n);
-#endif
if (!box->gadget)
return false;
box->gadget->box = box;
-#ifndef WITH_HUBBUB
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "name"))) {
- box->gadget->name = strdup(s);
- xmlFree(s);
- if (!box->gadget->name)
- return false;
- }
-#endif
-
inline_container = box_create(0, 0, 0, box->title, 0, content);
if (!inline_container)
return false;
@@ -2843,11 +2586,6 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
xmlFree(string);
xmlBufferFree(buf);
-#ifndef WITH_HUBBUB
- if (content->data.html.forms)
- form_add_control(content->data.html.forms, box->gadget);
-#endif
-
*convert_children = false;
return true;
}
diff --git a/render/directory.c b/render/directory.c
index 7fa5cb2dd..7360c4086 100644
--- a/render/directory.c
+++ b/render/directory.c
@@ -28,10 +28,6 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
-#ifdef WITH_HUBBUB
-#include <hubbub/parser.h>
-#endif
-#include <libxml/HTMLparser.h>
#include "content/content.h"
#include "render/directory.h"
#include "render/html.h"
diff --git a/render/html.c b/render/html.c
index 7e7070613..729a10cee 100644
--- a/render/html.c
+++ b/render/html.c
@@ -297,9 +297,7 @@ bool html_convert(struct content *c, int width, int height)
xmlNode *html, *head;
union content_msg_data msg_data;
unsigned int time_before, time_taken;
-#ifdef WITH_HUBBUB
struct form *f;
-#endif
/* finish parsing */
if (c->source_size == 0) {
@@ -401,7 +399,6 @@ bool html_convert(struct content *c, int width, int height)
if (!html_find_stylesheets(c, html))
return false;
-#ifdef WITH_HUBBUB
/* Retrieve forms from parser */
c->data.html.forms = binding_get_forms(c->data.html.parser_binding);
for (f = c->data.html.forms; f != NULL; f = f->prev) {
@@ -430,7 +427,6 @@ bool html_convert(struct content *c, int width, int height)
}
}
}
-#endif
/* convert xml tree to box tree */
LOG(("XML to box"));
diff --git a/render/hubbub_binding.c b/render/hubbub_binding.c
index a99bcf7cb..279dd9933 100644
--- a/render/hubbub_binding.c
+++ b/render/hubbub_binding.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef WITH_HUBBUB
-
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <stdbool.h>
@@ -1023,5 +1021,3 @@ struct form_control *parse_textarea_element(xmlNode *node)
return control;
}
-#endif
-
diff --git a/render/libxml_binding.c b/render/libxml_binding.c
index fdff19b70..e69de29bb 100644
--- a/render/libxml_binding.c
+++ b/render/libxml_binding.c
@@ -1,312 +0,0 @@
-/*
- * Copyright 2007 James Bursa <bursa@users.sourceforge.net>
- * Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef WITH_HUBBUB
-
-#include <stdbool.h>
-#include <string.h>
-
-#include <libxml/HTMLparser.h>
-#include <libxml/HTMLtree.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-
-#include "render/parser_binding.h"
-
-#include "utils/log.h"
-#include "utils/talloc.h"
-
-typedef struct libxml_ctx {
- htmlParserCtxt *parser;
-
- /** HTML parser encoding handler. */
- xmlCharEncodingHandler *encoding_handler;
-
- const char *encoding;
- binding_encoding_source encoding_source;
-
- bool getenc;
-} libxml_ctx;
-
-static bool set_parser_encoding(libxml_ctx *c, const char *encoding);
-static const char *detect_encoding(const char **data, size_t *size);
-
-binding_error binding_create_tree(void *arena, const char *charset, void **ctx)
-{
- libxml_ctx *c;
-
- c = malloc(sizeof(libxml_ctx));
- if (c == NULL)
- return BINDING_NOMEM;
-
- c->parser = NULL;
- c->encoding_handler = NULL;
- c->encoding = charset;
- c->encoding_source = ENCODING_SOURCE_HEADER;
- c->getenc = true;
-
- c->parser = htmlCreatePushParserCtxt(0, 0, "", 0, 0,
- XML_CHAR_ENCODING_NONE);
- if (c->parser == NULL) {
- free(c);
- return BINDING_NOMEM;
- }
-
- if (c->encoding != NULL && !set_parser_encoding(c, charset)) {
- if (c->parser->myDoc != NULL)
- xmlFreeDoc(c->parser->myDoc);
- htmlFreeParserCtxt(c->parser);
- free(c);
- return BINDING_BADENCODING;
- }
-
- *ctx = (void *) c;
-
- return BINDING_OK;
-}
-
-binding_error binding_destroy_tree(void *ctx)
-{
- libxml_ctx *c = (libxml_ctx *) ctx;
-
- if (ctx == NULL)
- return BINDING_OK;
-
- if (c->parser->myDoc != NULL)
- xmlFreeDoc(c->parser->myDoc);
-
- if (c->parser != NULL)
- htmlFreeParserCtxt(c->parser);
-
- c->parser = NULL;
- c->encoding = NULL;
-
- free(c);
-
- return BINDING_OK;
-}
-
-binding_error binding_parse_chunk(void *ctx, const uint8_t *data, size_t len)
-{
- libxml_ctx *c = (libxml_ctx *) ctx;
-
- if (c->getenc) {
- /* No encoding was specified in the Content-Type header.
- * Attempt to detect if the encoding is not 8-bit. If the
- * encoding is 8-bit, leave the parser unchanged, so that it
- * searches for a <meta http-equiv="content-type"
- * content="text/html; charset=...">. */
- const char *encoding;
- encoding = detect_encoding((const char **) (void *) &data,
- &len);
- if (encoding) {
- if (!set_parser_encoding(c, encoding))
- return BINDING_NOMEM;
- c->encoding = encoding;
- c->encoding_source = ENCODING_SOURCE_DETECTED;
- }
- c->getenc = false;
-
- /* The data we received may have solely consisted of a BOM.
- * If so, it will have been stripped by html_detect_encoding.
- * Therefore, we'll have nothing to do in that case. */
- if (len == 0)
- return BINDING_OK;
- }
-
- htmlParseChunk(c->parser, (const char *) data, len, 0);
- /** \todo error handling */
-
- if (!c->encoding && c->parser->input->encoding) {
- /* The encoding was not in headers or detected,
- * and the parser found a <meta http-equiv="content-type"
- * content="text/html; charset=...">. */
-
- /* However, if that encoding is non-ASCII-compatible,
- * ignore it, as it can't possibly be correct */
- if (strncasecmp((const char *) c->parser->input->encoding,
- "UTF-16", 6) == 0 || /* UTF-16(LE|BE)? */
- strncasecmp((const char *) c->parser->input->encoding,
- "UTF-32", 6) == 0) { /* UTF-32(LE|BE)? */
- c->encoding = "ISO-8859-1";
- c->encoding_source = ENCODING_SOURCE_DETECTED;
- } else {
- c->encoding = (const char *) c->parser->input->encoding;
- c->encoding_source = ENCODING_SOURCE_META;
- }
-
- if (!c->encoding)
- return BINDING_NOMEM;
-
- /* have the encoding; don't attempt to detect it */
- c->getenc = false;
-
- return BINDING_ENCODINGCHANGE;
- }
-
- return BINDING_OK;
-}
-
-binding_error binding_parse_completed(void *ctx)
-{
- libxml_ctx *c = (libxml_ctx *) ctx;
-
- htmlParseChunk(c->parser, "", 0, 1);
- /** \todo error handling */
-
- return BINDING_OK;
-}
-
-const char *binding_get_encoding(void *ctx, binding_encoding_source *source)
-{
- libxml_ctx *c = (libxml_ctx *) ctx;
-
- *source = c->encoding_source;
-
- return c->encoding;
-}
-
-xmlDocPtr binding_get_document(void *ctx)
-{
- libxml_ctx *c = (libxml_ctx *) ctx;
- xmlDocPtr doc = c->parser->myDoc;
-
- c->parser->myDoc = NULL;
-
- return doc;
-}
-
-/******************************************************************************/
-
-/**
- * Set the HTML parser character encoding.
- *
- * \param c context
- * \param encoding name of encoding
- * \return true on success, false on error and error reported
- */
-bool set_parser_encoding(libxml_ctx *c, const char *encoding)
-{
- xmlError *error;
-
- c->encoding_handler = xmlFindCharEncodingHandler(encoding);
- if (!c->encoding_handler) {
- /* either out of memory, or no handler available */
- /* assume no handler available, which is not a fatal error */
- LOG(("no encoding handler for \"%s\"", encoding));
- /* \todo warn user and ask them to install iconv? */
- return true;
- }
-
- xmlCtxtResetLastError(c->parser);
- if (xmlSwitchToEncoding(c->parser, c->encoding_handler)) {
- error = xmlCtxtGetLastError(c->parser);
- LOG(("xmlSwitchToEncoding(): %s",
- error ? error->message : "failed"));
- return false;
- }
-
- /* Dirty hack to get around libxml oddness:
- * 1) When creating a push parser context, the input flow's encoding
- * string is not set (whether an encoding is specified or not)
- * 2) When switching encoding (as above), the input flow's encoding
- * string is never changed
- * 3) When handling a meta charset, the input flow's encoding string
- * is checked to determine if an encoding has already been set.
- * If it has been set, then the meta charset is ignored.
- *
- * The upshot of this is that, if we don't explicitly set the input
- * flow's encoding string here, any meta charset in the document
- * will override our setting, which is incorrect behaviour.
- *
- * Ideally, this would be fixed in libxml, but that requires rather
- * more knowledge than I currently have of what libxml is doing.
- */
- if (!c->parser->input->encoding)
- c->parser->input->encoding =
- xmlStrdup((const xmlChar *) encoding);
-
- /* Ensure noone else attempts to reset the encoding */
- c->getenc = false;
-
- return true;
-}
-
-/**
- * Attempt to detect the encoding of some HTML data.
- *
- * \param data Pointer to HTML source data
- * \param size Pointer to length of data
- * \return a constant string giving the encoding, or 0 if the encoding
- * appears to be some 8-bit encoding
- *
- * If a BOM is encountered, *data and *size will be modified to skip over it
- */
-
-const char *detect_encoding(const char **data, size_t *size)
-{
- const unsigned char *d = (const unsigned char *) *data;
-
- /* this detection assumes that the first two characters are <= 0xff */
- if (*size < 4)
- return 0;
-
- if (d[0] == 0x00 && d[1] == 0x00 &&
- d[2] == 0xfe && d[3] == 0xff) { /* BOM 00 00 fe ff */
- *data += 4;
- *size -= 4;
- return "UTF-32BE";
- } else if (d[0] == 0xff && d[1] == 0xfe &&
- d[2] == 0x00 && d[3] == 0x00) { /* BOM ff fe 00 00 */
- *data += 4;
- *size -= 4;
- return "UTF-32LE";
- }
- else if (d[0] == 0x00 && d[1] != 0x00 &&
- d[2] == 0x00 && d[3] != 0x00) /* 00 xx 00 xx */
- return "UTF-16BE";
- else if (d[0] != 0x00 && d[1] == 0x00 &&
- d[2] != 0x00 && d[3] == 0x00) /* xx 00 xx 00 */
- return "UTF-16LE";
- else if (d[0] == 0x00 && d[1] == 0x00 &&
- d[2] == 0x00 && d[3] != 0x00) /* 00 00 00 xx */
- return "ISO-10646-UCS-4";
- else if (d[0] != 0x00 && d[1] == 0x00 &&
- d[2] == 0x00 && d[3] == 0x00) /* xx 00 00 00 */
- return "ISO-10646-UCS-4";
- else if (d[0] == 0xfe && d[1] == 0xff) { /* BOM fe ff */
- *data += 2;
- *size -= 2;
- return "UTF-16BE";
- } else if (d[0] == 0xff && d[1] == 0xfe) { /* BOM ff fe */
- *data += 2;
- *size -= 2;
- return "UTF-16LE";
- } else if (d[0] == 0xef && d[1] == 0xbb &&
- d[2] == 0xbf) { /* BOM ef bb bf */
- *data += 3;
- *size -= 3;
- return "UTF-8";
- }
-
- return 0;
-}
-
-#endif
-
diff --git a/render/parser_binding.h b/render/parser_binding.h
index d23b79359..d50b4e3b9 100644
--- a/render/parser_binding.h
+++ b/render/parser_binding.h
@@ -48,10 +48,8 @@ binding_error binding_parse_completed(void *ctx);
const char *binding_get_encoding(void *ctx, binding_encoding_source *source);
xmlDocPtr binding_get_document(void *ctx);
-#ifdef WITH_HUBBUB
struct form *binding_get_forms(void *ctx);
struct form_control *binding_get_control_for_node(void *ctx, xmlNodePtr node);
-#endif
#endif