From b34502af8247606ae3b5693cd3046566b16a3e6d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 8 Jul 2011 08:38:17 +0000 Subject: Refactor http utilities svn path=/trunk/netsurf/; revision=12595 --- render/box_construct.c | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'render/box_construct.c') diff --git a/render/box_construct.c b/render/box_construct.c index 5fdb23b5a..990fa380c 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1257,17 +1257,44 @@ bool box_object(BOX_SPECIAL_PARAMS) * (classid || !classid) && data => data is used (consult type) * !classid && !data => invalid; ignored */ - if (params->classid && !params->data && params->codetype && - content_factory_type_from_mime_type(params->codetype) == - CONTENT_NONE) - /* can't handle this MIME type */ - return true; + if (params->classid != NULL && params->data == NULL && + params->codetype != NULL) { + lwc_string *icodetype; + lwc_error lerror; + + lerror = lwc_intern_string(params->codetype, + strlen(params->codetype), &icodetype); + if (lerror != lwc_error_ok) + return false; - if (params->data && params->type && - content_factory_type_from_mime_type(params->type) == - CONTENT_NONE) - /* can't handle this MIME type */ - return true; + if (content_factory_type_from_mime_type(icodetype) == + CONTENT_NONE) { + /* can't handle this MIME type */ + lwc_string_unref(icodetype); + return true; + } + + lwc_string_unref(icodetype); + } + + if (params->data != NULL && params->type != NULL) { + lwc_string *itype; + lwc_error lerror; + + lerror = lwc_intern_string(params->type, strlen(params->type), + &itype); + if (lerror != lwc_error_ok) + return false; + + if (content_factory_type_from_mime_type(itype) == + CONTENT_NONE) { + /* can't handle this MIME type */ + lwc_string_unref(itype); + return true; + } + + lwc_string_unref(itype); + } /* add parameters to linked list */ for (c = n->children; c; c = c->next) { -- cgit v1.2.3