diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-11-05 23:44:31 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-11-05 23:44:31 +0000 |
commit | 8ec7ad053a9a291ea2619055b1ca1989d4c975b9 (patch) | |
tree | aa7272b673e2062985667d87fcfe7e19f30eb239 /content/content.c | |
parent | 4ca959f46baf18213bf5ded769d87c7f030d392f (diff) | |
download | netsurf-8ec7ad053a9a291ea2619055b1ca1989d4c975b9.tar.gz netsurf-8ec7ad053a9a291ea2619055b1ca1989d4c975b9.tar.bz2 |
Make the fetching of a contents encoding generic.
The frontends previously had to use an html renderer API to get the
encoding of a content. This also required the explicit checking of the
contents type rather than using the existing content API to abstract
this knowledge.
Diffstat (limited to 'content/content.c')
-rw-r--r-- | content/content.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/content/content.c b/content/content.c index ee6ff818f..728147f31 100644 --- a/content/content.c +++ b/content/content.c @@ -1302,6 +1302,30 @@ bool content_get_quirks(hlcache_handle *h) /** + * Retrieve the encoding of a content + * + * \param c Content to retrieve bitmap from + * \return Pointer to bitmap, or NULL if none. + */ +const char *content_get_encoding(hlcache_handle *h) +{ + return content__get_encoding(hlcache_handle_get_content(h)); +} + +const char *content__get_encoding(struct content *c) +{ + const char *encoding = NULL; + + if ((c != NULL) && + (c->handler != NULL) && + (c->handler->get_encoding != NULL) ) { + encoding = c->handler->get_encoding(c); + } + + return encoding; +} + +/** * Return whether a content is currently locked * * \param c Content to test |