Home GnuPG

Fix internal socket API to be consistent for SOCKET.

Description

Fix internal socket API to be consistent for SOCKET.

* src/assuan-defs.h (_assuan_socket): Return value has type assuan_fd_t.
(_assuan_connect): Second argument has type assuan_fd_t.
[HAVE_W64_SYSTEM] (SOCKET2HANDLE): Revert the change before.
* src/assuan-socket.c (_assuan_sock_new): No type coercion for
_assuan_socket.
(socks5_connect): No type coercion for _assuan_connect.
(_assuan_sock_connect): Likewise.
* src/assuan.h.in (struct assuan_system_hooks): Fix method signature
of socket for return value type and of connect for the second
argument.
(__assuan_socket): Return value has type assuan_fd_t.
(__assuan_connect): Second argument has type assuan_fd_t.
(ASSUAN_SYSTEM_NPTH_IMPL): Fix for _assuan_npth_connect for its
second argument.
* src/system-w32.c (__assuan_socket): Return value has type
assuan_fd_t.
Use SOCKET2HANDLE for type coercion for socket.
Use INVALID_SOCKET.
(__assuan_connect): Second argument has type assuan_fd_t.
Use HANDLE2SOCKET for type coercion for sock.
* src/system.c (_assuan_socket): Return value has type assuan_fd_t.
(_assuan_connect): Second argument has type assuan_fd_t.

Note that this change does *NOT* constitute any ABI change, no API
change, either. It is fix for internal consistency for socket.

The change of SOCKET2HANDLE in the past for HAVE_W64_SYSTEM was done,
because of internal use of 'int' which represents the type for socket.
Instead of fixing that part of code for 'int', I touched another part
to silence warnings. That's not correct fix, but a work around.

This time, with the changes, whole parts are now consisitent.

Details

Provenance
gniibeAuthored on Mar 31 2022, 11:36 AM
Parents
rA9de02ca16d30: build: When no gpg-error-config, not install libassuan-config.
Branches
Unknown
Tags
Unknown