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>master
parent
528df5e259
commit
39c31aef98
11
openvpn.c
11
openvpn.c
|
@ -167,22 +167,23 @@ void
|
|||
OnLogLine(connection_t *c, char *line)
|
||||
{
|
||||
HWND logWnd = GetDlgItem(c->hwndStatus, ID_EDT_LOG);
|
||||
char *flags, *message;
|
||||
time_t timestamp;
|
||||
TCHAR *datetime;
|
||||
const SETTEXTEX ste = { .flags = ST_SELECTION, .codepage = CP_UTF8 };
|
||||
|
||||
flags = strchr(line, ',') + 1;
|
||||
if (flags - 1 == NULL)
|
||||
char *flags = strchr(line, ',');
|
||||
if (flags == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
flags++;
|
||||
|
||||
message = strchr(flags, ',') + 1;
|
||||
if (message - 1 == NULL)
|
||||
char *message = strchr(flags, ',');
|
||||
if (message == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
message++;
|
||||
size_t flag_size = message - flags - 1; /* message is always > flags */
|
||||
|
||||
/* Remove lines from log window if it is getting full */
|
||||
|
|
Loading…
Reference in New Issue