Fix format specifier for printing size_t on 32bit size_t platforms
PATCH 1/1 Fix format specifier for printing size_t on 32bit size_t platforms
Today even 32 bit platform generally use a 64bit size_t but Android armeabi-v7a is an expection to that and uses a 32bit size_t. Use z as correct specifier for a size_t.
Clang complained about this:
warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
--- src/openvpn/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/init.c +1 -1
@@ -2431,7 +2431,7 @@ get_frame_mtu(struct context *c, const struct options *o)if (mtu <TUN_MTU_MIN ) { -msg (M_WARN ,"TUN MTU value (%lu) must be at least %d" , mtu,TUN_MTU_MIN ); +msg (M_WARN ,"TUN MTU value (%zu) must be at least %d" , mtu,TUN_MTU_MIN );frame_print (&c->c2.frame,M_FATAL ,"MTU is too small" ); }return mtu;
Signature · 1 line
2.32.0 (Apple Git-132)
%zu is now a first class citizen even in MSVC, so we're safe to use it.
Says Lev, and The Internet.
https://stackoverflow.com/questions/15610053/correct-printf-format-specifier-for-size-t-zu-or-iu
Only minimally tested ("does it compile on amd64 linux with no warning").
Your patch has been applied to the master branch.
commit 6e375353ed99b794994b809570b217e3e732a44b
Author: Arne Schwabe Date: Wed May 4 13:31:58 2022 +0200
Fix format specifier for printing size_t on 32bit size_t platforms
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg24277.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering