From 59fb052818656e74162d7f026f7089ec42c1e8a0 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 27 Dec 2003 00:11:57 +0000 Subject: [project @ 2003-12-27 00:11:57 by jmb] Tidy code to reduce compiler warnings. htmlredraw.c and plugin.c produce the most now. Hopefully I haven't broken anything ;) svn path=/import/netsurf/; revision=451 --- css/css.h | 1 + riscos/dialog.c | 27 +++++++++++++++++++-------- riscos/download.c | 2 +- riscos/draw.c | 9 +++------ riscos/draw.h | 2 +- riscos/filetype.c | 1 + riscos/font.c | 20 +++++++++++--------- riscos/frames.c | 4 ++-- riscos/gif.c | 8 +++++--- riscos/gui.c | 38 +++++++++++++++++++------------------- riscos/gui.h | 1 + riscos/history.c | 9 +++++---- riscos/htmlredraw.c | 11 ++++++++++- riscos/jpeg.c | 9 +++++---- riscos/jpeg.h | 2 +- riscos/menus.c | 9 ++++++--- riscos/mouseactions.c | 28 +++++++++++++++++++--------- riscos/options.c | 2 +- riscos/plugin.c | 6 +++--- riscos/png.c | 28 +++++++++++++--------------- riscos/sprite.c | 19 +++++++++++-------- riscos/sprite.h | 2 +- riscos/textselection.c | 3 ++- riscos/theme.c | 8 +++++--- riscos/window.c | 17 +++++++++-------- 25 files changed, 155 insertions(+), 111 deletions(-) diff --git a/css/css.h b/css/css.h index 4179690b2..bdb13167a 100644 --- a/css/css.h +++ b/css/css.h @@ -231,6 +231,7 @@ void css_merge(struct css_style * const style, const struct css_style * const ap void css_parse_property_list(struct css_style * style, char * str); colour named_colour(const char *name); void css_dump_style(const struct css_style * const style); +void css_dump_stylesheet(const struct css_stylesheet * stylesheet); signed long len(struct css_length * length, struct css_style * style); diff --git a/riscos/dialog.c b/riscos/dialog.c index 47e6d40b2..b5b54f19e 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -45,7 +45,7 @@ static void get_proxy_choices(struct proxy_choices* newchoices); static void load_theme_preview(char* thname); static void set_theme_choices(struct theme_choices* newchoices); static void get_theme_choices(struct theme_choices* newchoices); -static void ro_gui_destroy_theme_menu(void); +/*static void ro_gui_destroy_theme_menu(void);*/ static void ro_gui_build_theme_menu(void); static int file_exists(const char* base, const char* dir, const char* leaf, bits ftype); static void set_icon_state(wimp_w w, wimp_i i, int state); @@ -375,7 +375,7 @@ int size; if ((size = (int) ftell(fp)) == -1) die("ftell() failed"); fclose(fp); - theme_preview = xcalloc(size + 16, 1); + theme_preview = xcalloc((unsigned int)(size + 16), 1); if (theme_preview == NULL) return; @@ -410,14 +410,24 @@ void ro_gui_redraw_config_th(wimp_draw* redraw) x = preview.icon.extent.x0 + win.visible.x0 + 4; y = preview.icon.extent.y0 + win.visible.y1 + 4; - xcolourtrans_generate_table_for_sprite(theme_preview, "preview", -1, -1, 0, 0, 0, 0, &size); - trans_tab = malloc(size + 32); - xcolourtrans_generate_table_for_sprite(theme_preview, "preview", -1, -1, trans_tab, 0, 0, 0, &size); + xcolourtrans_generate_table_for_sprite(theme_preview, + (osspriteop_id)"preview", + (os_mode)-1, + (os_palette const*)-1, + 0, 0, 0, 0, &size); + trans_tab = malloc((unsigned int)(size + 32)); + xcolourtrans_generate_table_for_sprite(theme_preview, + (osspriteop_id)"preview", + (os_mode)-1, + (os_palette const*)-1, + trans_tab, 0, 0, 0, &size); more = wimp_redraw_window(redraw); while (more) { - xosspriteop_put_sprite_scaled(osspriteop_NAME, theme_preview, "preview", x, y, 0, 0, trans_tab); + xosspriteop_put_sprite_scaled(osspriteop_NAME, theme_preview, + (osspriteop_id)"preview", x, y, + (osspriteop_action)0, 0, trans_tab); more = wimp_get_rectangle(redraw); } @@ -508,7 +518,7 @@ void ro_gui_build_theme_menu(void) (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT); theme_menu->entries[i].data.indirected_text.text = xstrdup(info.name); - theme_menu->entries[i].data.indirected_text.validation = -1; + theme_menu->entries[i].data.indirected_text.validation = (char*)-1; theme_menu->entries[i].data.indirected_text.size = strlen(info.name) + 1; @@ -576,7 +586,8 @@ void set_icon_string(wimp_w w, wimp_i i, char* text) ic.w = w; ic.i = i; wimp_get_icon_state(&ic); - strncpy(ic.icon.data.indirected_text.text, text, ic.icon.data.indirected_text.size); + strncpy(ic.icon.data.indirected_text.text, text, + (unsigned int)ic.icon.data.indirected_text.size); } char* get_icon_string(wimp_w w, wimp_i i) diff --git a/riscos/download.c b/riscos/download.c index 0396fba58..751109040 100644 --- a/riscos/download.c +++ b/riscos/download.c @@ -110,7 +110,7 @@ void ro_gui_download_leaf(const char *url, char *leaf) { char *slash; size_t len; - int i; + unsigned int i; /* take url from last / to first non-RISC OS character, eg. '.' */ slash = strrchr(url, '/'); diff --git a/riscos/draw.c b/riscos/draw.c index b8a07e7f4..3068649c1 100644 --- a/riscos/draw.c +++ b/riscos/draw.c @@ -24,7 +24,7 @@ void draw_create(struct content *c) void draw_process_data(struct content *c, char *data, unsigned long size) { c->data.draw.data = xrealloc(c->data.draw.data, c->data.draw.length + size); - memcpy(c->data.draw.data + c->data.draw.length, data, size); + memcpy((char*)c->data.draw.data + c->data.draw.length, data, size); c->data.draw.length += size; c->size += size; } @@ -46,7 +46,7 @@ int draw_convert(struct content *c, unsigned int width, unsigned int height) /* BBox contents in Draw units (256*OS unit) */ error = xdrawfile_bbox(0, (drawfile_diagram*)(c->data.draw.data), - c->data.draw.length, matrix, bbox); + (int)c->data.draw.length, matrix, bbox); if (error) { LOG(("error: %s", error->errmess)); @@ -90,9 +90,6 @@ void draw_redraw(struct content *c, long x, long y, unsigned long width, unsigned long height, long clip_x0, long clip_y0, long clip_x1, long clip_y1) { - os_error *error; - unsigned int size; - os_box bbox; os_trfm *matrix = xcalloc(1, sizeof(os_trfm)); /* Scaled image. Transform units (65536*OS units) */ @@ -105,7 +102,7 @@ void draw_redraw(struct content *c, long x, long y, matrix->entries[2][1] = (y-height) * 256; xdrawfile_render(0, (drawfile_diagram*)(c->data.draw.data), - c->data.draw.length, matrix, 0, 0); + (int)c->data.draw.length, matrix, 0, 0); xfree(matrix); } diff --git a/riscos/draw.h b/riscos/draw.h index 4ea73386d..b7eef6db3 100644 --- a/riscos/draw.h +++ b/riscos/draw.h @@ -11,7 +11,7 @@ struct content; struct content_draw_data { - void* data; + void *data; unsigned long length; }; diff --git a/riscos/filetype.c b/riscos/filetype.c index ffb1b73b7..d31f4cda1 100644 --- a/riscos/filetype.c +++ b/riscos/filetype.c @@ -6,6 +6,7 @@ */ #include +#include #include #include "oslib/osfile.h" #include "netsurf/content/fetch.h" diff --git a/riscos/font.c b/riscos/font.c index 6eaabcc97..a33653ec9 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -12,6 +12,7 @@ #include "netsurf/css/css.h" #include "netsurf/desktop/gui.h" #include "netsurf/render/font.h" +#include "netsurf/riscos/gui.h" #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" @@ -53,11 +54,11 @@ unsigned long font_width(struct font_data *font, const char * text, unsigned int if (length == 0) return 0; - error = xfont_scan_string(font->handle, text, + error = xfont_scan_string((font_f)(font->handle), text, font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH, 0x7fffffff, 0x7fffffff, 0, - 0, length, + 0, (int)length, 0, &width, 0, 0); if (error != 0) { fprintf(stderr, "%s\n", error->errmess); @@ -80,11 +81,11 @@ void font_position_in_string(const char* text, struct font_data* font, block.letter.x = block.letter.y = 0; block.split_char = -1; - xfont_scan_string(font->handle, text, + xfont_scan_string((font_f)(font->handle), text, font_GIVEN_BLOCK | font_GIVEN_FONT | font_KERN | font_RETURN_CARET_POS | font_GIVEN_LENGTH, ro_x_units(x) * 400, 0x7fffffff, - &block, 0, length, + &block, 0, (int)length, &split_point, &x_out, &y_out, &length_out); *char_offset = (int)(split_point - text); @@ -149,7 +150,8 @@ struct font_data *font_open(struct font_set *set, struct css_style *style) os_error *error; LOG(("font_find_font '%s' %i", font_table[f], size)); - error = xfont_find_font(font_table[f], size, size, 0, 0, &handle, 0, 0); + error = xfont_find_font(font_table[f], (int)size, (int)size, + 0, 0, &handle, 0, 0); if (error != 0) { fprintf(stderr, "%s\n", error->errmess); die("font_find_font failed"); @@ -186,7 +188,7 @@ void font_free_set(struct font_set *set) void font_close(struct font_data *data) { - font_lose_font(data->handle); + font_lose_font((font_f)(data->handle)); free(data); } @@ -202,12 +204,12 @@ char * font_split(struct font_data *data, const char * text, unsigned int length block.space.x = block.space.y = block.letter.x = block.letter.y = 0; block.split_char = ' '; - error = xfont_scan_string(data->handle, text, + error = xfont_scan_string((font_f)(data->handle), text, font_GIVEN_BLOCK | font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH, ro_x_units(width) * 400, 0x7fffffff, &block, 0, - length, + (int)length, &split, used_width, 0, 0); if (error != 0) { @@ -215,7 +217,7 @@ char * font_split(struct font_data *data, const char * text, unsigned int length die("font_split: font_scan_string failed"); } - *used_width = browser_x_units(*used_width / 400); + *used_width = browser_x_units((int)(*used_width / 400)); return split; } diff --git a/riscos/frames.c b/riscos/frames.c index fa1db8c48..055d531e5 100644 --- a/riscos/frames.c +++ b/riscos/frames.c @@ -34,8 +34,8 @@ void frame_add_instance(struct content *c, struct browser_window *parent, os_error *e; gui_window *g = (gui_window*)xcalloc(1, sizeof(gui_window)); - bw = create_browser_window(parent->flags, parent->format_width, - parent->format_height, parent); + bw = create_browser_window(parent->flags, (int)parent->format_width, + (int)parent->format_height, parent); w.visible.x0 = 346; w.visible.x1 = 370; diff --git a/riscos/gif.c b/riscos/gif.c index 3eceb9db7..97ed89e76 100644 --- a/riscos/gif.c +++ b/riscos/gif.c @@ -106,7 +106,7 @@ int nsgif_convert(struct content *c, unsigned int iwidth, unsigned int iheight) } } else - memset(mask, 255, header->mask - header->image); + memset(mask, 255, (unsigned int)(header->mask - header->image)); c->title = xcalloc(100, sizeof(char)); sprintf(c->title, "GIF image (%lux%lu)", c->width, c->height); @@ -156,11 +156,13 @@ void nsgif_redraw(struct content *c, long x, long y, xosspriteop_put_sprite_scaled(osspriteop_PTR, c->data.gif.sprite_area, (osspriteop_id) (c->data.gif.sprite_area + 1), - x, y - height, + x, (int)(y - height), /* osspriteop_USE_PALETTE is RO 3.5+ only. * behaviour on RO < 3.5 is unknown... */ - osspriteop_USE_MASK | osspriteop_USE_PALETTE, &factors, table); + (osspriteop_action)(osspriteop_USE_MASK | + osspriteop_USE_PALETTE), + &factors, table); xfree(table); } diff --git a/riscos/gui.c b/riscos/gui.c index 0b241dcc6..1df4b19cf 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -252,7 +252,7 @@ void gui_poll(bool active) if (g != NULL) browser_window_destroy(g->data.browser.bw, true); else - ro_gui_dialog_close(&(block.close.w)); + ro_gui_dialog_close((wimp_w)(&(block.close.w))); break; case wimp_POINTER_LEAVING_WINDOW : @@ -675,11 +675,10 @@ void ro_msg_datasave(wimp_message* block) struct browser_window* bw; wimp_message_data_xfer* data; int x,y; - struct box_selection* click_boxes; - int found, plot_index; - int i; - int done = 0; - wimp_window_state state; + struct box_selection* click_boxes; + int found, plot_index; + int i; + wimp_window_state state; data = &block->data.data_xfer; @@ -689,8 +688,8 @@ void ro_msg_datasave(wimp_message* block) bw = gui->data.browser.bw; - state.w = data->w; - wimp_get_window_state(&state); + state.w = data->w; + wimp_get_window_state(&state); x = browser_x_units(window_x_units(data->pos.x, &state)); y = browser_y_units(window_y_units(data->pos.y, &state)); @@ -699,7 +698,8 @@ void ro_msg_datasave(wimp_message* block) plot_index = 0; box_under_area(bw->current_content->data.html.layout->children, - x, y, 0, 0, &click_boxes, &found, &plot_index); + (unsigned int)x, (unsigned int)y, 0, 0, &click_boxes, + &found, &plot_index); if (found == 0) return; @@ -730,11 +730,10 @@ void ro_msg_dataload(wimp_message* block) struct browser_window* bw; wimp_message_data_xfer* data; int x,y; - struct box_selection* click_boxes; - int found, plot_index; - int i; - int done = 0; - wimp_window_state state; + struct box_selection* click_boxes; + int found, plot_index; + int i; + wimp_window_state state; data = &block->data.data_xfer; @@ -744,8 +743,8 @@ void ro_msg_dataload(wimp_message* block) bw = gui->data.browser.bw; - state.w = data->w; - wimp_get_window_state(&state); + state.w = data->w; + wimp_get_window_state(&state); x = browser_x_units(window_x_units(data->pos.x, &state)); y = browser_y_units(window_y_units(data->pos.y, &state)); @@ -754,7 +753,8 @@ void ro_msg_dataload(wimp_message* block) plot_index = 0; box_under_area(bw->current_content->data.html.layout->children, - x, y, 0, 0, &click_boxes, &found, &plot_index); + (unsigned int)x, (unsigned int)y, 0, 0, &click_boxes, + &found, &plot_index); if (found == 0) return; @@ -811,7 +811,7 @@ int ro_save_data(void *data, unsigned long length, char *file_name, bits file_ty { os_error *written = NULL; - void *end_data = (int)data + length; + void *end_data = (void*)((int)data + length); written = xosfile_save_stamped(file_name, file_type, data, end_data); @@ -928,7 +928,7 @@ void ro_gui_drag_box_start(wimp_pointer *pointer) icon_icon = xcalloc(1, sizeof(*icon_icon)); drag_box = xcalloc(1, sizeof(*drag_box)); - drag_box->w = pointer->i; + drag_box->w = pointer->w; drag_box->type = wimp_DRAG_USER_FIXED; icon_window->w = pointer->w; diff --git a/riscos/gui.h b/riscos/gui.h index b894a1e01..6153be6f8 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -97,6 +97,7 @@ void ro_gui_copy_selection(gui_window* g); void ro_gui_open_help_page(void); void ro_gui_screen_size(int *width, int *height); void ro_gui_view_source(struct content *content); +void ro_gui_drag_box_start(wimp_pointer *pointer); /* in menus.c */ void ro_gui_menus_init(void); diff --git a/riscos/history.c b/riscos/history.c index 0e9ea8545..42711a20c 100644 --- a/riscos/history.c +++ b/riscos/history.c @@ -7,6 +7,7 @@ #include #include +#include "oslib/colourtrans.h" #include "oslib/font.h" #include "oslib/wimp.h" #include "netsurf/riscos/gui.h" @@ -114,8 +115,8 @@ void ro_gui_history_open(struct browser_window *bw, struct history_entry *entry, int wx, int wy) { bool done = false; - unsigned int i, j; - int x, max_y = 0; + unsigned int i, j, max_y = 0; + int x; struct history_entry *row[SIZE], *row2[SIZE]; struct history_entry *he; os_box box = {0, 0, 0, 0}; @@ -170,7 +171,7 @@ void ro_gui_history_open(struct browser_window *bw, } box.x1 = WIDTH * (x - 1); - box.y0 = -HEIGHT * (max_y + 1); + box.y0 = -(HEIGHT * (max_y + 1)); wimp_set_extent(history_window, &box); wimp_create_menu((wimp_menu *) history_window, wx, wy); } @@ -212,7 +213,7 @@ void ro_gui_history_redraw_tree(struct history_entry *he, if (he == history_current) wimp_set_font_colours(wimp_COLOUR_WHITE, wimp_COLOUR_RED); - else + else wimp_set_font_colours(wimp_COLOUR_WHITE, wimp_COLOUR_BLACK); font_paint(history_font, he->title, diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c index 60f95efe0..37ff71b10 100644 --- a/riscos/htmlredraw.c +++ b/riscos/htmlredraw.c @@ -131,7 +131,8 @@ void html_redraw_box(struct content *content, struct box * box, } if (box->object /*&& box->object->type != CONTENT_HTML*/) { - content_redraw(box->object, x, y, width, height, x0, y0, x1, y1); + content_redraw(box->object, x, y, (unsigned int)width, + (unsigned int)height, x0, y0, x1, y1); } else if (box->gadget && (box->gadget->type == GADGET_CHECKBOX || @@ -226,6 +227,14 @@ void html_redraw_box(struct content *content, struct box * box, LOG(("writing GADGET RADIO")); wimp_plot_icon(&icon); break; + case GADGET_HIDDEN: + case GADGET_TEXTBOX: + case GADGET_TEXTAREA: + case GADGET_IMAGE: + case GADGET_PASSWORD: + case GADGET_SUBMIT: + case GADGET_RESET: + break; } } else if (box->text && box->font) { diff --git a/riscos/jpeg.c b/riscos/jpeg.c index 842480878..b1f62c169 100644 --- a/riscos/jpeg.c +++ b/riscos/jpeg.c @@ -29,7 +29,7 @@ void jpeg_create(struct content *c) void jpeg_process_data(struct content *c, char *data, unsigned long size) { c->data.jpeg.data = xrealloc(c->data.jpeg.data, c->data.jpeg.length + size); - memcpy(c->data.jpeg.data + c->data.jpeg.length, data, size); + memcpy((char*)(c->data.jpeg.data) + c->data.jpeg.length, data, size); c->data.jpeg.length += size; c->size += size; } @@ -39,8 +39,9 @@ int jpeg_convert(struct content *c, unsigned int width, unsigned int height) { os_error *error; int w, h; - error = xjpeginfo_dimensions(c->data.jpeg.data, (int) c->data.jpeg.length, - 0, &w, &h, 0, 0, 0); + error = xjpeginfo_dimensions((jpeg_image const*)c->data.jpeg.data, + (int) c->data.jpeg.length, + 0, &w, &h, 0, 0, 0); if (error != 0) return 1; c->width = w; @@ -80,7 +81,7 @@ void jpeg_redraw(struct content *c, long x, long y, factors.ydiv = c->height * 2; xjpeg_plot_scaled((jpeg_image *) c->data.jpeg.data, - x, y - height, + x, (int)(y - height), &factors, (int) c->data.jpeg.length, jpeg_SCALE_DITHERED); } diff --git a/riscos/jpeg.h b/riscos/jpeg.h index 092840e73..12a567755 100644 --- a/riscos/jpeg.h +++ b/riscos/jpeg.h @@ -11,7 +11,7 @@ struct content; struct content_jpeg_data { - char *data; + void *data; unsigned long length; }; diff --git a/riscos/menus.c b/riscos/menus.c index 12777ace3..78ec67db0 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -150,8 +150,11 @@ void ro_gui_create_menu(wimp_menu *menu, int x, int y, gui_window *g) void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i) { - wimp_window_state state = { w }; - wimp_icon_state icon_state = { w, i }; + wimp_window_state state; + wimp_icon_state icon_state; + state.w = w; + icon_state.w = w; + icon_state.i = i; wimp_get_window_state(&state); wimp_get_icon_state(&icon_state); ro_gui_create_menu(menu, state.visible.x0 + icon_state.icon.extent.x1, @@ -245,7 +248,7 @@ void ro_gui_menu_selection(wimp_selection *selection) if (pointer.buttons == wimp_CLICK_ADJUST) { if (current_menu == combo_menu) - gui_gadget_combo(current_gui->data.browser.bw, current_gadget, current_menu_x, current_menu_y); + gui_gadget_combo(current_gui->data.browser.bw, current_gadget, (unsigned int)current_menu_x, (unsigned int)current_menu_y); else ro_gui_create_menu(current_menu, current_menu_x, current_menu_y, current_gui); } diff --git a/riscos/mouseactions.c b/riscos/mouseactions.c index 6c0bd6289..b5e3fc550 100644 --- a/riscos/mouseactions.c +++ b/riscos/mouseactions.c @@ -58,6 +58,8 @@ void ro_gui_mouse_action(gui_window *g) { browser_window_open_location_historical(g->data.browser.bw, g->data.browser.bw->url, 0, 0); break; + + default: break; } } } @@ -145,13 +147,13 @@ mouseaction ro_gui_try_mouse_action(void) { offset.y = current.y - start.y; moved.x = current.x - last.x; moved.y = current.y - last.y; - offsetDistance = sqrt((offset.x * offset.x + offset.y * offset.y)); + offsetDistance = sqrt((float)(offset.x * offset.x + offset.y * offset.y)); if (moved.x > 0 || moved.y > 0) - movedDistance = sqrt((moved.x * moved.x + moved.y * moved.y)); + movedDistance = sqrt((float)(moved.x * moved.x + moved.y * moved.y)); else movedDistance = 0.0; - angle = calculate_angle(offset.x, offset.y); + angle = calculate_angle((float)offset.x, (float)offset.y); switch (status) { @@ -168,10 +170,10 @@ mouseaction ro_gui_try_mouse_action(void) { case 0: if (offsetDistance > THRESHOLD) { - if (fabs(offset.x) > fabs(offset.y)) { + if (fabs((float)offset.x) > fabs((float)offset.y)) { - if (fabs(offset.y) < fabs(offset.x) * DAMPING && - fabs(offset.x) > THRESHOLD*0.75) { + if (fabs((float)offset.y) < fabs((float)offset.x) * DAMPING && + fabs((float)offset.x) > THRESHOLD*0.75) { if (offset.x < 0) moves[m] = move_LEFT; @@ -187,10 +189,10 @@ mouseaction ro_gui_try_mouse_action(void) { status = 1; } } - else if (fabs(offset.y) > fabs(offset.x)) { + else if (fabs((float)offset.y) > fabs((float)offset.x)) { - if (fabs(offset.x) < fabs(offset.y) * DAMPING && - fabs(offset.y) > THRESHOLD*0.75) { + if (fabs((float)offset.x) < fabs((float)offset.y) * DAMPING && + fabs((float)offset.y) > THRESHOLD*0.75) { if (offset.y < 0) moves[m] = move_DOWN; @@ -232,6 +234,8 @@ mouseaction ro_gui_try_mouse_action(void) { case move_DOWN: LOG(("mouse action: create new window // open link in new window, foreground")); return mouseaction_NEWWINDOW_OR_LINKFG; + + default: break; } } @@ -253,6 +257,8 @@ mouseaction ro_gui_try_mouse_action(void) { case move_LEFT: LOG(("mouse action: parent directroy")); return mouseaction_PARENT; + + default: break; } break; @@ -270,8 +276,12 @@ mouseaction ro_gui_try_mouse_action(void) { case move_RIGHT: LOG(("mouse action: close")); return mouseaction_CLOSE; + + default: break; } break; + + default: break; } } diff --git a/riscos/options.c b/riscos/options.c index c570ddbfb..a1c096777 100644 --- a/riscos/options.c +++ b/riscos/options.c @@ -143,7 +143,7 @@ void options_read(struct options* opt, char* filename) } LOG(("Allocating %d bytes", size)); - data = xcalloc(size, sizeof(char)); + data = xcalloc((unsigned int)size, sizeof(char)); messagetrans_open_file(&cb, fn, data); opt->http = lookup_yesno(&cb, "USE_HTTP", "N"); diff --git a/riscos/plugin.c b/riscos/plugin.c index d480bf8fc..4bdbdf4e9 100644 --- a/riscos/plugin.c +++ b/riscos/plugin.c @@ -439,7 +439,7 @@ void plugin_create_sysvar(const char *mime_type, char* sysvar) e = xmimemaptranslate_mime_type_to_filetype(mime_type, (bits *) &fv); - sprintf(sysvar, "%s%x", ALIAS_PREFIX, fv); + sprintf(sysvar, "%s%x", ALIAS_PREFIX, (unsigned int)fv); } /** @@ -458,7 +458,7 @@ bool plugin_handleable(const char *mime_type) return false; } - sprintf(sysvar, "%s%x", ALIAS_PREFIX, fv); + sprintf(sysvar, "%s%x", ALIAS_PREFIX, (unsigned int)fv); LOG(("%s, %s", mime_type, sysvar)); if (getenv(sysvar) == 0) return false; @@ -804,7 +804,7 @@ void plugin_write_stream(struct browser_window *bw, struct object_params *params plugin_message_stream_write *pmsw; plugin_message_stream_written *pmswt; struct plugin_message *temp; - int consumed = 0; + unsigned int consumed = 0; pmsw = (plugin_message_stream_write*)&m.data; diff --git a/riscos/png.c b/riscos/png.c index bab5f678b..c6fbb3cfc 100644 --- a/riscos/png.c +++ b/riscos/png.c @@ -59,7 +59,8 @@ void nspng_init(void) colourtrans_return_colour_number_for_mode( blue << 28 | blue << 24 | green << 20 | green << 16 | - red << 12 | red << 8, 21, 0); + red << 12 | red << 8, + (os_mode)21, 0); } @@ -99,7 +100,7 @@ void nspng_process_data(struct content *c, char *data, unsigned long size) c->data.png.length + size); memcpy(c->data.png.data + c->data.png.length, data, size); c->data.png.length += size; - c->size += size; + c->size += size; return; } #endif @@ -125,12 +126,10 @@ void nspng_process_data(struct content *c, char *data, unsigned long size) void info_callback(png_structp png, png_infop info) { - char *row, **row_pointers; int i, bit_depth, color_type, palette_size, log2bpp, interlace; unsigned int rowbytes, sprite_size; unsigned long width, height; struct content *c = png_get_progressive_ptr(png); - os_palette *palette; os_sprite_palette *sprite_palette; osspriteop_area *sprite_area; osspriteop_header *sprite; @@ -148,8 +147,8 @@ void info_callback(png_structp png, png_infop info) &color_type, &interlace, 0, 0); png_get_PLTE(png, info, &png_palette, &palette_size); - if (interlace == PNG_INTERLACE_ADAM7) - ; /*png_set_interlace_handling(png);*/ + /*if (interlace == PNG_INTERLACE_ADAM7) + ; png_set_interlace_handling(png);*/ if (png_get_bKGD(png, info, &png_background)) png_set_background(png, png_background, @@ -169,7 +168,7 @@ void info_callback(png_structp png, png_infop info) sprite_size += height * ((width + 3) & ~3u); else sprite_size += height * ((width + 3) & ~3u) * 4; - + sprite_area = xcalloc(sprite_size + 1000, 1); sprite_area->size = sprite_size; sprite_area->sprite_count = 1; @@ -249,7 +248,7 @@ void info_callback(png_structp png, png_infop info) c->width = width; c->height = height; - LOG(("size %li * %li, bpp %i, rowbytes %lu", width, + LOG(("size %li * %li, bpp %i, rowbytes %u", width, height, bit_depth, rowbytes)); } @@ -265,9 +264,8 @@ void row_callback(png_structp png, png_bytep new_row, struct content *c = png_get_progressive_ptr(png); unsigned long i, j, rowbytes = c->data.png.rowbytes; unsigned int start = 0, step = 1; - int red, green, blue, alpha; + int red, green, blue; char *row = c->data.png.sprite_image + row_num * ((c->width + 3) & ~3u); - os_colour_number col; /*LOG(("PNG row %li, pass %i, row %p, new_row %p", row_num, pass, row, new_row));*/ @@ -302,7 +300,7 @@ void row_callback(png_structp png, png_bytep new_row, void end_callback(png_structp png, png_infop info) { - struct content *c = png_get_progressive_ptr(png); + /*struct content *c = png_get_progressive_ptr(png);*/ LOG(("PNG end")); @@ -322,8 +320,8 @@ int nspng_convert(struct content *c, unsigned int width, unsigned int height) int w, h; kerror = ifc_convert(c->data.png.data, c->data.png.length, - 0xb60, 0xff9, -1, 1, - &c->data.png.sprite_area, &dest_len); + 0xb60, 0xff9, (unsigned int)-1, 1, + (char**)&c->data.png.sprite_area, &dest_len); if (kerror) { LOG(("ifc_convert failed: %s", kerror->errmess)); return 1; @@ -382,7 +380,7 @@ void nspng_redraw(struct content *c, long x, long y, c->data.png.sprite_area->first), colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE, 0, colourtrans_GIVEN_SPRITE, 0, 0, &size); - table = xcalloc(size, 1); + table = xcalloc((unsigned int)size, 1); xcolourtrans_generate_table_for_sprite(c->data.png.sprite_area, (osspriteop_id) ((char *) c->data.png.sprite_area + c->data.png.sprite_area->first), @@ -398,7 +396,7 @@ void nspng_redraw(struct content *c, long x, long y, c->data.png.sprite_area, (osspriteop_id) ((char *) c->data.png.sprite_area + c->data.png.sprite_area->first), - x, y - height, + x, (int)(y - height), os_ACTION_OVERWRITE | os_ACTION_USE_MASK, &factors, table); diff --git a/riscos/sprite.c b/riscos/sprite.c index 4168b2869..7470ea0b1 100644 --- a/riscos/sprite.c +++ b/riscos/sprite.c @@ -25,7 +25,7 @@ void sprite_create(struct content *c) void sprite_process_data(struct content *c, char *data, unsigned long size) { c->data.sprite.data = xrealloc(c->data.sprite.data, c->data.sprite.length + size); - memcpy(c->data.sprite.data + c->data.sprite.length, data, size); + memcpy((char*)(c->data.sprite.data) + c->data.sprite.length, data, size); c->data.sprite.length += size; c->size += size; } @@ -35,14 +35,14 @@ int sprite_convert(struct content *c, unsigned int width, unsigned int height) { os_error *error; int w, h; - osspriteop_area *area = c->data.sprite.data; + osspriteop_area *area = (osspriteop_area*)c->data.sprite.data; /* fill in the size (first word) of the area */ area->size = c->data.sprite.length; error = xosspriteop_read_sprite_info(osspriteop_PTR, area, - (osspriteop_id)(c->data.sprite.data + area->first), + (osspriteop_id)((char*)(c->data.sprite.data) + area->first), &w, &h, NULL, NULL); if (error) { @@ -82,19 +82,21 @@ void sprite_redraw(struct content *c, long x, long y, long clip_x0, long clip_y0, long clip_x1, long clip_y1) { unsigned int size; - osspriteop_area *area = c->data.sprite.data; + osspriteop_area *area = (osspriteop_area*)c->data.sprite.data; osspriteop_trans_tab *table; os_factors factors; xcolourtrans_generate_table_for_sprite( area, - (osspriteop_id)(c->data.sprite.data + area->first), + (osspriteop_id)((char*)(c->data.sprite.data) + + area->first), colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE, 0, colourtrans_GIVEN_SPRITE, 0, 0, &size); table = xcalloc(size, 1); xcolourtrans_generate_table_for_sprite( area, - (osspriteop_id)(c->data.sprite.data + area->first), + (osspriteop_id)((char*)(c->data.sprite.data) + + area->first), colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE, table, colourtrans_GIVEN_SPRITE, 0, 0, 0); @@ -105,8 +107,9 @@ void sprite_redraw(struct content *c, long x, long y, xosspriteop_put_sprite_scaled(osspriteop_PTR, area, - (osspriteop_id)(c->data.sprite.data + area->first), - x, y - height, + (osspriteop_id)((char*)(c->data.sprite.data) + + area->first), + x, (int)(y - height), osspriteop_USE_MASK | osspriteop_USE_PALETTE, &factors, table); xfree(table); diff --git a/riscos/sprite.h b/riscos/sprite.h index d917c3c6f..bef511ad0 100644 --- a/riscos/sprite.h +++ b/riscos/sprite.h @@ -13,7 +13,7 @@ struct content; struct content_sprite_data { - char *data; + void *data; unsigned long length; }; diff --git a/riscos/textselection.c b/riscos/textselection.c index bad404829..fec3bbc69 100644 --- a/riscos/textselection.c +++ b/riscos/textselection.c @@ -5,6 +5,7 @@ * Copyright 2003 Phil Mellor */ +#include #include "oslib/wimp.h" #include "netsurf/riscos/gui.h" #include "netsurf/utils/log.h" @@ -122,7 +123,7 @@ void ro_gui_drag_end(wimp_dragged* drag) strcpy(send_message->data.data_xfer.file_name, current_drag.data.download.gui->data.download.path); - LOG(("Sending message to window owner, filename = %s, length = %lu", + LOG(("Sending message to window owner, filename = %s, length = %d", send_message->data.data_xfer.file_name, send_message->data.data_xfer.est_size)); diff --git a/riscos/theme.c b/riscos/theme.c index 25cc6eb67..b42391f42 100644 --- a/riscos/theme.c +++ b/riscos/theme.c @@ -74,7 +74,7 @@ void ro_theme_load(char *pathname) obj_type = osfile_read_no_path(filename, 0, 0, &size, 0); assert(obj_type & fileswitch_IS_FILE); - theme_sprite_area = xcalloc(size + 16, 1); + theme_sprite_area = xcalloc((unsigned int)(size + 16), 1); theme_sprite_area->size = size + 16; theme_sprite_area->sprite_count = 0; theme_sprite_area->first = 16; @@ -94,7 +94,7 @@ void ro_theme_load(char *pathname) osspriteop_return_name(osspriteop_USER_AREA, theme_sprite_area, name, 32, i); if (strncmp(name, "throbber", 8) == 0) { - int n = atoi(name + 8); + unsigned int n = atoi(name + 8); if (theme_throbs < n) theme_throbs = n; } @@ -140,7 +140,9 @@ int ro_theme_toolbar_height(void) void ro_theme_resize_toolbar(wimp_w w, int width, int height) { - wimp_icon_state ic = {w, ICON_TOOLBAR_URL}; + wimp_icon_state ic; + ic.w = w; + ic.i = ICON_TOOLBAR_URL; wimp_get_icon_state(&ic); wimp_resize_icon(w, ICON_TOOLBAR_URL, ic.icon.extent.x0, ic.icon.extent.y0, diff --git a/riscos/window.c b/riscos/window.c index 8d5da2df9..e2f6e17ae 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -15,6 +15,7 @@ #include #include "oslib/wimp.h" #include "oslib/wimpspriteop.h" +#include "netsurf/css/css.h" #include "netsurf/riscos/about.h" #include "netsurf/riscos/constdata.h" #include "netsurf/riscos/gui.h" @@ -82,7 +83,7 @@ gui_window *gui_create_browser_window(struct browser_window *bw) window.xmin = 100; window.ymin = window.extent.y1 + 100; window.title_data.indirected_text.text = g->title; - window.title_data.indirected_text.validation = -1; + window.title_data.indirected_text.validation = (char*)-1; window.title_data.indirected_text.size = 255; window.icon_count = 0; g->window = wimp_create_window(&window); @@ -277,9 +278,9 @@ void gui_window_set_extent(gui_window *g, unsigned long width, if (g->data.browser.bw->flags & browser_TOOLBAR) toolbar_height = ro_theme_toolbar_height(); - if (width < state.visible.x1 - state.visible.x0) + if (width < (unsigned int)(state.visible.x1 - state.visible.x0)) width = state.visible.x1 - state.visible.x0; - if (height < state.visible.y1 - state.visible.y0 - toolbar_height) + if (height < (unsigned int)(state.visible.y1 - state.visible.y0 - toolbar_height)) height = state.visible.y1 - state.visible.y0 - toolbar_height; extent.y0 = -height; @@ -348,7 +349,7 @@ void ro_gui_window_open(gui_window *g, wimp_open *open) } /* the height should be no less than the content height */ - if (content && height < content->height * 2) + if (content && (unsigned int)height < content->height * 2) height = content->height * 2; /* change extent if necessary */ @@ -361,7 +362,7 @@ void ro_gui_window_open(gui_window *g, wimp_open *open) g->data.browser.old_width = width; g->data.browser.old_height = height; - if (content && width < content->width * 2) + if (content && (unsigned int)width < content->width * 2) width = content->width * 2; else { os_box extent = { 0, -height, width, toolbar_height }; @@ -377,7 +378,7 @@ void ro_gui_window_open(gui_window *g, wimp_open *open) !(state.flags & wimp_WINDOW_FULL_SIZE)) { width = open->visible.x1 - open->visible.x0; height = open->visible.y1 - open->visible.y0 - toolbar_height; - if (content && height < content->height * 2) + if (content && (unsigned int)height < content->height * 2) height = content->height * 2; { os_box extent = { 0, -height, width, toolbar_height }; @@ -407,7 +408,7 @@ void ro_gui_window_open(gui_window *g, wimp_open *open) void ro_gui_throb(void) { gui_window* g; - float nowtime = (float) clock() / CLOCKS_PER_SEC; + float nowtime = (float) (clock() / CLOCKS_PER_SEC); for (g = window_list; g != NULL; g = g->next) { @@ -421,7 +422,7 @@ void ro_gui_throb(void) { g->throbtime = nowtime; g->throbber++; - if (theme_throbs < g->throbber) + if (theme_throbs < (unsigned int)g->throbber) g->throbber = 0; sprintf(g->throb_buf, "throbber%u", g->throbber); wimp_set_icon_state(g->data.browser.toolbar, -- cgit v1.2.3