summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/html.c20
-rw-r--r--render/html.h2
-rw-r--r--render/textplain.c31
-rw-r--r--render/textplain.h8
4 files changed, 10 insertions, 51 deletions
diff --git a/render/html.c b/render/html.c
index aaf0c4bf6..5a6d4dd0c 100644
--- a/render/html.c
+++ b/render/html.c
@@ -69,8 +69,6 @@ void html_create(struct content *c, const char *params[])
}
html->parser = htmlCreatePushParserCtxt(0, 0, "", 0, 0, html->encoding);
- html->source = xcalloc(0, 1);
- html->length = 0;
html->base_url = xstrdup(c->url);
html->layout = 0;
html->background_colour = TRANSPARENT;
@@ -98,21 +96,16 @@ void html_process_data(struct content *c, char *data, unsigned long size)
unsigned long x;
LOG(("content %s, size %lu", c->url, size));
/*cache_dump();*/
- c->data.html.source = xrealloc(c->data.html.source, c->data.html.length + size);
- memcpy(c->data.html.source + c->data.html.length, data, size);
- c->data.html.length += size;
- c->size += size;
- /* First time through, check if we need to get the encoding
+ /* First time through, check if we need to get the encoding
* if so, get it and reset the parser instance with it.
* if it fails, assume Latin1
*/
if (c->data.html.getenc) {
- c->data.html.encoding = xmlDetectCharEncoding(c->data.html.source, c->data.html.length);
- if (c->data.html.encoding == XML_CHAR_ENCODING_ERROR ||
- c->data.html.encoding == XML_CHAR_ENCODING_NONE) {
- c->data.html.encoding = XML_CHAR_ENCODING_8859_1;
- }
- xmlSwitchEncoding((xmlParserCtxtPtr)c->data.html.parser, c->data.html.encoding);
+ c->data.html.encoding = xmlDetectCharEncoding(data, size);
+ if (c->data.html.encoding == XML_CHAR_ENCODING_ERROR ||
+ c->data.html.encoding == XML_CHAR_ENCODING_NONE)
+ c->data.html.encoding = XML_CHAR_ENCODING_8859_1;
+ xmlSwitchEncoding(c->data.html.parser, c->data.html.encoding);
c->data.html.getenc = false;
LOG(("Encoding: %s", xmlGetCharEncodingName(c->data.html.encoding)));
}
@@ -758,7 +751,6 @@ void html_destroy(struct content *c)
if (c->data.html.parser)
htmlFreeParserCtxt(c->data.html.parser);
- free(c->data.html.source);
free(c->data.html.base_url);
if (c->data.html.layout)
diff --git a/render/html.h b/render/html.h
index b20040a2e..d029a7554 100644
--- a/render/html.h
+++ b/render/html.h
@@ -37,8 +37,6 @@ struct box_position {
struct content_html_data {
htmlParserCtxt *parser; /**< HTML parser context. */
- char *source; /**< Source data. */
- int length; /**< Length of source. */
xmlCharEncoding encoding; /**< Encoding of source. */
bool getenc; /**< Need to get the encoding from the document, as server is broken. */
diff --git a/render/textplain.c b/render/textplain.c
index 524865846..72ad98a4f 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -2,16 +2,13 @@
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
- * Copyright 2003 James Bursa <bursa@users.sourceforge.net>
+ * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
*/
-#include <assert.h>
-#include <string.h>
-#include <stdlib.h>
#include "libxml/HTMLparser.h"
+#include "netsurf/content/content.h"
#include "netsurf/render/html.h"
#include "netsurf/render/textplain.h"
-#include "netsurf/utils/log.h"
static const char header[] = "<html><body><pre>";
@@ -25,33 +22,9 @@ void textplain_create(struct content *c, const char *params[])
}
-void textplain_process_data(struct content *c, char *data, unsigned long size)
-{
- html_process_data(c, data, size);
-}
-
-
int textplain_convert(struct content *c, unsigned int width, unsigned int height)
{
htmlParseChunk(c->data.html.parser, footer, sizeof(footer) - 1, 0);
c->type = CONTENT_HTML;
return html_convert(c, width, height);
}
-
-
-void textplain_revive(struct content *c, unsigned int width, unsigned int height)
-{
- assert(0);
-}
-
-
-void textplain_reformat(struct content *c, unsigned int width, unsigned int height)
-{
- assert(0);
-}
-
-
-void textplain_destroy(struct content *c)
-{
- html_destroy(c);
-}
diff --git a/render/textplain.h b/render/textplain.h
index 75b52dd23..859ff9e62 100644
--- a/render/textplain.h
+++ b/render/textplain.h
@@ -2,19 +2,15 @@
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
- * Copyright 2003 James Bursa <bursa@users.sourceforge.net>
+ * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
*/
#ifndef _NETSURF_RENDER_TEXTPLAIN_H_
#define _NETSURF_RENDER_TEXTPLAIN_H_
-#include "netsurf/content/content.h"
+struct content;
void textplain_create(struct content *c, const char *params[]);
-void textplain_process_data(struct content *c, char *data, unsigned long size);
int textplain_convert(struct content *c, unsigned int width, unsigned int height);
-void textplain_revive(struct content *c, unsigned int width, unsigned int height);
-void textplain_reformat(struct content *c, unsigned int width, unsigned int height);
-void textplain_destroy(struct content *c);
#endif