1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[uri] 0 -> URI_NONE in get_uri to decrease number of warnings

This commit is contained in:
Witold Filipczyk 2022-01-14 20:52:17 +01:00
parent e38fd8bca7
commit 0e8ee7876a
29 changed files with 37 additions and 37 deletions

2
src/cache/cache.c vendored
View File

@ -760,7 +760,7 @@ redirect_cache(struct cache_entry *cached, char *location,
}
if (cached->redirect) done_uri(cached->redirect);
cached->redirect = get_uri(uristring, 0);
cached->redirect = get_uri(uristring, URI_NONE);
cached->redirect_get = get;
if (incomplete >= 0) cached->incomplete = incomplete;

View File

@ -54,7 +54,7 @@ menu_url_shortcut(struct terminal *term, void *url_, void *ses_)
{
char *url = url_;
struct session *ses = ses_;
struct uri *uri = get_uri(url, 0);
struct uri *uri = get_uri(url, URI_NONE);
if (!uri) return;
goto_uri(ses, uri);

View File

@ -219,7 +219,7 @@ set_base_uri(struct dom_renderer *renderer, char *value, size_t valuelen)
mem_free(href);
if (!uristring) return;
uri = get_uri(uristring, 0);
uri = get_uri(uristring, URI_NONE);
mem_free(uristring);
if (!uri) return;

View File

@ -49,9 +49,9 @@ add_frameset_entry(struct frameset_desc *frameset_desc,
frame_desc = &frameset_desc->frame_desc[offset];
frame_desc->subframe = subframe;
frame_desc->name = null_or_stracpy(name);
frame_desc->uri = (url && *url) ? get_uri(url, 0) : NULL;
frame_desc->uri = (url && *url) ? get_uri(url, URI_NONE) : NULL;
if (!frame_desc->uri)
frame_desc->uri = get_uri("about:blank", 0);
frame_desc->uri = get_uri("about:blank", URI_NONE);
frameset_desc->box.x++;
if (frameset_desc->box.x >= frameset_desc->box.width) {

View File

@ -47,13 +47,13 @@ void add_iframeset_entry(struct iframeset_desc **parent,
offset = iframeset_desc->n;
iframe_desc = &iframeset_desc->iframe_desc[offset];
iframe_desc->name = stracpy(name);
iframe_desc->uri = get_uri(url, 0);
iframe_desc->uri = get_uri(url, URI_NONE);
iframe_desc->x = 1;
iframe_desc->y = y;
iframe_desc->width = width;
iframe_desc->height = height;
if (!iframe_desc->uri)
iframe_desc->uri = get_uri("about:blank", 0);
iframe_desc->uri = get_uri("about:blank", URI_NONE);
iframeset_desc->n++;
}

View File

@ -735,7 +735,7 @@ html_base(struct html_context *html_context, char *a,
al = get_url_val(a, "href", html_context->doc_cp);
if (al) {
char *base = join_urls(html_context->base_href, al);
struct uri *uri = base ? get_uri(base, 0) : NULL;
struct uri *uri = base ? get_uri(base, URI_NONE) : NULL;
mem_free(al);
mem_free_if(base);

View File

@ -34,7 +34,7 @@ init_document_refresh(char *url, unsigned long seconds)
refresh = mem_alloc(sizeof(*refresh));
if (!refresh) return NULL;
refresh->uri = get_uri(url, 0);
refresh->uri = get_uri(url, URI_NONE);
if (!refresh->uri) {
mem_free(refresh);
return NULL;

View File

@ -569,7 +569,7 @@ tags_html_base(struct source_renderer *renderer, void *no, unsigned char *a,
if (al) {
unsigned char *base = join_urls(html_context->base_href, al);
struct uri *uri = base ? get_uri(base, 0) : NULL;
struct uri *uri = base ? get_uri(base, URI_NONE) : NULL;
mem_free(al);
mem_free_if(base);

View File

@ -486,7 +486,7 @@ ecmascript_protocol_handler(struct session *ses, struct uri *uri)
mem_free(redirect_url);
if (!redirect_abs_url)
return;
redirect_uri = get_uri(redirect_abs_url, 0);
redirect_uri = get_uri(redirect_abs_url, URI_NONE);
mem_free(redirect_abs_url);
if (!redirect_uri)
return;
@ -764,7 +764,7 @@ location_goto(struct document_view *doc_view, char *url)
trim_chars(url, ' ', 0));
if (!new_abs_url)
return;
new_uri = get_uri(new_abs_url, 0);
new_uri = get_uri(new_abs_url, URI_NONE);
mem_free(new_abs_url);
if (!new_uri)
return;

View File

@ -143,7 +143,7 @@ js_window_open(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *ar
/* TODO: Support for window naming and perhaps some window features? */
uri = get_uri(url2, 0);
uri = get_uri(url2, URI_NONE);
mem_free(url2);
if (!uri) {
if (frame) JS_FreeCString(ctx, frame);

View File

@ -359,7 +359,7 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval)
/* TODO: Support for window naming and perhaps some window features? */
uri = get_uri(url2, 0);
uri = get_uri(url2, URI_NONE);
mem_free(url2);
if (!uri) {
mem_free_if(frame);

View File

@ -90,7 +90,7 @@ get_formhist_data_uri(struct listbox_item *item)
{
struct formhist_data *formhist_data = item->udata;
return get_uri(formhist_data->url, 0);
return get_uri(formhist_data->url, URI_NONE);
}
static struct listbox_item *

View File

@ -84,7 +84,7 @@ get_globhist_item_uri(struct listbox_item *item)
{
struct global_history_item *historyitem = item->udata;
return get_uri(historyitem->url, 0);
return get_uri(historyitem->url, URI_NONE);
}
static int

View File

@ -725,7 +725,7 @@ parse_bittorrent_metafile(struct bittorrent_meta *meta,
if (!value_string) break;
uri = get_uri(value_string, 0);
uri = get_uri(value_string, URI_NONE);
mem_free(value_string);
if (uri) {
add_to_uri_list(&meta->tracker_uris, uri);

View File

@ -407,7 +407,7 @@ bittorrent_protocol_handler(struct connection *conn)
}
if (conn->uri->datalen)
uri = get_uri(conn->uri->data, 0);
uri = get_uri(conn->uri->data, URI_NONE);
if (!uri) {
abort_connection(conn, connection_state(S_BITTORRENT_BAD_URL));

View File

@ -644,7 +644,7 @@ bittorrent_download(struct dialog_data *dlg_data, struct widget_data *widget_dat
add_to_string(&redirect, "bittorrent:");
add_uri_to_string(&redirect, type_query->uri, URI_ORIGINAL);
uri = get_uri(redirect.source, 0);
uri = get_uri(redirect.source, URI_NONE);
done_string(&redirect);
tp_cancel(type_query);

View File

@ -302,7 +302,7 @@ make_bittorrent_peer_connection(struct bittorrent_connection *bittorrent,
"bittorrent-peer://%s:%u/",
peer_info->ip, (unsigned) peer_info->port))
goto out;
uri = get_uri(uri_string.source, 0);
uri = get_uri(uri_string.source, URI_NONE);
if (!uri) goto out;
make_connection(peer->socket, uri, send_bittorrent_peer_handshake, 1);

View File

@ -253,7 +253,7 @@ do_send_bittorrent_tracker_request(struct connection *conn)
if (get_opt_bool("protocol.bittorrent.tracker.compact", NULL))
add_to_string(&request, "&compact=1");
uri = get_uri(request.source, 0);
uri = get_uri(request.source, URI_NONE);
done_string(&request);
if (!uri) {
if (!stopped)

View File

@ -66,7 +66,7 @@ proxy_uri(struct uri *uri, char *proxy,
/* There is no need to use URI_BASE when calling get_uri()
* because URI_BASE should not add any fragments in the first
* place. */
uri = get_uri(string.source, 0);
uri = get_uri(string.source, URI_NONE);
/* XXX: Assume the problem is due to @proxy having bad format.
* This is a lot faster easier than checking the format. */
if (!uri)

View File

@ -1308,7 +1308,7 @@ get_composed_uri(struct uri *uri, enum uri_component components)
string = get_uri_string(uri, components);
if (!string) return NULL;
uri = get_uri(string, 0);
uri = get_uri(string, URI_NONE);
mem_free(string);
return uri;
@ -1322,7 +1322,7 @@ get_translated_uri(char *uristring, char *cwd)
uristring = translate_url(uristring, cwd);
if (!uristring) return NULL;
uri = get_uri(uristring, 0);
uri = get_uri(uristring, URI_NONE);
mem_free(uristring);
return uri;

View File

@ -121,7 +121,7 @@ enum uri_errno parse_uri(struct uri *uri, char *uristring);
enum uri_component {
/**** The "raw" URI components */
URI_NONE = 0,
URI_PROTOCOL = (1 << 0),
URI_IP_FAMILY = (1 << 1),
URI_USER = (1 << 2),

View File

@ -85,7 +85,7 @@ smjs_load_uri(JSContext *ctx, unsigned int argc, JS::Value *rval)
uri_string = jsval_to_string(smjs_ctx, args[0]);
if (!uri_string || !*uri_string) return false;
uri = get_uri(uri_string, 0);
uri = get_uri(uri_string, URI_NONE);
if (!uri) return false;
external_handler = get_protocol_external_handler(NULL, uri);

View File

@ -1147,7 +1147,7 @@ smjs_session_goto_url(JSContext *ctx, unsigned int argc, JS::Value *rval)
url = jsval_to_string(ctx, args[0]);
if (!url) return false;
uri = get_uri(url, 0);
uri = get_uri(url, URI_NONE);
if (!uri) return false;
deo = mem_calloc(1, sizeof(*deo));

View File

@ -366,7 +366,7 @@ exec_mailcap_command(void *data)
struct string string;
if (init_string(&string)) {
struct uri *ref = get_uri("mailcap:elmailcap", 0);
struct uri *ref = get_uri("mailcap:elmailcap", URI_NONE);
struct uri *uri;
struct session *ses = exec_mailcap->ses;
@ -377,7 +377,7 @@ exec_mailcap_command(void *data)
add_to_string(&string, exec_mailcap->file);
}
uri = get_uri(string.source, 0);
uri = get_uri(string.source, URI_NONE);
done_string(&string);
set_session_referrer(ses, ref);
if (ref) done_uri(ref);

View File

@ -1310,7 +1310,7 @@ decode_session_info(struct terminal *term, struct terminal_info *info)
struct session *ses;
if (!uri)
uri = get_uri("about:blank", 0);
uri = get_uri("about:blank", URI_NONE);
ses = init_session(base_session, term, uri, backgrounded);
if (!ses) {

View File

@ -725,7 +725,7 @@ map_selected(struct terminal *term, void *ld_, void *ses_)
{
struct link_def *ld = ld_;
struct session *ses = ses_;
struct uri *uri = get_uri(ld->link, 0);
struct uri *uri = get_uri(ld->link, URI_NONE);
goto_uri_frame(ses, uri, ld->target, CACHE_MODE_NORMAL);
if (uri) done_uri(uri);
@ -735,7 +735,7 @@ map_selected(struct terminal *term, void *ld_, void *ses_)
void
goto_url(struct session *ses, char *url)
{
struct uri *uri = get_uri(url, 0);
struct uri *uri = get_uri(url, URI_NONE);
goto_uri(ses, uri);
if (uri) done_uri(uri);

View File

@ -1375,7 +1375,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view,
done_string(&data);
uri = get_uri(go.source, 0);
uri = get_uri(go.source, URI_NONE);
done_string(&go);
if (uri) {
uri->form = 1;
@ -2034,7 +2034,7 @@ get_form_info(struct session *ses, struct document_view *doc_view)
ses)))
break;
uri = get_uri(fc->form->action, 0);
uri = get_uri(fc->form->action, URI_NONE);
if (!uri) break;
/* Add the uri with password and post info stripped */

View File

@ -892,8 +892,8 @@ get_link_uri(struct session *ses, struct document_view *doc_view,
switch (link->type) {
case LINK_HYPERTEXT:
case LINK_MAP:
if (link->where) return get_uri(link->where, 0);
return get_uri(link->where_img, 0);
if (link->where) return get_uri(link->where, URI_NONE);
return get_uri(link->where_img, URI_NONE);
case LINK_BUTTON:
case LINK_FIELD:

View File

@ -1782,7 +1782,7 @@ download_link(struct session *ses, struct document_view *doc_view,
case ACT_MAIN_LINK_DOWNLOAD_IMAGE:
if (!link->where_img) break;
ses->download_uri = get_uri(link->where_img, 0);
ses->download_uri = get_uri(link->where_img, URI_NONE);
break;
default: