mirror of https://github.com/OpenVPN/openvpn-gui
openvpn.c: Avoid -Waddress warnings with MinGW
This happens on newer MinGW versions: openvpn.c:176:19: error: the comparison will always evaluate as ‘false’ for the pointer operand in ‘flags + -1’ must not be NULL [-Werror=address] Strictly speaking this is a false positive, but the pointer handling is a bit weird, so make the code more straight-forward. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>pull/732/head
parent
528df5e259
commit
39c31aef98
11
openvpn.c
11
openvpn.c
|
@ -167,22 +167,23 @@ void
|
||||||
OnLogLine(connection_t *c, char *line)
|
OnLogLine(connection_t *c, char *line)
|
||||||
{
|
{
|
||||||
HWND logWnd = GetDlgItem(c->hwndStatus, ID_EDT_LOG);
|
HWND logWnd = GetDlgItem(c->hwndStatus, ID_EDT_LOG);
|
||||||
char *flags, *message;
|
|
||||||
time_t timestamp;
|
time_t timestamp;
|
||||||
TCHAR *datetime;
|
TCHAR *datetime;
|
||||||
const SETTEXTEX ste = { .flags = ST_SELECTION, .codepage = CP_UTF8 };
|
const SETTEXTEX ste = { .flags = ST_SELECTION, .codepage = CP_UTF8 };
|
||||||
|
|
||||||
flags = strchr(line, ',') + 1;
|
char *flags = strchr(line, ',');
|
||||||
if (flags - 1 == NULL)
|
if (flags == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
flags++;
|
||||||
|
|
||||||
message = strchr(flags, ',') + 1;
|
char *message = strchr(flags, ',');
|
||||||
if (message - 1 == NULL)
|
if (message == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
message++;
|
||||||
size_t flag_size = message - flags - 1; /* message is always > flags */
|
size_t flag_size = message - flags - 1; /* message is always > flags */
|
||||||
|
|
||||||
/* Remove lines from log window if it is getting full */
|
/* Remove lines from log window if it is getting full */
|
||||||
|
|
Loading…
Reference in New Issue