1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Cast the NULL argument of string_concat to unsigned char *.

string_concat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to string_concat.
This is in principle also a violation, but I'm ignoring it for now
because if it becomes a problem with some C implementation, then so
will the use of unsigned char * with printf "%s", which is so
widespread in ELinks that I'm not going to try fixing it now.
This commit is contained in:
Kalle Olavi Niemitalo 2007-03-11 13:01:50 +02:00 committed by Kalle Olavi Niemitalo
parent 7645a836fc
commit a495f6d26a
4 changed files with 7 additions and 4 deletions

View File

@ -123,7 +123,7 @@ get_dyn_full_version(struct terminal *term, int more)
comma, "UTF-8",
#endif
comma,
NULL
(unsigned char *) NULL
);
add_modules_to_string(&string, term);

View File

@ -124,7 +124,8 @@ add_dir_entry(struct directory_entry *entry, struct string *page,
if (entry->attrib[0] == 'd' && *dircolor) {
/* The <b> is for the case when use_document_colors is off. */
string_concat(page, "<font color=\"", dircolor, "\"><b>", NULL);
string_concat(page, "<font color=\"", dircolor, "\"><b>",
(unsigned char *) NULL);
}
add_string_to_string(page, &html_encoded_name);

View File

@ -60,7 +60,8 @@ proxy_uri(struct uri *uri, unsigned char *proxy,
struct string string;
if (init_string(&string)
&& string_concat(&string, "proxy://", proxy, "/", NULL)
&& string_concat(&string, "proxy://", proxy, "/",
(unsigned char *) NULL)
&& add_uri_to_string(&string, uri, URI_BASE)) {
/* There is no need to use URI_BASE when calling get_uri()
* because URI_BASE should not add any fragments in the first

View File

@ -167,7 +167,8 @@ struct string *add_string_to_string(struct string *to, const struct string *from
struct string *add_file_to_string(struct string *string, const unsigned char *filename);
struct string *add_crlf_to_string(struct string *string);
/* Adds each C string to @string until a terminating NULL is met. */
/* Adds each C string to @string until a terminating
* (unsigned char *) NULL is met. */
struct string *string_concat(struct string *string, ...);
/* Extends the string with @times number of @character. */