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
Frank Lichtenheld 2025-01-21 18:30:34 +01:00 committed by Gert Doering
parent 528df5e259
commit 39c31aef98
1 changed files with 6 additions and 5 deletions

View File

@ -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 */