Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/926c0985e3cf6b025c37a0f16e69461051214eb1
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/926c0985e3cf6b025c37a0f16e69461051214eb1
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/926c0985e3cf6b025c37a0f16e69461051214eb1

The branch, master has been updated
       via  926c0985e3cf6b025c37a0f16e69461051214eb1 (commit)
       via  e1d7928b3bdd97b24f1ff7d2b04ab7a2a65ef460 (commit)
       via  617c6207bcd45daa8d66c35dbc4f1273686646f3 (commit)
       via  0d114e10b23548ae8b5a6af6a5d47bf71651080e (commit)
       via  69adc31d07f3b5b9cdfa1482efc00d18f4c21583 (commit)
       via  bfce4632b88c6386fa527509b91ad97ebcc6b1a4 (commit)
       via  99012dcdd43b916902e4aab839694e311a98f22b (commit)
      from  c90fb03e58251b8798f1dfd0caaaf6ef6d4c9ff9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=926c0985e3cf6b025c37a0f16e69461051214eb1
commit 926c0985e3cf6b025c37a0f16e69461051214eb1
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    RISC OS: fix type in awrender_init definition.

diff --git a/frontends/riscos/content-handlers/artworks.c 
b/frontends/riscos/content-handlers/artworks.c
index 0227603..c107ec6 100644
--- a/frontends/riscos/content-handlers/artworks.c
+++ b/frontends/riscos/content-handlers/artworks.c
@@ -93,7 +93,7 @@ struct awinfo_block {
 /* Assembler routines for interfacing with the ArtworksRenderer module */
 
 extern os_error *awrender_init(const char **doc,
-               unsigned long *doc_size,
+               size_t *doc_size,
                void *routine,
                void *workspace);
 


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=e1d7928b3bdd97b24f1ff7d2b04ab7a2a65ef460
commit e1d7928b3bdd97b24f1ff7d2b04ab7a2a65ef460
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    RISC OS: fix snprintf usage
    
    When computing throbber sprite names, ensure the current frame is
    in range before using it.
    
    Similarly ensure the buffer size for the temporary URL bar sprite
    name is sized such that snprintf has space for the trailing NUL
    when formatting it to the output buffer.

diff --git a/frontends/riscos/gui/throbber.c b/frontends/riscos/gui/throbber.c
index f3b79a6..e3e4106 100644
--- a/frontends/riscos/gui/throbber.c
+++ b/frontends/riscos/gui/throbber.c
@@ -32,6 +32,7 @@
 #include "oslib/wimp.h"
 
 #include "utils/log.h"
+#include "utils/utils.h"
 #include "riscos/gui.h"
 
 #include "riscos/gui/throbber.h"
@@ -385,7 +386,8 @@ bool ro_gui_throbber_animate(struct throbber *throbber)
                throbber->current_frame = 1;
 
        snprintf(sprite_name, THROBBER_SPRITE_NAME_LENGTH,
-                       "throbber%i", throbber->current_frame);
+                       "throbber%i",
+                       min(max(throbber->current_frame, 0), 999));
        ro_gui_set_icon_string(throbber->window, throbber->icon,
                        sprite_name, true);
 
diff --git a/frontends/riscos/gui/url_bar.c b/frontends/riscos/gui/url_bar.c
index ec21e93..8802db7 100644
--- a/frontends/riscos/gui/url_bar.c
+++ b/frontends/riscos/gui/url_bar.c
@@ -1506,7 +1506,7 @@ ro_gui_url_bar_set_content_favicon(struct url_bar 
*url_bar,
                                   struct gui_window *g)
 {
        int type = 0;
-       char sprite[URLBAR_FAVICON_NAME_LENGTH];
+       char sprite[URLBAR_FAVICON_NAME_LENGTH-1];
        struct hlcache_handle *h;
 
        if (url_bar == NULL ||


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=617c6207bcd45daa8d66c35dbc4f1273686646f3
commit 617c6207bcd45daa8d66c35dbc4f1273686646f3
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    RISC OS: fix up use of strncpy
    
    Ensure that strings copied using strncpy are NUL terminated.
    
    Additionally, replace use of strncpy entirely where we are writing
    into non-indirected OS icon blocks (where an unterminated 12
    character long string is perfectly valid).

diff --git a/frontends/riscos/download.c b/frontends/riscos/download.c
index bdc7054..216f575 100644
--- a/frontends/riscos/download.c
+++ b/frontends/riscos/download.c
@@ -313,8 +313,8 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
        /** @todo change this to take a reference to the nsurl and use
         * that value directly rather than using a fixed buffer.
         */
-       strncpy(dw->url, nsurl_access(url), sizeof dw->url);
-       dw->url[sizeof dw->url - 1] = 0;
+       strncpy(dw->url, nsurl_access(url), sizeof(dw->url) - 1);
+       dw->url[sizeof(dw->url) - 1] = 0;
 
        dw->status[0] = 0;
        gettimeofday(&dw->start_time, 0);
@@ -414,7 +414,8 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
                return 0;
        }
        else {
-               strncpy(dw->path, local_path, sizeof dw->path);
+               strncpy(dw->path, local_path, sizeof(dw->path) - 1);
+               dw->path[sizeof(dw->path)-1] = 0;
                free(local_path);
        }
 
@@ -484,7 +485,8 @@ static void gui_download_window_error(struct 
gui_download_window *dw,
        riscos_schedule(-1, ro_gui_download_update_status_wrapper, dw);
 
        /* place error message in status icon in red */
-       strncpy(dw->status, error_msg, sizeof dw->status);
+       strncpy(dw->status, error_msg, sizeof(dw->status) - 1);
+       dw->status[sizeof(dw->status)-1] = 0;
        error = xwimp_set_icon_state(dw->window,
                        ICON_DOWNLOAD_STATUS,
                        wimp_COLOUR_RED << wimp_ICON_FG_COLOUR_SHIFT,
@@ -872,11 +874,11 @@ bool ro_gui_download_click(wimp_pointer *pointer)
                ro_gui_drag_icon(x, y, sprite);
 
        } else if (pointer->i == ICON_DOWNLOAD_DESTINATION) {
-               char command[256] = "Filer_OpenDir ";
+               char command[sizeof(dw->path) + 14 + 1] = "Filer_OpenDir ";
                char *dot;
 
-               strncpy(command + 14, dw->path, 242);
-               command[255] = 0;
+               strncpy(command + 14, dw->path, sizeof(command) - 14 - 1);
+               command[sizeof(command) - 1] = 0;
                dot = strrchr(command, '.');
                if (dot) {
                        os_error *error;
@@ -1384,7 +1386,8 @@ bool ro_gui_download_save(struct gui_download_window *dw,
        }
 
        dw->saved = true;
-       strncpy(dw->path, file_name, sizeof dw->path);
+       strncpy(dw->path, file_name, sizeof(dw->path) - 1);
+       dw->path[sizeof(dw->path)-1] = 0;
 
        if (!dw->send_dataload || dw->save_message.data.data_xfer.est_size != 
-1)
                ro_gui_download_remember_dir(file_name);
diff --git a/frontends/riscos/gui/button_bar.c 
b/frontends/riscos/gui/button_bar.c
index 34ae39a..50e1de3 100644
--- a/frontends/riscos/gui/button_bar.c
+++ b/frontends/riscos/gui/button_bar.c
@@ -189,7 +189,8 @@ struct button_bar *ro_gui_button_bar_create(struct 
theme_descriptor *theme,
                icon->bar_next = NULL;
 
                strncpy(icon->sprite, buttons[def].icon,
-                               BUTTONBAR_SPRITE_NAME_LENGTH);
+                               BUTTONBAR_SPRITE_NAME_LENGTH - 1);
+               icon->sprite[BUTTONBAR_SPRITE_NAME_LENGTH-1] = 0;
                snprintf(icon->validation, BUTTONBAR_VALIDATION_LENGTH,
                                "R5;S%s,p%s", icon->sprite, icon->sprite);
 
diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c
index 325bccc..e6b43f1 100644
--- a/frontends/riscos/save.c
+++ b/frontends/riscos/save.c
@@ -40,8 +40,10 @@
 #include "utils/config.h"
 #include "utils/log.h"
 #include "utils/messages.h"
-#include "utils/utf8.h"
+#include "utils/nsoption.h"
 #include "utils/nsurl.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
 #include "netsurf/browser_window.h"
 #include "netsurf/window.h"
 #include "netsurf/bitmap.h"
@@ -60,7 +62,6 @@
 #include "riscos/menus.h"
 #include "riscos/message.h"
 #include "riscos/mouse.h"
-#include "utils/nsoption.h"
 #include "riscos/query.h"
 #include "riscos/save.h"
 #include "riscos/save_draw.h"
@@ -257,7 +258,8 @@ ro_gui_save_create_thumbnail(struct hlcache_handle *h, 
const char *name)
        }
 
        sprite_header = (osspriteop_header *)(area + 1);
-       strncpy(sprite_header->name, name, 12);
+       memset(sprite_header->name, 0, 12);
+       memcpy(sprite_header->name, name, min(strlen(name), 12));
 
 
        /* we can't resize the saveas sprite area because it may move
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 2c442ab..2b51c2f 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -3594,7 +3594,8 @@ static void gui_window_set_title(struct gui_window *g, 
const char *title)
                                        title, scale_disp);
                }
        } else {
-               strncpy(g->title, title, sizeof(g->title));
+               strncpy(g->title, title, sizeof(g->title) - 1);
+               g->title[sizeof(g->title)-1] = 0;
        }
 
        ro_gui_set_window_title(g->window, g->title);


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=0d114e10b23548ae8b5a6af6a5d47bf71651080e
commit 0d114e10b23548ae8b5a6af6a5d47bf71651080e
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    RISC OS: GCC 10 approved fall-through markers

diff --git a/frontends/riscos/configure/con_image.c 
b/frontends/riscos/configure/con_image.c
index 23c663a..86e6b8f 100644
--- a/frontends/riscos/configure/con_image.c
+++ b/frontends/riscos/configure/con_image.c
@@ -209,6 +209,7 @@ bool ro_gui_options_image_click(wimp_pointer *pointer)
                                                data.indirected_text.text, 
true);
                        ro_gui_set_icon_selected_state(pointer->w,
                                        IMAGE_DISABLE_ANIMATION, false);
+                       /* fall through */
                case IMAGE_DISABLE_ANIMATION:
                        ro_gui_options_update_shading(pointer->w);
                        break;
diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c
index 85fefea..325bccc 100644
--- a/frontends/riscos/save.c
+++ b/frontends/riscos/save.c
@@ -1018,7 +1018,7 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, 
bool force_overwrite)
                        }
                        else
                                gui_save_current_type = GUI_SAVE_OBJECT_ORIG; 
/** \todo do this earlier? */
-                       /* no break */
+                       /* fall through */
                case GUI_SAVE_SOURCE:
                case GUI_SAVE_OBJECT_ORIG:
                        source_data = content_get_source_data(h, &source_size);


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=69adc31d07f3b5b9cdfa1482efc00d18f4c21583
commit 69adc31d07f3b5b9cdfa1482efc00d18f4c21583
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    inttypes: custom format for UnixLib ssize_t
    
    UnixLib defines ssize_t to be a long int, which forces the
    corresponding format string to need to be %ld to avoid compiler
    warnings. Making this change uncovered a number of places where
    we were using the wrong format specifier entirely (namely
    PRIssizet where we meant PRIsizet). Fix these, too.

diff --git a/content/handlers/image/image_cache.c 
b/content/handlers/image/image_cache.c
index bc0b914..6ce6b52 100644
--- a/content/handlers/image/image_cache.c
+++ b/content/handlers/image/image_cache.c
@@ -632,15 +632,15 @@ case chr :                                        \
                                slen++;
                                break;
 
-                       FMTCHR('a', PRIssizet, params.limit);
-                       FMTCHR('b', PRIssizet, params.hysteresis);
-                       FMTCHR('c', PRIssizet, total_bitmap_size);
+                       FMTCHR('a', PRIsizet, params.limit);
+                       FMTCHR('b', PRIsizet, params.hysteresis);
+                       FMTCHR('c', PRIsizet, total_bitmap_size);
                        FMTCHR('d', "d", bitmap_count);
                        FMTCHR('e', "u", current_age / 1000);
-                       FMTCHR('f', PRIssizet, max_bitmap_size);
+                       FMTCHR('f', PRIsizet, max_bitmap_size);
                        FMTCHR('g', "d", max_bitmap_size_count);
                        FMTCHR('h', "d", max_bitmap_count);
-                       FMTCHR('i', PRIssizet, max_bitmap_count_size);
+                       FMTCHR('i', PRIsizet, max_bitmap_count_size);
 
 
                        case 'j':
@@ -770,7 +770,7 @@ image_cache_snentryf(char *string,
                                if (centry->bitmap != NULL) {
                                        slen += snprintf(string + slen,
                                                         size - slen,
-                                                        "%" PRIssizet,
+                                                        "%" PRIsizet,
                                                         centry->bitmap_size);
                                } else {
                                        slen += snprintf(string + slen,
diff --git a/content/llcache.c b/content/llcache.c
index 81e0838..7db59de 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2966,7 +2966,7 @@ static void llcache_persist(void *p)
                total_bandwidth = (total_written * 1000) / total_elapsed;
 
                NSLOG(llcache, DEBUG,
-                     "Wrote %"PRIssizet" bytes in %lums bw:%lu %s",
+                     "Wrote %"PRIsizet" bytes in %lums bw:%lu %s",
                      written, elapsed, (written * 1000) / elapsed,
                      nsurl_access(lst[idx]->url) );
 
@@ -3034,7 +3034,7 @@ static void llcache_persist(void *p)
        llcache->total_elapsed += total_elapsed;
 
        NSLOG(llcache, DEBUG,
-             "writeout size:%"PRIssizet" time:%lu bandwidth:%lubytes/s",
+             "writeout size:%"PRIsizet" time:%lu bandwidth:%lubytes/s",
              total_written, total_elapsed, total_bandwidth);
 
        NSLOG(llcache, DEBUG, "Rescheduling writeout in %dms", next);
@@ -3813,7 +3813,7 @@ void llcache_clean(bool purge)
                        llcache_size -= object->source_len;
 
                        NSLOG(llcache, DEBUG,
-                             "Freeing source data for %p len:%"PRIssizet,
+                             "Freeing source data for %p len:%"PRIsizet,
                              object, object->source_len);
                }
        }
@@ -3832,7 +3832,7 @@ void llcache_clean(bool purge)
                    (object->store_state == LLCACHE_STATE_DISC) &&
                    (object->source_data == NULL)) {
                        NSLOG(llcache, DEBUG,
-                            "discarding backed object len:%"PRIssizet" age:%ld 
(%p) %s",
+                            "discarding backed object len:%"PRIsizet" age:%ld 
(%p) %s",
                              object->source_len,
                              (long)(time(NULL) - object->last_used),
                              object,
@@ -3862,7 +3862,7 @@ void llcache_clean(bool purge)
                    (object->fetch.fetch == NULL) &&
                    (object->store_state == LLCACHE_STATE_RAM)) {
                        NSLOG(llcache, DEBUG,
-                             "discarding fresh object len:%"PRIssizet" age:%ld 
(%p) %s",
+                             "discarding fresh object len:%"PRIsizet" age:%ld 
(%p) %s",
                              object->source_len,
                              (long)(time(NULL) - object->last_used),
                              object,
diff --git a/include/netsurf/inttypes.h b/include/netsurf/inttypes.h
index 3a16d0e..e222908 100644
--- a/include/netsurf/inttypes.h
+++ b/include/netsurf/inttypes.h
@@ -52,8 +52,13 @@
 /** c99 standard printf formatting for size_t type */
 #define PRIsizet "zu"
 
+#if defined(__riscos__)
+/** riscos/unixlib defines ssize_t as a long int */
+#define PRIssizet "ld"
+#else
 /** c99 standard printf formatting for ssize_t type */
 #define PRIssizet "zd"
+#endif
 
 #endif
 


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=bfce4632b88c6386fa527509b91ad97ebcc6b1a4
commit bfce4632b88c6386fa527509b91ad97ebcc6b1a4
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    env.sh: update for arm-riscos-gnueabihf

diff --git a/docs/env.sh b/docs/env.sh
index 6908220..80292a4 100644
--- a/docs/env.sh
+++ b/docs/env.sh
@@ -284,7 +284,7 @@ case "${HOST}" in
         # libraries required for the Darwin target abi
         NS_FRONTEND_LIBS="libsvgtiny libnsfb"
         ;;
-    arm-unknown-riscos)
+    arm-unknown-riscos|arm-riscos-gnueabihf)
         # tools required to build the browser for RISC OS
         NS_TOOLS="nsgenbind"
         # libraries required for the risc os target abi


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=99012dcdd43b916902e4aab839694e311a98f22b
commit 99012dcdd43b916902e4aab839694e311a98f22b
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    Buildsystem: update for new RISC OS toolchain
    
    The new toolchain has a different machine triplet, so update the
    things that care about it to work either way.
    
    Remove the expectation that ro-pkg-config exists (it's trivial
    and the core buildsystem never used it, so let's have some
    consistency).
    
    Determine the location of the zip binary in Makefile.tools, just
    like for all the other tooling and stop assuming where it's
    installed in the netsurf.zip target.

diff --git a/Makefile b/Makefile
index ac38b50..4fe124d 100644
--- a/Makefile
+++ b/Makefile
@@ -329,7 +329,7 @@ IFLAGS = $(addprefix -I,$(INCLUDE_DIRS))
 
 $(EXETARGET): $(OBJECTS) $(RESOURCES) $(MESSAGES) tools/linktrace-to-depfile.pl
        $(VQ)echo "    LINK: $(EXETARGET)"
-ifneq ($(TARGET)$(SUBTARGET),riscos-elf)
+ifeq ($(TARGET)$(SUBTARGET),riscos-aof)
        $(Q)$(CC) -o $(EXETARGET) $(OBJECTS) $(LDFLAGS) > $(DEPROOT)/link-raw.d
 else
        $(Q)$(CXX) -o $(EXETARGET:,ff8=,e1f) $(OBJECTS) $(LDFLAGS) > 
$(DEPROOT)/link-raw.d
diff --git a/frontends/riscos/Makefile b/frontends/riscos/Makefile
index af6585c..79e6fc4 100644
--- a/frontends/riscos/Makefile
+++ b/frontends/riscos/Makefile
@@ -33,7 +33,7 @@ ifeq ($(HOST),riscos)
   LDFLAGS += -LOSLib: -lOSLib32
 else
   LDFLAGS += -lOSLib32
-  ifeq ($(SUBTARGET),-elf)
+  ifeq ($(findstring -elf,$(SUBTARGET)),-elf)
     # Go for static builds & AIF binary at the moment:
     CFLAGS += -static
     LDFLAGS += -static
@@ -184,5 +184,5 @@ netsurf.zip: $(EXETARGET)
        $(Q) rsync --archive --verbose 
$(FRONTEND_SOURCE_DIR)/distribution/3rdParty $($@_TMPDIR)
        $(Q) cp $(FRONTEND_SOURCE_DIR)/distribution/ReadMe $($@_TMPDIR)
        $(Q) cp $(FRONTEND_SOURCE_DIR)/distribution/LeesMij $($@_TMPDIR)
-       $(Q) cd $($@_TMPDIR) && /opt/netsurf/arm-unknown-riscos/env/bin/zip 
-9vr\, $(CURDIR)/$@ *
+       $(Q) cd $($@_TMPDIR) && $(ZIP) -9vr\, $(CURDIR)/$@ *
        $(Q) $(RM) -rf $($@_TMPDIR)
diff --git a/frontends/riscos/Makefile.tools b/frontends/riscos/Makefile.tools
index 9ea5c29..19a2e77 100644
--- a/frontends/riscos/Makefile.tools
+++ b/frontends/riscos/Makefile.tools
@@ -15,21 +15,42 @@ ifeq ($(HOST),riscos)
   CXX := g++
   EXEEXT :=
   PKG_CONFIG :=
+  ZIP := zip
 else
-  # Cross-build for RO (either using GCCSDK 3.4.6 - AOF,
-  # either using GCCSDK 4 - ELF)
+  # Cross-build for RO
+  # Three options are available:
+  #   a. GCCSDK 3.4.6 - AOF             (machine: arm-unknown-riscos)
+  #   b. GCCSDK 4     - ELF             (machine: arm-unknown-riscos)
+  #   c. GCCSDK 8+    - ELF, using EABI (machine: arm-riscos-gnueabihf)
+  # GCCSDK 3.4.6 and 4 are distinguished by GCCSDK 3.4.6 binary names
+  # not having the machine prefix (e.g. gcc), whereas GCCSDK 4 binaries
+  # do (e.g. arm-unknown-riscos-gcc).
+
+  # Search for the toolchain install locations if we haven't been told
+  # The search order prefers GCCSDK 3.4.6/4 over 8+.
   ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
     ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/env),)
       GCCSDK_INSTALL_ENV := /opt/netsurf/arm-unknown-riscos/env
     else
-      GCCSDK_INSTALL_ENV := /home/riscos/env
+      ifneq ($(realpath /opt/netsurf/arm-riscos-gnueabihf/env),)
+        GCCSDK_INSTALL_ENV := /opt/netsurf/arm-riscos-gnueabihf/env
+      else
+       # No NetSurf-specific toolchain found: try the "normal" GCCSDK path
+        GCCSDK_INSTALL_ENV := /home/riscos/env
+      endif
     endif
   endif
-   ifeq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
+
+  ifeq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
     ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/cross/bin),)
       GCCSDK_INSTALL_CROSSBIN := /opt/netsurf/arm-unknown-riscos/cross/bin
     else
-      GCCSDK_INSTALL_CROSSBIN := /home/riscos/cross/bin
+      ifneq ($(realpath /opt/netsurf/arm-riscos-gnueabihf/cross/bin),)
+        GCCSDK_INSTALL_CROSSBIN := /opt/netsurf/arm-riscos-gnueabihf/cross/bin
+      else
+       # No NetSurf-specific toolchain found: try the "normal" GCCSDK path
+        GCCSDK_INSTALL_CROSSBIN := /home/riscos/cross/bin
+      endif
     endif
   endif
 
@@ -39,14 +60,27 @@ else
   SQUEEZE := $(GCCSDK_INSTALL_CROSSBIN)/squeeze
   RUNEXT := ,feb
   CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+
+  # Work out what kind of toolchain we're dealing with
   ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC)))
+    # GCCSDK 4
     SUBTARGET := -elf
     EXEEXT := ,e1f
     ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif
   else
-   SUBTARGET := -aof
-   EXEEXT := ,ff8
+   ifneq (,$(findstring arm-riscos-gnueabihf-gcc,$(CC)))
+     # GCCSDK 8+
+     SUBTARGET := -elfeabi
+     EXEEXT := ,e1f
+     ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif -e
+   else
+     # GCCSDK 3.4.6
+     SUBTARGET := -aof
+     EXEEXT := ,ff8
+   endif
   endif
+
   CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
-  PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
+  PKG_CONFIG = 
PKG_CONFIG_LIBDIR="$(PREFIX)/lib/pkgconfig:$(GCCSDK_INSTALL_ENV)/lib/pkgconfig:$(GCCSDK_INSTALL_ENV)/share/pkgconfig"
 pkg-config
+  ZIP := $(GCCSDK_INSTALL_CROSSBIN)/zip
 endif


-----------------------------------------------------------------------

Summary of changes:
 Makefile                                     |    2 +-
 content/handlers/image/image_cache.c         |   12 +++----
 content/llcache.c                            |   10 +++---
 docs/env.sh                                  |    2 +-
 frontends/riscos/Makefile                    |    4 +--
 frontends/riscos/Makefile.tools              |   50 +++++++++++++++++++++-----
 frontends/riscos/configure/con_image.c       |    1 +
 frontends/riscos/content-handlers/artworks.c |    2 +-
 frontends/riscos/download.c                  |   19 +++++-----
 frontends/riscos/gui/button_bar.c            |    3 +-
 frontends/riscos/gui/throbber.c              |    4 ++-
 frontends/riscos/gui/url_bar.c               |    2 +-
 frontends/riscos/save.c                      |   10 +++---
 frontends/riscos/window.c                    |    3 +-
 include/netsurf/inttypes.h                   |    5 +++
 15 files changed, 89 insertions(+), 40 deletions(-)

diff --git a/Makefile b/Makefile
index ac38b50..4fe124d 100644
--- a/Makefile
+++ b/Makefile
@@ -329,7 +329,7 @@ IFLAGS = $(addprefix -I,$(INCLUDE_DIRS))
 
 $(EXETARGET): $(OBJECTS) $(RESOURCES) $(MESSAGES) tools/linktrace-to-depfile.pl
        $(VQ)echo "    LINK: $(EXETARGET)"
-ifneq ($(TARGET)$(SUBTARGET),riscos-elf)
+ifeq ($(TARGET)$(SUBTARGET),riscos-aof)
        $(Q)$(CC) -o $(EXETARGET) $(OBJECTS) $(LDFLAGS) > $(DEPROOT)/link-raw.d
 else
        $(Q)$(CXX) -o $(EXETARGET:,ff8=,e1f) $(OBJECTS) $(LDFLAGS) > 
$(DEPROOT)/link-raw.d
diff --git a/content/handlers/image/image_cache.c 
b/content/handlers/image/image_cache.c
index bc0b914..6ce6b52 100644
--- a/content/handlers/image/image_cache.c
+++ b/content/handlers/image/image_cache.c
@@ -632,15 +632,15 @@ case chr :                                        \
                                slen++;
                                break;
 
-                       FMTCHR('a', PRIssizet, params.limit);
-                       FMTCHR('b', PRIssizet, params.hysteresis);
-                       FMTCHR('c', PRIssizet, total_bitmap_size);
+                       FMTCHR('a', PRIsizet, params.limit);
+                       FMTCHR('b', PRIsizet, params.hysteresis);
+                       FMTCHR('c', PRIsizet, total_bitmap_size);
                        FMTCHR('d', "d", bitmap_count);
                        FMTCHR('e', "u", current_age / 1000);
-                       FMTCHR('f', PRIssizet, max_bitmap_size);
+                       FMTCHR('f', PRIsizet, max_bitmap_size);
                        FMTCHR('g', "d", max_bitmap_size_count);
                        FMTCHR('h', "d", max_bitmap_count);
-                       FMTCHR('i', PRIssizet, max_bitmap_count_size);
+                       FMTCHR('i', PRIsizet, max_bitmap_count_size);
 
 
                        case 'j':
@@ -770,7 +770,7 @@ image_cache_snentryf(char *string,
                                if (centry->bitmap != NULL) {
                                        slen += snprintf(string + slen,
                                                         size - slen,
-                                                        "%" PRIssizet,
+                                                        "%" PRIsizet,
                                                         centry->bitmap_size);
                                } else {
                                        slen += snprintf(string + slen,
diff --git a/content/llcache.c b/content/llcache.c
index 81e0838..7db59de 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2966,7 +2966,7 @@ static void llcache_persist(void *p)
                total_bandwidth = (total_written * 1000) / total_elapsed;
 
                NSLOG(llcache, DEBUG,
-                     "Wrote %"PRIssizet" bytes in %lums bw:%lu %s",
+                     "Wrote %"PRIsizet" bytes in %lums bw:%lu %s",
                      written, elapsed, (written * 1000) / elapsed,
                      nsurl_access(lst[idx]->url) );
 
@@ -3034,7 +3034,7 @@ static void llcache_persist(void *p)
        llcache->total_elapsed += total_elapsed;
 
        NSLOG(llcache, DEBUG,
-             "writeout size:%"PRIssizet" time:%lu bandwidth:%lubytes/s",
+             "writeout size:%"PRIsizet" time:%lu bandwidth:%lubytes/s",
              total_written, total_elapsed, total_bandwidth);
 
        NSLOG(llcache, DEBUG, "Rescheduling writeout in %dms", next);
@@ -3813,7 +3813,7 @@ void llcache_clean(bool purge)
                        llcache_size -= object->source_len;
 
                        NSLOG(llcache, DEBUG,
-                             "Freeing source data for %p len:%"PRIssizet,
+                             "Freeing source data for %p len:%"PRIsizet,
                              object, object->source_len);
                }
        }
@@ -3832,7 +3832,7 @@ void llcache_clean(bool purge)
                    (object->store_state == LLCACHE_STATE_DISC) &&
                    (object->source_data == NULL)) {
                        NSLOG(llcache, DEBUG,
-                            "discarding backed object len:%"PRIssizet" age:%ld 
(%p) %s",
+                            "discarding backed object len:%"PRIsizet" age:%ld 
(%p) %s",
                              object->source_len,
                              (long)(time(NULL) - object->last_used),
                              object,
@@ -3862,7 +3862,7 @@ void llcache_clean(bool purge)
                    (object->fetch.fetch == NULL) &&
                    (object->store_state == LLCACHE_STATE_RAM)) {
                        NSLOG(llcache, DEBUG,
-                             "discarding fresh object len:%"PRIssizet" age:%ld 
(%p) %s",
+                             "discarding fresh object len:%"PRIsizet" age:%ld 
(%p) %s",
                              object->source_len,
                              (long)(time(NULL) - object->last_used),
                              object,
diff --git a/docs/env.sh b/docs/env.sh
index 6908220..80292a4 100644
--- a/docs/env.sh
+++ b/docs/env.sh
@@ -284,7 +284,7 @@ case "${HOST}" in
         # libraries required for the Darwin target abi
         NS_FRONTEND_LIBS="libsvgtiny libnsfb"
         ;;
-    arm-unknown-riscos)
+    arm-unknown-riscos|arm-riscos-gnueabihf)
         # tools required to build the browser for RISC OS
         NS_TOOLS="nsgenbind"
         # libraries required for the risc os target abi
diff --git a/frontends/riscos/Makefile b/frontends/riscos/Makefile
index af6585c..79e6fc4 100644
--- a/frontends/riscos/Makefile
+++ b/frontends/riscos/Makefile
@@ -33,7 +33,7 @@ ifeq ($(HOST),riscos)
   LDFLAGS += -LOSLib: -lOSLib32
 else
   LDFLAGS += -lOSLib32
-  ifeq ($(SUBTARGET),-elf)
+  ifeq ($(findstring -elf,$(SUBTARGET)),-elf)
     # Go for static builds & AIF binary at the moment:
     CFLAGS += -static
     LDFLAGS += -static
@@ -184,5 +184,5 @@ netsurf.zip: $(EXETARGET)
        $(Q) rsync --archive --verbose 
$(FRONTEND_SOURCE_DIR)/distribution/3rdParty $($@_TMPDIR)
        $(Q) cp $(FRONTEND_SOURCE_DIR)/distribution/ReadMe $($@_TMPDIR)
        $(Q) cp $(FRONTEND_SOURCE_DIR)/distribution/LeesMij $($@_TMPDIR)
-       $(Q) cd $($@_TMPDIR) && /opt/netsurf/arm-unknown-riscos/env/bin/zip 
-9vr\, $(CURDIR)/$@ *
+       $(Q) cd $($@_TMPDIR) && $(ZIP) -9vr\, $(CURDIR)/$@ *
        $(Q) $(RM) -rf $($@_TMPDIR)
diff --git a/frontends/riscos/Makefile.tools b/frontends/riscos/Makefile.tools
index 9ea5c29..19a2e77 100644
--- a/frontends/riscos/Makefile.tools
+++ b/frontends/riscos/Makefile.tools
@@ -15,21 +15,42 @@ ifeq ($(HOST),riscos)
   CXX := g++
   EXEEXT :=
   PKG_CONFIG :=
+  ZIP := zip
 else
-  # Cross-build for RO (either using GCCSDK 3.4.6 - AOF,
-  # either using GCCSDK 4 - ELF)
+  # Cross-build for RO
+  # Three options are available:
+  #   a. GCCSDK 3.4.6 - AOF             (machine: arm-unknown-riscos)
+  #   b. GCCSDK 4     - ELF             (machine: arm-unknown-riscos)
+  #   c. GCCSDK 8+    - ELF, using EABI (machine: arm-riscos-gnueabihf)
+  # GCCSDK 3.4.6 and 4 are distinguished by GCCSDK 3.4.6 binary names
+  # not having the machine prefix (e.g. gcc), whereas GCCSDK 4 binaries
+  # do (e.g. arm-unknown-riscos-gcc).
+
+  # Search for the toolchain install locations if we haven't been told
+  # The search order prefers GCCSDK 3.4.6/4 over 8+.
   ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
     ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/env),)
       GCCSDK_INSTALL_ENV := /opt/netsurf/arm-unknown-riscos/env
     else
-      GCCSDK_INSTALL_ENV := /home/riscos/env
+      ifneq ($(realpath /opt/netsurf/arm-riscos-gnueabihf/env),)
+        GCCSDK_INSTALL_ENV := /opt/netsurf/arm-riscos-gnueabihf/env
+      else
+       # No NetSurf-specific toolchain found: try the "normal" GCCSDK path
+        GCCSDK_INSTALL_ENV := /home/riscos/env
+      endif
     endif
   endif
-   ifeq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
+
+  ifeq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
     ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/cross/bin),)
       GCCSDK_INSTALL_CROSSBIN := /opt/netsurf/arm-unknown-riscos/cross/bin
     else
-      GCCSDK_INSTALL_CROSSBIN := /home/riscos/cross/bin
+      ifneq ($(realpath /opt/netsurf/arm-riscos-gnueabihf/cross/bin),)
+        GCCSDK_INSTALL_CROSSBIN := /opt/netsurf/arm-riscos-gnueabihf/cross/bin
+      else
+       # No NetSurf-specific toolchain found: try the "normal" GCCSDK path
+        GCCSDK_INSTALL_CROSSBIN := /home/riscos/cross/bin
+      endif
     endif
   endif
 
@@ -39,14 +60,27 @@ else
   SQUEEZE := $(GCCSDK_INSTALL_CROSSBIN)/squeeze
   RUNEXT := ,feb
   CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+
+  # Work out what kind of toolchain we're dealing with
   ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC)))
+    # GCCSDK 4
     SUBTARGET := -elf
     EXEEXT := ,e1f
     ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif
   else
-   SUBTARGET := -aof
-   EXEEXT := ,ff8
+   ifneq (,$(findstring arm-riscos-gnueabihf-gcc,$(CC)))
+     # GCCSDK 8+
+     SUBTARGET := -elfeabi
+     EXEEXT := ,e1f
+     ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif -e
+   else
+     # GCCSDK 3.4.6
+     SUBTARGET := -aof
+     EXEEXT := ,ff8
+   endif
   endif
+
   CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
-  PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
+  PKG_CONFIG = 
PKG_CONFIG_LIBDIR="$(PREFIX)/lib/pkgconfig:$(GCCSDK_INSTALL_ENV)/lib/pkgconfig:$(GCCSDK_INSTALL_ENV)/share/pkgconfig"
 pkg-config
+  ZIP := $(GCCSDK_INSTALL_CROSSBIN)/zip
 endif
diff --git a/frontends/riscos/configure/con_image.c 
b/frontends/riscos/configure/con_image.c
index 23c663a..86e6b8f 100644
--- a/frontends/riscos/configure/con_image.c
+++ b/frontends/riscos/configure/con_image.c
@@ -209,6 +209,7 @@ bool ro_gui_options_image_click(wimp_pointer *pointer)
                                                data.indirected_text.text, 
true);
                        ro_gui_set_icon_selected_state(pointer->w,
                                        IMAGE_DISABLE_ANIMATION, false);
+                       /* fall through */
                case IMAGE_DISABLE_ANIMATION:
                        ro_gui_options_update_shading(pointer->w);
                        break;
diff --git a/frontends/riscos/content-handlers/artworks.c 
b/frontends/riscos/content-handlers/artworks.c
index 0227603..c107ec6 100644
--- a/frontends/riscos/content-handlers/artworks.c
+++ b/frontends/riscos/content-handlers/artworks.c
@@ -93,7 +93,7 @@ struct awinfo_block {
 /* Assembler routines for interfacing with the ArtworksRenderer module */
 
 extern os_error *awrender_init(const char **doc,
-               unsigned long *doc_size,
+               size_t *doc_size,
                void *routine,
                void *workspace);
 
diff --git a/frontends/riscos/download.c b/frontends/riscos/download.c
index bdc7054..216f575 100644
--- a/frontends/riscos/download.c
+++ b/frontends/riscos/download.c
@@ -313,8 +313,8 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
        /** @todo change this to take a reference to the nsurl and use
         * that value directly rather than using a fixed buffer.
         */
-       strncpy(dw->url, nsurl_access(url), sizeof dw->url);
-       dw->url[sizeof dw->url - 1] = 0;
+       strncpy(dw->url, nsurl_access(url), sizeof(dw->url) - 1);
+       dw->url[sizeof(dw->url) - 1] = 0;
 
        dw->status[0] = 0;
        gettimeofday(&dw->start_time, 0);
@@ -414,7 +414,8 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
                return 0;
        }
        else {
-               strncpy(dw->path, local_path, sizeof dw->path);
+               strncpy(dw->path, local_path, sizeof(dw->path) - 1);
+               dw->path[sizeof(dw->path)-1] = 0;
                free(local_path);
        }
 
@@ -484,7 +485,8 @@ static void gui_download_window_error(struct 
gui_download_window *dw,
        riscos_schedule(-1, ro_gui_download_update_status_wrapper, dw);
 
        /* place error message in status icon in red */
-       strncpy(dw->status, error_msg, sizeof dw->status);
+       strncpy(dw->status, error_msg, sizeof(dw->status) - 1);
+       dw->status[sizeof(dw->status)-1] = 0;
        error = xwimp_set_icon_state(dw->window,
                        ICON_DOWNLOAD_STATUS,
                        wimp_COLOUR_RED << wimp_ICON_FG_COLOUR_SHIFT,
@@ -872,11 +874,11 @@ bool ro_gui_download_click(wimp_pointer *pointer)
                ro_gui_drag_icon(x, y, sprite);
 
        } else if (pointer->i == ICON_DOWNLOAD_DESTINATION) {
-               char command[256] = "Filer_OpenDir ";
+               char command[sizeof(dw->path) + 14 + 1] = "Filer_OpenDir ";
                char *dot;
 
-               strncpy(command + 14, dw->path, 242);
-               command[255] = 0;
+               strncpy(command + 14, dw->path, sizeof(command) - 14 - 1);
+               command[sizeof(command) - 1] = 0;
                dot = strrchr(command, '.');
                if (dot) {
                        os_error *error;
@@ -1384,7 +1386,8 @@ bool ro_gui_download_save(struct gui_download_window *dw,
        }
 
        dw->saved = true;
-       strncpy(dw->path, file_name, sizeof dw->path);
+       strncpy(dw->path, file_name, sizeof(dw->path) - 1);
+       dw->path[sizeof(dw->path)-1] = 0;
 
        if (!dw->send_dataload || dw->save_message.data.data_xfer.est_size != 
-1)
                ro_gui_download_remember_dir(file_name);
diff --git a/frontends/riscos/gui/button_bar.c 
b/frontends/riscos/gui/button_bar.c
index 34ae39a..50e1de3 100644
--- a/frontends/riscos/gui/button_bar.c
+++ b/frontends/riscos/gui/button_bar.c
@@ -189,7 +189,8 @@ struct button_bar *ro_gui_button_bar_create(struct 
theme_descriptor *theme,
                icon->bar_next = NULL;
 
                strncpy(icon->sprite, buttons[def].icon,
-                               BUTTONBAR_SPRITE_NAME_LENGTH);
+                               BUTTONBAR_SPRITE_NAME_LENGTH - 1);
+               icon->sprite[BUTTONBAR_SPRITE_NAME_LENGTH-1] = 0;
                snprintf(icon->validation, BUTTONBAR_VALIDATION_LENGTH,
                                "R5;S%s,p%s", icon->sprite, icon->sprite);
 
diff --git a/frontends/riscos/gui/throbber.c b/frontends/riscos/gui/throbber.c
index f3b79a6..e3e4106 100644
--- a/frontends/riscos/gui/throbber.c
+++ b/frontends/riscos/gui/throbber.c
@@ -32,6 +32,7 @@
 #include "oslib/wimp.h"
 
 #include "utils/log.h"
+#include "utils/utils.h"
 #include "riscos/gui.h"
 
 #include "riscos/gui/throbber.h"
@@ -385,7 +386,8 @@ bool ro_gui_throbber_animate(struct throbber *throbber)
                throbber->current_frame = 1;
 
        snprintf(sprite_name, THROBBER_SPRITE_NAME_LENGTH,
-                       "throbber%i", throbber->current_frame);
+                       "throbber%i",
+                       min(max(throbber->current_frame, 0), 999));
        ro_gui_set_icon_string(throbber->window, throbber->icon,
                        sprite_name, true);
 
diff --git a/frontends/riscos/gui/url_bar.c b/frontends/riscos/gui/url_bar.c
index ec21e93..8802db7 100644
--- a/frontends/riscos/gui/url_bar.c
+++ b/frontends/riscos/gui/url_bar.c
@@ -1506,7 +1506,7 @@ ro_gui_url_bar_set_content_favicon(struct url_bar 
*url_bar,
                                   struct gui_window *g)
 {
        int type = 0;
-       char sprite[URLBAR_FAVICON_NAME_LENGTH];
+       char sprite[URLBAR_FAVICON_NAME_LENGTH-1];
        struct hlcache_handle *h;
 
        if (url_bar == NULL ||
diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c
index 85fefea..e6b43f1 100644
--- a/frontends/riscos/save.c
+++ b/frontends/riscos/save.c
@@ -40,8 +40,10 @@
 #include "utils/config.h"
 #include "utils/log.h"
 #include "utils/messages.h"
-#include "utils/utf8.h"
+#include "utils/nsoption.h"
 #include "utils/nsurl.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
 #include "netsurf/browser_window.h"
 #include "netsurf/window.h"
 #include "netsurf/bitmap.h"
@@ -60,7 +62,6 @@
 #include "riscos/menus.h"
 #include "riscos/message.h"
 #include "riscos/mouse.h"
-#include "utils/nsoption.h"
 #include "riscos/query.h"
 #include "riscos/save.h"
 #include "riscos/save_draw.h"
@@ -257,7 +258,8 @@ ro_gui_save_create_thumbnail(struct hlcache_handle *h, 
const char *name)
        }
 
        sprite_header = (osspriteop_header *)(area + 1);
-       strncpy(sprite_header->name, name, 12);
+       memset(sprite_header->name, 0, 12);
+       memcpy(sprite_header->name, name, min(strlen(name), 12));
 
 
        /* we can't resize the saveas sprite area because it may move
@@ -1018,7 +1020,7 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, 
bool force_overwrite)
                        }
                        else
                                gui_save_current_type = GUI_SAVE_OBJECT_ORIG; 
/** \todo do this earlier? */
-                       /* no break */
+                       /* fall through */
                case GUI_SAVE_SOURCE:
                case GUI_SAVE_OBJECT_ORIG:
                        source_data = content_get_source_data(h, &source_size);
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 2c442ab..2b51c2f 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -3594,7 +3594,8 @@ static void gui_window_set_title(struct gui_window *g, 
const char *title)
                                        title, scale_disp);
                }
        } else {
-               strncpy(g->title, title, sizeof(g->title));
+               strncpy(g->title, title, sizeof(g->title) - 1);
+               g->title[sizeof(g->title)-1] = 0;
        }
 
        ro_gui_set_window_title(g->window, g->title);
diff --git a/include/netsurf/inttypes.h b/include/netsurf/inttypes.h
index 3a16d0e..e222908 100644
--- a/include/netsurf/inttypes.h
+++ b/include/netsurf/inttypes.h
@@ -52,8 +52,13 @@
 /** c99 standard printf formatting for size_t type */
 #define PRIsizet "zu"
 
+#if defined(__riscos__)
+/** riscos/unixlib defines ssize_t as a long int */
+#define PRIssizet "ld"
+#else
 /** c99 standard printf formatting for ssize_t type */
 #define PRIssizet "zd"
+#endif
 
 #endif
 


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to