From 35bc2ccbb89a6b499e0e3b6f7095afea214f0c59 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 5 May 2019 22:46:40 +0100 Subject: change content get_source_data interfaces to return uint8_t and size_t previously these interfaces returned char * and unsigned int which was undesirable. --- frontends/riscos/theme_install.c | 61 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'frontends/riscos/theme_install.c') diff --git a/frontends/riscos/theme_install.c b/frontends/riscos/theme_install.c index fbca9e4fa..a235fe471 100644 --- a/frontends/riscos/theme_install.c +++ b/frontends/riscos/theme_install.c @@ -47,8 +47,6 @@ wimp_w dialog_theme_install; static void theme_install_close(wimp_w w); static nserror theme_install_callback(struct hlcache_handle *handle, const hlcache_event *event, void *pw); -static bool theme_install_read(const char *source_data, - unsigned long source_size); /** @@ -79,6 +77,33 @@ void theme_install_start(struct hlcache_handle *c) } +/** + * Fill in theme_install_descriptor from received theme data. + * + * \param source_data received data + * \param source_size size of data + * \return true if data is a correct theme, false on error + * + * If the data is a correct theme, theme_install_descriptor is filled in. + */ + +static bool +theme_install_read(const uint8_t *source_data, size_t source_size) +{ + const void *data = source_data; + + if (source_size < sizeof(struct theme_file_header)) + return false; + if (!ro_gui_theme_read_file_header(&theme_install_descriptor, + (struct theme_file_header *) data)) + return false; + if (source_size - sizeof(struct theme_file_header) != + theme_install_descriptor.compressed_size) + return false; + return true; +} + + /** * Callback for fetchcache() for theme install fetches. */ @@ -90,8 +115,8 @@ nserror theme_install_callback(struct hlcache_handle *handle, case CONTENT_MSG_DONE: { - const char *source_data; - unsigned long source_size; + const uint8_t *source_data; + size_t source_size; int author_indent = 0; char buffer[256]; @@ -135,30 +160,6 @@ nserror theme_install_callback(struct hlcache_handle *handle, } -/** - * Fill in theme_install_descriptor from received theme data. - * - * \param source_data received data - * \param source_size size of data - * \return true if data is a correct theme, false on error - * - * If the data is a correct theme, theme_install_descriptor is filled in. - */ - -bool theme_install_read(const char *source_data, unsigned long source_size) -{ - const void *data = source_data; - - if (source_size < sizeof(struct theme_file_header)) - return false; - if (!ro_gui_theme_read_file_header(&theme_install_descriptor, - (struct theme_file_header *) data)) - return false; - if (source_size - sizeof(struct theme_file_header) != - theme_install_descriptor.compressed_size) - return false; - return true; -} /** @@ -174,8 +175,8 @@ bool ro_gui_theme_install_apply(wimp_w w) struct theme_descriptor *theme_install; os_error *error; char *fix; - const char *source_data; - unsigned long source_size; + const uint8_t *source_data; + size_t source_size; assert(theme_install_content); -- cgit v1.2.3