]> git.ipfire.org Git - thirdparty/openvpn.git/commit
windows: use appropriate and portable format specifier for 64bit pointer
authorAntonio Quartulli <antonio@openvpn.net>
Sat, 1 May 2021 13:06:38 +0000 (15:06 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 2 May 2021 20:33:50 +0000 (22:33 +0200)
commit396c4e4903fda078536016b7ada97862f713bd94
treea4647c1eb7a600e35521b05123eec25dc282d857
parentc2912912047fdd228faedb6466672288e14dbba6
windows: use appropriate and portable format specifier for 64bit pointer

To print a 64bit poiner, fprintf() must be provided with the appropriate
format specifier.

The most portable in this case is PRIx64, which is redefined accordingly
on each platform. It comes from inttypes.h and it's the recommended way
to print a 64bit long hex value.

Fixes various warnings of this type:

event.c: In function ‘we_ctl’:
event.c:235:24: warning: 'I' flag used with ‘%x’ gnu_printf format
[-Wformat=]
  235 |     dmsg(D_EVENT_WAIT, "WE_CTL n=%d ev=%p rwflags=0x%04x arg="
ptr_format,
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error.h:151:68: note: in definition of macro ‘dmsg’
  151 | #define dmsg(flags, ...) do { if (msg_test(flags)) {x_msg((flags),
__VA_ARGS__);} EXIT_FATAL(flags); } while (false)
      |
^~~~~~~~~~~
event.c:235:24: warning: format ‘%x’ expects argument of type ‘unsigned
int’, but argument 6 has type ‘long long unsigned int’ [-Wformat=]
  235 |     dmsg(D_EVENT_WAIT, "WE_CTL n=%d ev=%p rwflags=0x%04x arg="
ptr_format,
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  239 |          (ptr_type)arg);
      |          ~~~~~~~~~~~~~
      |          |
      |          long long unsigned int

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20210501130640.9330-2-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22268.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/common.h