c - Change socklen_t int to uint32_t in sys/socket.h -
c - Change socklen_t int to uint32_t in sys/socket.h -
i have conflicting typedef socklen_t in library i'm trying build , included file ndk-path/platforms/android-19/arch-arm/usr/include/sys/socket.h.
the library has typedef uint32_t socklen_t
includes sys/socket.h typedefs int. create library utilize sys/socket.h version (int) or redefine in socket.h header (as below). safer? tried contacting author of library no response. changing definition in socket.h safe?
#ifndef _sys_socket_h_ #define _sys_socket_h_ #include <sys/cdefs.h> #include <sys/types.h> #include <cstdint> #include <linux/socket.h> __begin_decls #define sock_stream 1 #define sock_dgram 2 #define sock_raw 3 #define sock_rdm 4 #define sock_seqpacket 5 #define sock_packet 10 #ifdef __i386__ # define __socketcall extern __attribute__((__cdecl__)) #else # define __socketcall extern #endif /* bionic: sec argument shutdown() */ enum { shut_rd = 0, /* no more receptions */ #define shut_rd shut_rd shut_wr, /* no more transmissions */ #define shut_wr shut_wr shut_rdwr /* no more receptions or transmissions */ #define shut_rdwr shut_rdwr }; typedef uint32_t socklen_t; __socketcall int socket(int, int, int); __socketcall int bind(int, const struct sockaddr *, int); __socketcall int connect(int, const struct sockaddr *, socklen_t); __socketcall int listen(int, int); __socketcall int accept(int, struct sockaddr *, socklen_t *); __socketcall int getsockname(int, struct sockaddr *, socklen_t *); __socketcall int getpeername(int, struct sockaddr *, socklen_t *); __socketcall int socketpair(int, int, int, int *); __socketcall int shutdown(int, int); __socketcall int setsockopt(int, int, int, const void *, socklen_t); __socketcall int getsockopt(int, int, int, void *, socklen_t *); __socketcall int sendmsg(int, const struct msghdr *, unsigned int); __socketcall int recvmsg(int, struct msghdr *, unsigned int); extern ssize_t send(int, const void *, size_t, unsigned int); extern ssize_t recv(int, void *, size_t, unsigned int); __socketcall ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); __socketcall ssize_t recvfrom(int, void *, size_t, unsigned int, const struct sockaddr *, socklen_t *); #undef __socketcall __end_decls #endif /* _sys_socket_h */
changing scheme includes bad idea, rest of scheme relies on protoyped/typdefed/declared/definded in there.
so adjust un-portable library code.
c sockets android-ndk
Comments
Post a Comment