NetSurf
|
#include <stdlib.h>
#include <string.h>
#include <unixlib/local.h>
#include "oslib/mimemap.h"
#include "oslib/osfile.h"
#include "utils/config.h"
#include "utils/log.h"
#include "netsurf/content.h"
#include "riscos/filetype.h"
#include "riscos/gui.h"
Go to the source code of this file.
Data Structures | |
struct | type_entry |
Macros | |
#define | TYPE_MAP_COUNT (sizeof(type_map) / sizeof(type_map[0])) |
#define | BUF_SIZE (256) |
Functions | |
static int | cmp_type (const void *x, const void *y) |
Comparison function for bsearch. More... | |
const char * | fetch_filetype (const char *unix_path) |
filetype – determine the MIME type of a local file More... | |
char * | fetch_mimetype (const char *ro_path) |
Find a MIME type for a local file. More... | |
int | ro_content_filetype (struct hlcache_handle *c) |
Determine the RISC OS filetype for a content. More... | |
int | ro_content_native_type (struct hlcache_handle *c) |
Determine the native RISC OS filetype to export a content as. More... | |
int | ro_content_filetype_from_mime_type (lwc_string *mime_type) |
Determine the RISC OS filetype for a MIME type. More... | |
int | ro_content_filetype_from_type (content_type type) |
Determine the RISC OS filetype from a content type. More... | |
bits | ro_filetype_from_unix_path (const char *unix_path) |
Determine the type of a local file. More... | |
Variables | |
static const struct type_entry | type_map [] |
static char | type_buf [BUF_SIZE] |
#define BUF_SIZE (256) |
Definition at line 58 of file filetype.c.
Definition at line 56 of file filetype.c.
|
static |
Comparison function for bsearch.
Definition at line 235 of file filetype.c.
References type_entry::file_type.
Referenced by fetch_filetype(), and fetch_mimetype().
const char * fetch_filetype | ( | const char * | unix_path | ) |
filetype – determine the MIME type of a local file
Determine the MIME type of a local file.
Definition at line 65 of file filetype.c.
References BUF_SIZE, cmp_type(), type_entry::file_type, type_entry::mime_type, NSLOG, path(), ro_warn_user(), type_buf, type_map, and TYPE_MAP_COUNT.
char * fetch_mimetype | ( | const char * | ro_path | ) |
Find a MIME type for a local file.
ro_path | RISC OS style path to file on disk |
Definition at line 154 of file filetype.c.
References BUF_SIZE, cmp_type(), type_entry::mime_type, NSLOG, ro_warn_user(), type_map, and TYPE_MAP_COUNT.
int ro_content_filetype | ( | struct hlcache_handle * | h | ) |
Determine the RISC OS filetype for a content.
h | The handle of the content to examine. |
Definition at line 243 of file filetype.c.
References content_get_mime_type(), content_get_type(), type_entry::file_type, type_entry::mime_type, ro_content_filetype_from_mime_type(), and ro_content_filetype_from_type().
Referenced by print_send_printsave(), ro_content_native_type(), ro_gui_save_content(), ro_gui_save_object_native(), ro_gui_save_set_state(), ro_gui_url_bar_set_content_favicon(), ro_gui_view_source(), ro_gui_window_prepare_objectinfo(), and ro_gui_window_prepare_pageinfo().
int ro_content_filetype_from_mime_type | ( | lwc_string * | mime_type | ) |
Determine the RISC OS filetype for a MIME type.
mime_type | MIME type to consider |
Definition at line 288 of file filetype.c.
References type_entry::file_type, type_entry::mime_type, type_map, and TYPE_MAP_COUNT.
Referenced by ro_content_filetype(), and ro_gui_save_set_file_type().
int ro_content_filetype_from_type | ( | content_type | type | ) |
Determine the RISC OS filetype from a content type.
type | The content type to examine. |
Definition at line 315 of file filetype.c.
References CONTENT_CSS, CONTENT_HTML, CONTENT_TEXTPLAIN, FILETYPE_HTML, and type.
Referenced by ro_content_filetype(), and ro_gui_url_complete_redraw().
int ro_content_native_type | ( | struct hlcache_handle * | c | ) |
Determine the native RISC OS filetype to export a content as.
c | The content to examine |
Definition at line 263 of file filetype.c.
References FILETYPE_BMP, FILETYPE_GIF, FILETYPE_ICO, FILETYPE_JNG, FILETYPE_JPEG, FILETYPE_MNG, FILETYPE_PNG, FILETYPE_SVG, FILETYPE_WEBP, and ro_content_filetype().
Referenced by ro_gui_save_object_native(), ro_gui_save_set_state(), and ro_gui_window_content_export_types().
bits ro_filetype_from_unix_path | ( | const char * | unix_path | ) |
Determine the type of a local file.
unix_path | Unix style path to file on disk |
Definition at line 327 of file filetype.c.
References type_entry::file_type, NSLOG, path(), and ro_warn_user().
Referenced by download_ro_filetype().
|
static |
Definition at line 59 of file filetype.c.
Referenced by fetch_filetype().
|
static |
Definition at line 37 of file filetype.c.
Referenced by fetch_filetype(), fetch_mimetype(), and ro_content_filetype_from_mime_type().