summaryrefslogtreecommitdiff
path: root/frontends/riscos
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-05-05 22:46:40 +0100
committerVincent Sanders <vince@kyllikki.org>2019-05-05 22:50:25 +0100
commit35bc2ccbb89a6b499e0e3b6f7095afea214f0c59 (patch)
treecd494ae1e33ab55d0e644d11eb973ddde4decbb6 /frontends/riscos
parentf966580d22d47ab97bceb2f067fc2b9402af01b7 (diff)
downloadnetsurf-35bc2ccbb89a6b499e0e3b6f7095afea214f0c59.tar.gz
netsurf-35bc2ccbb89a6b499e0e3b6f7095afea214f0c59.tar.bz2
change content get_source_data interfaces to return uint8_t and size_t
previously these interfaces returned char * and unsigned int which was undesirable.
Diffstat (limited to 'frontends/riscos')
-rw-r--r--frontends/riscos/content-handlers/artworks.c32
-rw-r--r--frontends/riscos/content-handlers/draw.c8
-rw-r--r--frontends/riscos/content-handlers/sprite.c7
-rw-r--r--frontends/riscos/gui.c4
-rw-r--r--frontends/riscos/save.c8
-rw-r--r--frontends/riscos/theme_install.c61
6 files changed, 61 insertions, 59 deletions
diff --git a/frontends/riscos/content-handlers/artworks.c b/frontends/riscos/content-handlers/artworks.c
index 8ec4edcae..fcae271ee 100644
--- a/frontends/riscos/content-handlers/artworks.c
+++ b/frontends/riscos/content-handlers/artworks.c
@@ -170,8 +170,8 @@ bool artworks_convert(struct content *c)
{
artworks_content *aw = (artworks_content *) c;
union content_msg_data msg_data;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
void *init_workspace;
void *init_routine;
os_error *error;
@@ -224,7 +224,7 @@ bool artworks_convert(struct content *c)
source_data = content__get_source_data(c, &source_size);
/* initialise (convert file to new format if required) */
- error = awrender_init(&source_data, &source_size,
+ error = awrender_init((const char **)&source_data, &source_size,
init_routine, init_workspace);
if (error) {
NSLOG(netsurf, INFO, "awrender_init: 0x%x : %s",
@@ -313,8 +313,8 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data,
};
artworks_content *aw = (artworks_content *) c;
struct awinfo_block info;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
os_error *error;
os_trfm matrix;
int vals[24];
@@ -389,17 +389,17 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data,
source_data = content__get_source_data(c, &source_size);
- error = awrender_render(source_data,
- &info,
- &matrix,
- vals,
- &aw->block,
- &aw->size,
- 110, /* fully anti-aliased */
- 0,
- source_size,
- aw->render_routine,
- aw->render_workspace);
+ error = awrender_render((const char *)source_data,
+ &info,
+ &matrix,
+ vals,
+ &aw->block,
+ &aw->size,
+ 110, /* fully anti-aliased */
+ 0,
+ source_size,
+ aw->render_routine,
+ aw->render_workspace);
if (error) {
NSLOG(netsurf, INFO, "awrender_render: 0x%x: %s",
diff --git a/frontends/riscos/content-handlers/draw.c b/frontends/riscos/content-handlers/draw.c
index bb66f9dbb..a436ccee7 100644
--- a/frontends/riscos/content-handlers/draw.c
+++ b/frontends/riscos/content-handlers/draw.c
@@ -112,8 +112,8 @@ bool draw_convert(struct content *c)
{
draw_content *draw = (draw_content *) c;
union content_msg_data msg_data;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
const void *data;
os_box bbox;
os_error *error;
@@ -180,8 +180,8 @@ bool draw_redraw(struct content *c, struct content_redraw_data *data,
{
draw_content *draw = (draw_content *) c;
os_trfm matrix;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
const void *src_data;
os_error *error;
diff --git a/frontends/riscos/content-handlers/sprite.c b/frontends/riscos/content-handlers/sprite.c
index 3556aa555..650d8e9aa 100644
--- a/frontends/riscos/content-handlers/sprite.c
+++ b/frontends/riscos/content-handlers/sprite.c
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Content for image/x-riscos-sprite (RISC OS implementation).
*
* No conversion is necessary: we can render RISC OS sprites directly under
@@ -112,8 +113,8 @@ bool sprite_convert(struct content *c)
os_error *error;
int w, h;
union content_msg_data msg_data;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
const void *sprite_data;
char *title;
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index be1bc8d9a..93bad1638 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -1980,8 +1980,8 @@ void ro_gui_view_source(struct hlcache_handle *c)
int objtype;
bool done = false;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
if (!c) {
ro_warn_user("MiscError", "No document source");
diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c
index 76ce6d3e5..86797602b 100644
--- a/frontends/riscos/save.c
+++ b/frontends/riscos/save.c
@@ -908,8 +908,8 @@ static bool ro_gui_save_object_native(struct hlcache_handle *h, char *path)
if (file_type == osfile_TYPE_SPRITE || file_type == osfile_TYPE_DRAW) {
/* Native sprite or drawfile */
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
os_error *error;
source_data = content_get_source_data(h, &source_size);
@@ -960,8 +960,8 @@ static bool
ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite)
{
os_error *error;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
/* does the user want to check for collisions when saving? */
if (!force_overwrite) {
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);
/**
@@ -80,6 +78,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);