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

fe-dcc-(get|send): Fix some -Wpointer-compare with newer gcc

The warning itself:

>warning: comparison between pointer and zero character constant [-Wpointer-compare]

Harmless stuff as far as I can tell.

The fix adds a null check that probably isn't needed. The old code that
compared against '\0' worked a lot like a null check so it makes sense
to keep that, while also adding the intended check for empty string.

This was visible with "/dcc close send a" showing an empty filename.
The equivalent for get didn't show the filename in the format string.
This commit is contained in:
dequis 2017-06-05 15:58:43 -03:00
parent 31b9d115b0
commit 52bb06ccd9
2 changed files with 2 additions and 2 deletions

View File

@ -108,7 +108,7 @@ static void dcc_error_close_not_found(const char *type, const char *nick,
g_return_if_fail(fname != NULL);
if (g_ascii_strcasecmp(type, "GET") != 0) return;
if (fname == '\0') fname = "(ANY)";
if (fname == NULL || *fname == '\0') fname = "(ANY)";
printformat(NULL, NULL, MSGLEVEL_DCC,
IRCTXT_DCC_GET_NOT_FOUND, nick, fname);
}

View File

@ -108,7 +108,7 @@ static void dcc_error_close_not_found(const char *type, const char *nick,
g_return_if_fail(fname != NULL);
if (g_ascii_strcasecmp(type, "SEND") != 0) return;
if (fname == '\0') fname = "(ANY)";
if (fname == NULL || *fname == '\0') fname = "(ANY)";
printformat(NULL, NULL, MSGLEVEL_DCC,
IRCTXT_DCC_SEND_NOT_FOUND, nick, fname);
}