From 08c275ed2c843441aad23d38646083de7a130753 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 21 Jan 2018 14:27:10 +0000 Subject: RISC OS: translate resource paths. Fixes #2266. --- frontends/riscos/gui.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'frontends') diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c index cfc513f72..be1bc8d9a 100644 --- a/frontends/riscos/gui.c +++ b/frontends/riscos/gui.c @@ -195,6 +195,7 @@ static struct static nsurl *gui_get_resource_url(const char *path) { static const char base_url[] = "file:///NetSurf:/Resources/"; + const char *lang; size_t path_len, length; char *raw; nsurl *url = NULL; @@ -220,8 +221,12 @@ static nsurl *gui_get_resource_url(const char *path) path_len = strlen(path); + lang = ro_gui_default_language(); + /* Find max URL length */ - length = SLEN(base_url) + SLEN("xx/") + path_len + 1; + length = SLEN(base_url) + + strlen(lang) + 1 + /* + / */ + path_len + 1; /* + NUL */ raw = malloc(length); if (raw != NULL) { @@ -230,13 +235,11 @@ static nsurl *gui_get_resource_url(const char *path) ptr += SLEN(base_url); /* Add language directory to URL, for translated files */ - /* TODO: handle non-en langauages - * handle non-html translated files */ + /* TODO: handle non-html translated files */ if (path_len > SLEN(".html") && strncmp(path + path_len - SLEN(".html"), ".html", SLEN(".html")) == 0) { - memcpy(ptr, "en/", SLEN("en/")); - ptr += SLEN("en/"); + ptr += sprintf(ptr, "%s/", lang); } /* Add filename to URL */ -- cgit v1.2.3 From 29e36cdf1a6f4404f804e5c2b46d38dad929416d Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 21 Jan 2018 14:22:23 +0000 Subject: Framebuffer: Tweak comment to avoid fallthrough warning. --- frontends/framebuffer/gui.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'frontends') diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c index e252f25f3..8bbaedc22 100644 --- a/frontends/framebuffer/gui.c +++ b/frontends/framebuffer/gui.c @@ -951,8 +951,7 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) browser_window_key_press(gw->bw, NS_KEY_REDO); break; } - /* Z or Y pressed but not undo or redo; - * Fall through to default handling */ + /* Z or Y pressed but not undo or redo; Fall through */ default: ucs4 = fbtk_keycode_to_ucs4(cbi->event->value.keycode, -- cgit v1.2.3 From 89baae16b47fad0dcb50402e9a2ba887b05242c0 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 21 Jan 2018 14:27:59 +0000 Subject: Framebuffer: Squash fallthrough warnings in internal font handling. --- frontends/framebuffer/font_internal.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'frontends') diff --git a/frontends/framebuffer/font_internal.c b/frontends/framebuffer/font_internal.c index 3b8a1c43f..ff3471d1d 100644 --- a/frontends/framebuffer/font_internal.c +++ b/frontends/framebuffer/font_internal.c @@ -270,6 +270,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale) break; } } + /* Fall through. */ case FB_BOLD: section = fb_bold_section_table[ucs4 / 256]; if (section != 0 || ucs4 / 256 == 0) { @@ -280,6 +281,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale) break; } } + /* Fall through. */ case FB_ITALIC: section = fb_italic_section_table[ucs4 / 256]; if (section != 0 || ucs4 / 256 == 0) { @@ -290,6 +292,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale) break; } } + /* Fall through. */ case FB_REGULAR: section = fb_regular_section_table[ucs4 / 256]; if (section != 0 || ucs4 / 256 == 0) { @@ -300,6 +303,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale) break; } } + /* Fall through. */ default: glyph_data = get_codepoint(ucs4, style & FB_ITALIC); break; -- cgit v1.2.3 From 470dce645bc9cfca1d438f62a8ffe7a6db80a278 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 1 Feb 2018 20:59:39 +0000 Subject: Avoid potential division by zero --- frontends/amiga/theme.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'frontends') diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c index 5e4be0710..63982c879 100644 --- a/frontends/amiga/theme.c +++ b/frontends/amiga/theme.c @@ -54,7 +54,8 @@ static struct BitMap *throbber = NULL; static struct bitmap *throbber_nsbm = NULL; -static int throbber_frames, throbber_update_interval; +static int throbber_frames = 1; +static int throbber_update_interval; static Object *mouseptrobj[AMI_LASTPOINTER+1]; static struct BitMap *mouseptrbm[AMI_LASTPOINTER+1]; @@ -176,6 +177,7 @@ void ami_theme_throbber_setup(void) ami_get_theme_filename(throbberfile,"theme_throbber",false); throbber_frames=atoi(messages_get("theme_throbber_frames")); + if(throbber_frames == 0) throbber_frames = 1; throbber_update_interval = atoi(messages_get("theme_throbber_delay")); if(throbber_update_interval == 0) throbber_update_interval = 250; -- cgit v1.2.3