1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

quote*() functions don't like that much NULL arg

This commit is contained in:
Xavier Saint 2008-08-02 11:22:14 +02:00
parent b967d49f79
commit bfd8a73f00
3 changed files with 8 additions and 6 deletions

View File

@ -318,6 +318,7 @@ iri_new (void)
i->uri_encoding = opt.encoding_remote ? xstrdup (opt.encoding_remote) : NULL; i->uri_encoding = opt.encoding_remote ? xstrdup (opt.encoding_remote) : NULL;
i->content_encoding = NULL; i->content_encoding = NULL;
i->utf8_encode = opt.enable_iri; i->utf8_encode = opt.enable_iri;
return i;
} }
void void
@ -331,12 +332,12 @@ iri_free (struct iri *i)
void void
set_uri_encoding (struct iri *i, char *charset, bool force) set_uri_encoding (struct iri *i, char *charset, bool force)
{ {
DEBUGP (("[IRI uri = `%s'\n", quote (charset))); DEBUGP (("[IRI uri = `%s'\n", charset ? quote (charset) : "None"));
if (!force && opt.encoding_remote) if (!force && opt.encoding_remote)
return; return;
if (i->uri_encoding) if (i->uri_encoding)
{ {
if (!strcasecmp (i->uri_encoding, charset)) if (charset && !strcasecmp (i->uri_encoding, charset))
return; return;
xfree (i->uri_encoding); xfree (i->uri_encoding);
} }
@ -347,12 +348,12 @@ set_uri_encoding (struct iri *i, char *charset, bool force)
void void
set_content_encoding (struct iri *i, char *charset) set_content_encoding (struct iri *i, char *charset)
{ {
DEBUGP (("[IRI content = %s\n", quote (charset))); DEBUGP (("[IRI content = %s\n", charset ? quote (charset) : "None"));
if (opt.encoding_remote) if (opt.encoding_remote)
return; return;
if (i->content_encoding) if (i->content_encoding)
{ {
if (!strcasecmp (i->content_encoding, charset)) if (charset && !strcasecmp (i->content_encoding, charset))
return; return;
xfree (i->content_encoding); xfree (i->content_encoding);
} }

View File

@ -117,7 +117,7 @@ url_enqueue (struct url_queue *queue, struct iri *i,
if (i) if (i)
DEBUGP (("[IRI Enqueuing %s with %s\n", quote (url), DEBUGP (("[IRI Enqueuing %s with %s\n", quote (url),
quote (i->uri_encoding))); i->uri_encoding ? quote (i->uri_encoding) : "None"));
if (queue->tail) if (queue->tail)
queue->tail->next = qel; queue->tail->next = qel;

View File

@ -636,7 +636,8 @@ retrieve_url (const char *origurl, char **file, char **newloc,
} }
DEBUGP (("[IRI Retrieving %s with %s (UTF-8=%d)\n", quote (url), DEBUGP (("[IRI Retrieving %s with %s (UTF-8=%d)\n", quote (url),
quote (iri->uri_encoding), iri->utf8_encode)); iri->uri_encoding ? quote (iri->uri_encoding) : "None",
iri->utf8_encode));
if (!refurl) if (!refurl)
refurl = opt.referer; refurl = opt.referer;