From d91668b0c518c9533d7cd7e38bbc9562eadcce8b Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 27 Jan 2009 09:23:56 +0100 Subject: [PATCH] Pass the codepage (cp) instead of options to the scan_http_equiv. --- src/document/html/parser.c | 8 ++++++-- src/document/html/parser/general.c | 4 +++- src/document/html/parser/parse.c | 14 +++++++------- src/document/html/parser/parse.h | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/document/html/parser.c b/src/document/html/parser.c index dcaa10aa..7ebc582f 100644 --- a/src/document/html/parser.c +++ b/src/document/html/parser.c @@ -777,7 +777,9 @@ get_image_map(unsigned char *head, unsigned char *pos, unsigned char *eof, if (!init_string(&hd)) return -1; if (head) add_to_string(&hd, head); - scan_http_equiv(pos, eof, &hd, NULL, options); + /* FIXME (bug 784): cp is the terminal charset; + * should use the document charset instead. */ + scan_http_equiv(pos, eof, &hd, NULL, options->cp); ct = get_convert_table(hd.source, to, def, NULL, NULL, hdef); done_string(&hd); @@ -897,7 +899,9 @@ init_html_parser(struct uri *uri, struct document_options *options, html_context->options = options; - scan_http_equiv(start, end, head, title, options); + /* FIXME (bug 784): cp is the terminal charset; + * should use the document charset instead. */ + scan_http_equiv(start, end, head, title, options->cp); e = mem_calloc(1, sizeof(*e)); if (!e) return NULL; diff --git a/src/document/html/parser/general.c b/src/document/html/parser/general.c index bbb64daf..063ddcdb 100644 --- a/src/document/html/parser/general.c +++ b/src/document/html/parser/general.c @@ -453,7 +453,9 @@ html_handle_body_meta(struct html_context *html_context, unsigned char *meta, if (!init_string(&head)) return; - scan_http_equiv(meta, eof, &head, NULL, html_context->options); + /* FIXME (bug 784): cp is the terminal charset; + * should use the document charset instead. */ + scan_http_equiv(meta, eof, &head, NULL, html_context->options->cp); process_head(html_context, head.source); done_string(&head); } diff --git a/src/document/html/parser/parse.c b/src/document/html/parser/parse.c index 399c4e6d..0808e7d9 100644 --- a/src/document/html/parser/parse.c +++ b/src/document/html/parser/parse.c @@ -1163,7 +1163,7 @@ process_element(unsigned char *name, int namelen, int endingtag, void scan_http_equiv(unsigned char *s, unsigned char *eof, struct string *head, - struct string *title, struct document_options *options) + struct string *title, int cp) { unsigned char *name, *attr, *he, *c; int namelen; @@ -1213,26 +1213,26 @@ xsp: } if (c_strlcasecmp(name, namelen, "META", 4)) goto se; - /* FIXME (bug 784): options->cp is the terminal charset; + /* FIXME (bug 784): cp is the terminal charset; * should use the document charset instead. */ - he = get_attr_val(attr, "charset", options->cp); + he = get_attr_val(attr, "charset", cp); if (he) { add_to_string(head, "Charset: "); add_to_string(head, he); mem_free(he); } - /* FIXME (bug 784): options->cp is the terminal charset; + /* FIXME (bug 784): cp is the terminal charset; * should use the document charset instead. */ - he = get_attr_val(attr, "http-equiv", options->cp); + he = get_attr_val(attr, "http-equiv", cp); if (!he) goto se; add_to_string(head, he); mem_free(he); - /* FIXME (bug 784): options->cp is the terminal charset; + /* FIXME (bug 784): cp is the terminal charset; * should use the document charset instead. */ - c = get_attr_val(attr, "content", options->cp); + c = get_attr_val(attr, "content", cp); if (c) { add_to_string(head, ": "); add_to_string(head, c); diff --git a/src/document/html/parser/parse.h b/src/document/html/parser/parse.h index 9498e43c..1e53149e 100644 --- a/src/document/html/parser/parse.h +++ b/src/document/html/parser/parse.h @@ -66,7 +66,7 @@ int get_width(unsigned char *, unsigned char *, int, struct html_context *); unsigned char *skip_comment(unsigned char *, unsigned char *); -void scan_http_equiv(unsigned char *s, unsigned char *eof, struct string *head, struct string *title, struct document_options *options); +void scan_http_equiv(unsigned char *s, unsigned char *eof, struct string *head, struct string *title, int cp); int supports_html_media_attr(const unsigned char *media);