rustls / rustls-ffi

Use Rustls from any language
Other
132 stars 30 forks source link

Fix warnings in server.c / client.c Windows build #235

Closed jsha closed 6 months ago

jsha commented 2 years ago
tests/server.c(57): warning C4013: 'ws_strerror' undefined; assuming extern returning int
tests/server.c(57): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 2 has type 'int'
tests/server.c(57): warning C4313: 'fprintf': '%s' in format string conflicts with argument 2 of type 'int'
tests/server.c(62): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 2 has type 'int'
tests/server.c(62): warning C4313: 'fprintf': '%s' in format string conflicts with argument 2 of type 'int'
tests/server.c(98): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 1 has type 'int'
tests/server.c(98): warning C4313: 'fprintf': '%s' in format string conflicts with argument 1 of type 'int'
tests/server.c(110): warning C4477: 'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 1 has type 'size_t'
tests/server.c(110): note: consider using '%zd' in the format string
tests/server.c(129): warning C4477: 'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 1 has type 'size_t'
tests/server.c(129): note: consider using '%zd' in the format string
tests/server.c(135): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 1 has type 'int'
tests/server.c(135): warning C4313: 'fprintf': '%s' in format string conflicts with argument 1 of type 'int'
tests/server.c(168): warning C4477: 'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 1 has type 'size_t'
tests/server.c(168): note: consider using '%zd' in the format string
tests/server.c(331): error C2079: 'siga' uses undefined struct 'sigaction'
tests/server.c(332): error C2224: left of '.sa_handler' must have struct/union type
tests/server.c(333): warning C4013: 'sigaction' undefined; assuming extern returning int
tests/server.c(363): warning C4244: '=': conversion from 'SOCKET' to 'int', possible loss of data
tests/server.c(365): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 1 has type 'int'
tests/server.c(365): warning C4313: 'fprintf': '%s' in format string conflicts with argument 1 of type 'int'
tests/server.c(369): warning C4133: 'function': incompatible types - from 'int *' to 'const char *'
tests/server.c(379): warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
tests/server.c(396): warning C4244: 'initializing': conversion from 'SOCKET' to 'int', possible loss of data
cpu commented 7 months ago

I think the contributions in #275 did the hard work here. I'm only seeing two warnings in the CMake windows builds as of the time of writing:

D:\a\rustls-ffi\rustls-ffi\tests\client.c(461,23): warning C4133: 'function': incompatible types - from 'rustls_result (__cdecl *)(void *,const rustls_verify_server_cert_params *)' to 'rustls_verify_server_cert_callback'
D:\a\rustls-ffi\rustls-ffi\tests\server.c(342,51): warning C4133: 'function': incompatible types - from 'int *' to 'const char *' [D:\a\rustls-ffi\rustls-ffi\build\tests\server.vcxproj]

I think https://github.com/rustls/rustls-ffi/pull/405 will fix both and resolve this issue.