diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2015-07-23 00:05:22 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2015-10-24 15:12:57 +0100 |
commit | 65b510fbc3ad822ab8c75e6d94eaee5b6ceb07a4 (patch) | |
tree | e90ae621688c1b4e974e901e12ecfb03bfb059be /render | |
parent | 5206518a75d34cdf03a5118276e7ba4c106b6bfc (diff) | |
download | netsurf-65b510fbc3ad822ab8c75e6d94eaee5b6ceb07a4.tar.gz netsurf-65b510fbc3ad822ab8c75e6d94eaee5b6ceb07a4.tar.bz2 |
Rework IDN URL retrieval to return an nserror
Diffstat (limited to 'render')
-rw-r--r-- | render/html_interaction.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/render/html_interaction.c b/render/html_interaction.c index af8417448..1b2e5b9c9 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -300,7 +300,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw, enum { ACTION_NONE, ACTION_SUBMIT, ACTION_GO } action = ACTION_NONE; const char *title = 0; nsurl *url = 0; - char *idn_url = NULL; + char *url_s = NULL; + size_t url_l = 0; const char *target = 0; char status_buffer[200]; const char *status = 0; @@ -816,21 +817,25 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } } else if (url) { if (nsoption_bool(display_decoded_idn) == true) { - idn_url = nsurl_access_utf8(url); + if (nsurl_access_utf8(url, &url_s, &url_l) != NSERROR_OK) { + /* Unable to obtain a decoded IDN. This is not a fatal error. + * Ensure the string pointer is NULL so we use the encoded version. */ + url_s = NULL; + } } if (title) { snprintf(status_buffer, sizeof status_buffer, "%s: %s", - idn_url ? idn_url : nsurl_access(url), title); + url_s ? url_s : nsurl_access(url), title); } else { snprintf(status_buffer, sizeof status_buffer, "%s", - idn_url ? idn_url : nsurl_access(url)); + url_s ? url_s : nsurl_access(url)); } status = status_buffer; - if (idn_url != NULL) - free(idn_url); + if (url_s != NULL) + free(url_s); pointer = get_pointer_shape(url_box, imagemap); |