From 688f60d9636941c4aeb5959bf15bcee743af0fe6 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 27 May 2014 00:08:04 +0100 Subject: [PATCH] fix errors with path_to_url conversion --- amiga/gui.c | 5 +++-- amiga/icon.c | 1 + amiga/misc.c | 1 + atari/misc.c | 4 ---- riscos/gui.c | 9 +++++---- windows/gui.c | 2 ++ windows/main.c | 2 ++ 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 2592352b7..b7edf5e1e 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -37,6 +37,7 @@ #include "utils/nsoption.h" #include "utils/utf8.h" #include "utils/utils.h" +#include "utils/nsurl.h" #include "utils/file.h" /* NetSurf Amiga platform includes */ @@ -912,9 +913,9 @@ static void gui_init2(int argc, char** argv) AddPart(fullpath,wbarg->wa_Name,1024); if(!temp_homepage_url) { - nsurl temp_url; + nsurl *temp_url; if (netsurf_path_to_nsurl(fullpath, &temp_url) == NSERROR_OK) { - temp_homepage_url = strcpy(nsurl_data(temp_url)); + temp_homepage_url = strdup(nsurl_data(temp_url)); nsurl_unref(temp_url); } } diff --git a/amiga/icon.c b/amiga/icon.c index 95fd685cd..d0e1c847d 100644 --- a/amiga/icon.c +++ b/amiga/icon.c @@ -47,6 +47,7 @@ #include "utils/messages.h" #include "utils/utils.h" #include "utils/url.h" +#include "utils/file.h" #define THUMBNAIL_WIDTH 100 /* Icon sizes for thumbnails, usually the same as */ #define THUMBNAIL_HEIGHT 86 /* WIDTH/HEIGHT in desktop/thumbnail.c */ diff --git a/amiga/misc.c b/amiga/misc.c index d2b243a24..ac9912f5b 100755 --- a/amiga/misc.c +++ b/amiga/misc.c @@ -34,6 +34,7 @@ #include "amiga/utf8.h" #include "desktop/cookie_manager.h" #include "utils/log.h" +#include "utils/corestrings.h" #include "utils/messages.h" #include "utils/url.h" #include "utils/file.h" diff --git a/atari/misc.c b/atari/misc.c index a84ce2bd3..849eec9ec 100755 --- a/atari/misc.c +++ b/atari/misc.c @@ -246,10 +246,6 @@ hlcache_handle *load_icon(const char *name, hlcache_handle_callback cb, nsurl_unref(icon_nsurl); - /* If we built the URL here, free it */ - if (url != NULL) - free(url); - if (err != NSERROR_OK) { return NULL; } diff --git a/riscos/gui.c b/riscos/gui.c index 51472a4bf..82a1a74a1 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -57,6 +57,7 @@ #include "utils/messages.h" #include "utils/url.h" #include "utils/utils.h" +#include "utils/corestrings.h" #include "content/content.h" #include "content/hlcache.h" #include "content/urldb.h" @@ -746,7 +747,7 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out) char *unix_path; /* unix path */ char *escurl; os_error *error; - nserror url_err; + nserror ret; int urllen; char *url; /* resulting url */ @@ -801,10 +802,10 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out) free(unix_path); /* We don't want '/' to be escaped. */ - url_err = url_escape(url, FILE_SCHEME_PREFIX_LEN, false, "/", &escurl); + ret = url_escape(url, FILE_SCHEME_PREFIX_LEN, false, "/", &escurl); free(url); - if (url_err != NSERROR_OK) { - return url_err; + if (ret != NSERROR_OK) { + return ret; } ret = nsurl_create(escurl, url_out); diff --git a/windows/gui.c b/windows/gui.c index fe0c52249..8cf36d020 100644 --- a/windows/gui.c +++ b/windows/gui.c @@ -44,6 +44,8 @@ #include "utils/messages.h" #include "utils/utils.h" #include "utils/file.h" +#include "utils/corestrings.h" +#include "utils/url.h" #include "windows/window.h" #include "windows/about.h" diff --git a/windows/main.c b/windows/main.c index 637aa217f..f9792c259 100644 --- a/windows/main.c +++ b/windows/main.c @@ -26,10 +26,12 @@ #include "desktop/gui.h" #include "utils/nsoption.h" #include "desktop/browser.h" +#include "desktop/netsurf.h" #include "utils/utils.h" #include "utils/log.h" #include "utils/messages.h" #include "utils/filepath.h" +#include "utils/file.h" #include "content/fetchers/resource.h" #include "windows/findfile.h"