summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-07-01 12:05:51 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-07-01 12:05:51 +0000
commita3e205bbd9cff0a189b3a5a03c676ace9c5ee8dd (patch)
tree20110482ce47d736f634c0dd6b97d16a469a31c6 /riscos
parent7e01924ecf99f79283f0eea7c385db8bab9d9a90 (diff)
downloadnetsurf-a3e205bbd9cff0a189b3a5a03c676ace9c5ee8dd.tar.gz
netsurf-a3e205bbd9cff0a189b3a5a03c676ace9c5ee8dd.tar.bz2
Constify ro_uri_launch()
If the URL is too long to fit into a non-indirected ANT URLLoad message, then skip the ANT URLLoad broadcast and jump straight to using URI_Dispatch. We don't support indirected ANT URLLoad messages as their potential for memory leakage is too great. svn path=/trunk/netsurf/; revision=8233
Diffstat (limited to 'riscos')
-rw-r--r--riscos/uri.c22
-rw-r--r--riscos/uri.h2
-rw-r--r--riscos/url_protocol.c7
3 files changed, 25 insertions, 6 deletions
diff --git a/riscos/uri.c b/riscos/uri.c
index da6f951dc..44cac853b 100644
--- a/riscos/uri.c
+++ b/riscos/uri.c
@@ -64,7 +64,7 @@ void ro_uri_message_received(wimp_message *msg)
free(uri_requested);
}
-bool ro_uri_launch(char *uri)
+bool ro_uri_launch(const char *uri)
{
uri_h uri_handle;
wimp_t handle_task;
@@ -84,19 +84,35 @@ bool ro_uri_launch(char *uri)
void ro_uri_bounce(wimp_message *msg)
{
uri_full_message_process *message = (uri_full_message_process *)msg;
- char uri_buf[512];
+ int size;
+ char *uri_buf;
os_error *e;
if ((message->flags & 1) == 0)
return;
- e = xuri_request_uri(0, uri_buf, sizeof uri_buf, message->handle, 0);
+ /* Get required buffer size */
+ e = xuri_request_uri(0, NULL, 0, message->handle, &size);
if (e) {
LOG(("xuri_request_uri: %d: %s", e->errnum, e->errmess));
return;
}
+ uri_buf = malloc(size);
+ if (uri_buf == NULL)
+ return;
+
+ /* Get URI */
+ e = xuri_request_uri(0, uri_buf, size, message->handle, 0);
+ if (e) {
+ LOG(("xuri_request_uri: %d: %s", e->errnum, e->errmess));
+ free(uri_buf);
+ return;
+ }
+
ro_url_load(uri_buf);
+ free(uri_buf);
+
return;
}
diff --git a/riscos/uri.h b/riscos/uri.h
index 8165b9c61..d538ea914 100644
--- a/riscos/uri.h
+++ b/riscos/uri.h
@@ -24,7 +24,7 @@
#include "oslib/wimp.h"
void ro_uri_message_received(wimp_message *message);
-bool ro_uri_launch(char *uri);
+bool ro_uri_launch(const char *uri);
void ro_uri_bounce(wimp_message *message);
#endif
diff --git a/riscos/url_protocol.c b/riscos/url_protocol.c
index 5db46d8f0..8b06d6f75 100644
--- a/riscos/url_protocol.c
+++ b/riscos/url_protocol.c
@@ -131,8 +131,11 @@ void ro_url_broadcast(const char *url)
os_error *error;
int len = strlen(url) + 1;
- if (236 < len)
- len = 236;
+ /* If URL is too long, then forget ANT and try URI, instead */
+ if (236 < len) {
+ ro_uri_launch(url);
+ return;
+ }
message.size = ((20+len+3) & ~3);
message.your_ref = 0;