From dd96a69573e7a45b5ac4a2b172319d900c89f53b Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 6 May 2019 10:31:51 +0100 Subject: fix several amiga frontend warnings --- frontends/amiga/Makefile | 2 ++ frontends/amiga/bitmap.c | 11 +++++++---- frontends/amiga/corewindow.c | 20 +++++++++++--------- frontends/amiga/font_bullet.c | 4 +++- frontends/amiga/gui.c | 1 - frontends/amiga/history_local.h | 4 ++-- 6 files changed, 25 insertions(+), 17 deletions(-) (limited to 'frontends/amiga') diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile index 421be0ece..77d2b45f4 100644 --- a/frontends/amiga/Makefile +++ b/frontends/amiga/Makefile @@ -31,6 +31,8 @@ ifeq ($(SUBTARGET),os3) LDFLAGS += -lamiga -lm endif +COMMON_WARNFLAGS += -Wno-cast-align + EXETARGET := NetSurf # The filter and target for split messages diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index 32b9b1290..8341d41c8 100644 --- a/frontends/amiga/bitmap.c +++ b/frontends/amiga/bitmap.c @@ -531,10 +531,13 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, } ami_bitmap_rgba_to_argb(bitmap); - if(bitmap->drawhandle = ObtainDrawHandle(NULL, - &rp, scrn->ViewPort.ColorMap, - GGFX_DitherMode, dithermode, - TAG_DONE)) { + bitmap->drawhandle = ObtainDrawHandle( + NULL, + &rp, + scrn->ViewPort.ColorMap, + GGFX_DitherMode, dithermode, + TAG_DONE); + if(bitmap->drawhandle) { APTR ddh = CreateDirectDrawHandle(bitmap->drawhandle, bitmap->width, bitmap->height, width, height, NULL); diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c index 42ee866ea..627d3286e 100644 --- a/frontends/amiga/corewindow.c +++ b/frontends/amiga/corewindow.c @@ -68,17 +68,19 @@ #include "amiga/utf8.h" static void -ami_cw_scroller_top(struct ami_corewindow *ami_cw, ULONG *restrict x, ULONG *restrict y) +ami_cw_scroller_top(struct ami_corewindow *ami_cw, + ULONG *restrict x, + ULONG *restrict y) { ULONG xs = 0; ULONG ys = 0; if(ami_cw->scroll_x_visible == true) { - GetAttr(SCROLLER_Top, ami_cw->objects[GID_CW_HSCROLL], (ULONG *)&xs); + GetAttr(SCROLLER_Top, ami_cw->objects[GID_CW_HSCROLL], &xs); } if(ami_cw->scroll_y_visible == true) { - GetAttr(SCROLLER_Top, ami_cw->objects[GID_CW_VSCROLL], (ULONG *)&ys); + GetAttr(SCROLLER_Top, ami_cw->objects[GID_CW_VSCROLL], &ys); } *x = xs; @@ -243,15 +245,15 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r) ami_cw_scroller_top(ami_cw, &pos_x, &pos_y); - if(x - pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x); - if(y - pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y); + if(x - (LONG)pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x); + if(y - (LONG)pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y); - if(x < pos_x) { + if(x < (LONG)pos_x) { width -= pos_x - x; x = pos_x; } - if(y < pos_y) { + if(y < (LONG)pos_y) { height -= pos_y - y; y = pos_y; } @@ -880,9 +882,9 @@ ami_cw_scroll_visible(struct core_window *cw, const struct rect *r) win_y1 = win_y0 + win_h; if(r->y1 > win_y1) scrollsety = r->y1 - win_h; - if(r->y0 < win_y0) scrollsety = r->y0; + if(r->y0 < (LONG)win_y0) scrollsety = r->y0; if(r->x1 > win_x1) scrollsetx = r->x1 - win_w; - if(r->x0 < win_x0) scrollsetx = r->x0; + if(r->x0 < (LONG)win_x0) scrollsetx = r->x0; if(ami_cw->scroll_y_visible == true) { RefreshSetGadgetAttrs((APTR)ami_cw->objects[GID_CW_VSCROLL], ami_cw->win, NULL, diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c index 0b414c24e..6283a1fbd 100644 --- a/frontends/amiga/font_bullet.c +++ b/frontends/amiga/font_bullet.c @@ -169,7 +169,9 @@ static nserror amiga_nsfont_width(const plot_font_style_t *fstyle, { *width = ami_font_unicode_width(string, length, fstyle, 0, 0, false); - if(*width <= 0) *width == length; // fudge + if(*width <= 0) { + *width = length; /* fudge */ + } return NSERROR_OK; } diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 2c84d4d7a..eabf8bbcd 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -783,7 +783,6 @@ static void ami_amiupdate(void) static nsurl *gui_get_resource_url(const char *path) { char buf[1024]; - char path2[1024]; nsurl *url = NULL; if(ami_locate_resource(buf, path) == false) diff --git a/frontends/amiga/history_local.h b/frontends/amiga/history_local.h index 72ba7fa8b..0a265d821 100644 --- a/frontends/amiga/history_local.h +++ b/frontends/amiga/history_local.h @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -#ifndef AMIGA_HISTORY_GLOBAL_H -#define AMIGA_HISTORY_GLOBAL_H +#ifndef AMIGA_HISTORY_LOCAL_H +#define AMIGA_HISTORY_LOCAL_H struct gui_window; struct ami_history_local_window; -- cgit v1.2.3