From c56642819eed87431dff3446fe111f7f3eefaa7d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 7 May 2014 16:14:18 +0100 Subject: add file operations table and make all frontends use it. This rationalises the path construction and basename file operations. The default implementation is POSIX which works for all frontends except windows, riscos and amiga which have differeing path separators and rules. These implementations are significantly more robust than the previous nine implementations and also do not use unsafe strncpy or buffers with arbitrary length limits. These implementations also carry full documentation comments. --- desktop/gui.h | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'desktop/gui.h') diff --git a/desktop/gui.h b/desktop/gui.h index 5f4ba1cdb..0d4135a93 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -68,6 +68,7 @@ struct ssl_cert_info; struct hlcache_handle; struct download_context; struct nsurl; +struct gui_file_table; typedef struct nsnsclipboard_styles { size_t start; /**< Start of run */ @@ -317,28 +318,6 @@ struct gui_clipboard_table { struct gui_fetch_table { /* Mandantory entries */ - /** - * Return the filename part of a full path - * - * @note used in curl fetcher - * - * \param path full path and filename - * \return filename (will be freed with free()) - */ - char *(*filename_from_path)(char *path); - - /** - * Add a path component/filename to an existing path - * - * @note used in save complete and file fetcher - * - * \param path buffer containing path + free space - * \param length length of buffer "path" - * \param newpart string containing path component to add to path - * \return true on success - */ - bool (*path_add_part)(char *path, int length, const char *newpart); - /** * Determine the MIME type of a local file. * @@ -398,6 +377,7 @@ struct gui_fetch_table { }; + /** * User interface utf8 characterset conversion routines. */ @@ -567,6 +547,15 @@ struct gui_table { /** Fetcher table */ struct gui_fetch_table *fetch; + /** + * File table + * + * Provides file and filename operations to the core. The + * table is optional and may be NULL in which case the default + * posix compliant operations will be used. + */ + struct gui_file_table *file; + /** * UTF8 table. * -- cgit v1.2.3