ObjFW  Diff

Differences From Artifact [40a01b9a4a]:

  • File src/socket.h — part of check-in [d302df8b46] at 2017-05-17 22:14:55 on branch trunk — typedef socklen_t to int on MorphOS

    The previous approach of including <pthread.h> - which has the typedef -
    turned out to be wrong, as that header is only a stub and including it
    breaks things.

    Since all the functions taking a socklen_t on other platforms take an
    int on MorphOS, creating a typedef to int is the proper way. (user: js, size: 2037) [annotate] [blame] [check-ins using]

To Artifact [a30a66785b]:


17
18
19
20
21
22
23
24


25



26



27
28
29
30
31
32
33
#include "objfw-defs.h"

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

#include <stdbool.h>



#ifdef OF_HAVE_SYS_SOCKET_H



# include <sys/socket.h>



#endif
#ifdef OF_HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef OF_HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif








>
>

>
>
>

>
>
>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "objfw-defs.h"

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

#include <stdbool.h>

#import "platform.h"

#ifdef OF_HAVE_SYS_SOCKET_H
# if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
#  define BOOL EXEC_BOOL
# endif
# include <sys/socket.h>
# if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
#  undef BOOL
# endif
#endif
#ifdef OF_HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef OF_HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
42
43
44
45
46
47
48



49

50
51
52
53
54
55
56
#  endif
# endif
# include <windows.h>
# include <ws2tcpip.h>
#endif

#ifdef OF_MORPHOS



typedef int socklen_t;


struct sockaddr_storage {
	uint8_t ss_len;
	uint8_t ss_family;
	char ss_data[2 + sizeof(struct in_addr) + 8];
};
#endif







>
>
>

>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#  endif
# endif
# include <windows.h>
# include <ws2tcpip.h>
#endif

#ifdef OF_MORPHOS
# ifndef OF_IXEMUL
typedef long socklen_t;
# else
typedef int socklen_t;
#endif

struct sockaddr_storage {
	uint8_t ss_len;
	uint8_t ss_family;
	char ss_data[2 + sizeof(struct in_addr) + 8];
};
#endif