ws: add out param for catalog entry count to ws_get_protocol_catalog()
This avoids a sign-conversion warning on clang 6.x.
This commit is contained in:
parent
fa16c36d95
commit
a60d90a26a
@ -65,13 +65,12 @@ static const WSAPROTOCOL_INFOW* _afd_find_protocol_info(
|
|||||||
|
|
||||||
int afd_global_init(void) {
|
int afd_global_init(void) {
|
||||||
WSAPROTOCOL_INFOW* infos;
|
WSAPROTOCOL_INFOW* infos;
|
||||||
ssize_t infos_count;
|
size_t infos_count;
|
||||||
const WSAPROTOCOL_INFOW* afd_info;
|
const WSAPROTOCOL_INFOW* afd_info;
|
||||||
|
|
||||||
/* Load the winsock catalog. */
|
/* Load the winsock catalog. */
|
||||||
infos_count = ws_get_protocol_catalog(&infos);
|
if (ws_get_protocol_catalog(&infos, &infos_count) < 0)
|
||||||
if (infos_count < 0)
|
return -1;
|
||||||
return_map_error(-1);
|
|
||||||
|
|
||||||
/* Find a WSAPROTOCOL_INFOW structure that we can use to create an MSAFD
|
/* Find a WSAPROTOCOL_INFOW structure that we can use to create an MSAFD
|
||||||
* socket. Preferentially we pick a UDP socket, otherwise try TCP or any
|
* socket. Preferentially we pick a UDP socket, otherwise try TCP or any
|
||||||
|
|||||||
@ -26,9 +26,9 @@
|
|||||||
#pragma warning(push, 1)
|
#pragma warning(push, 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <WinSock2.h>
|
|
||||||
#include <WS2tcpip.h>
|
#include <WS2tcpip.h>
|
||||||
|
#include <WinSock2.h>
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|||||||
6
src/ws.c
6
src/ws.c
@ -43,7 +43,8 @@ SOCKET ws_get_base_socket(SOCKET socket) {
|
|||||||
|
|
||||||
/* Retrieves a copy of the winsock catalog.
|
/* Retrieves a copy of the winsock catalog.
|
||||||
* The infos pointer must be released by the caller with free(). */
|
* The infos pointer must be released by the caller with free(). */
|
||||||
ssize_t ws_get_protocol_catalog(WSAPROTOCOL_INFOW** infos_out) {
|
int ws_get_protocol_catalog(WSAPROTOCOL_INFOW** infos_out,
|
||||||
|
size_t* infos_count_out) {
|
||||||
DWORD buffer_size = _WS_INITIAL_CATALOG_BUFFER_SIZE;
|
DWORD buffer_size = _WS_INITIAL_CATALOG_BUFFER_SIZE;
|
||||||
int count;
|
int count;
|
||||||
WSAPROTOCOL_INFOW* infos;
|
WSAPROTOCOL_INFOW* infos;
|
||||||
@ -63,6 +64,7 @@ ssize_t ws_get_protocol_catalog(WSAPROTOCOL_INFOW** infos_out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*infos_out = infos;
|
*infos_out = infos;
|
||||||
return count;
|
*infos_count_out = count;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
src/ws.h
3
src/ws.h
@ -8,6 +8,7 @@
|
|||||||
WEPOLL_INTERNAL int ws_global_init(void);
|
WEPOLL_INTERNAL int ws_global_init(void);
|
||||||
|
|
||||||
WEPOLL_INTERNAL SOCKET ws_get_base_socket(SOCKET socket);
|
WEPOLL_INTERNAL SOCKET ws_get_base_socket(SOCKET socket);
|
||||||
WEPOLL_INTERNAL ssize_t ws_get_protocol_catalog(WSAPROTOCOL_INFOW** infos_out);
|
WEPOLL_INTERNAL int ws_get_protocol_catalog(WSAPROTOCOL_INFOW** infos_out,
|
||||||
|
size_t* infos_count_out);
|
||||||
|
|
||||||
#endif /* WEPOLL_WS_H_ */
|
#endif /* WEPOLL_WS_H_ */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user