ObjFW  Check-in [6ba4095f05]

Overview
Comment:Fix compilation with mingw-w64
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6ba4095f05d3d279028bff3438482c83a0e8c1426a8dd38d7dc99b56ef3cbf03
User & Date: js on 2014-02-12 03:17:09
Other Links: manifest | tags
Context
2014-02-12
03:17
Call FreeEnvironmentStringsW on correct pointer check-in: f82406c3fd user: js tags: trunk
03:17
Fix compilation with mingw-w64 check-in: 6ba4095f05 user: js tags: trunk
03:17
Fix compilation with mingw32 check-in: fab07a40ca user: js tags: trunk
Changes

Modified src/exceptions/OFException.h from [e15938ad56] to [a993d55bbd].

19
20
21
22
23
24
25

26


27


28


29

30
31


32

33
34


35


36


37


38


39


40


41


42


43


44


45


46


47


48


49


50


51


52


53


54


55


56


57


58


59


60


61


62

63
64
65
66
67
68
69
@class OFString;
@class OFArray;
@class OFMutableArray;

#define OF_BACKTRACE_SIZE 32

#if defined(_WIN32) && defined(OF_HAVE_SOCKETS)

# define EADDRINUSE WSAEADDRINUSE


# define EADDRNOTAVAIL WSAEADDRNOTAVAIL


# define EAFNOSUPPORT WSAEAFNOSUPPORT


# define EALREADY WSAEALREADY

# define ECONNABORTED WSAECONNABORTED
# define ECONNABORTED WSAECONNABORTED


# define ECONNREFUSED WSAECONNREFUSED

# define ECONNRESET WSAECONNRESET
# define ECONNRESET WSAECONNRESET


# define EDESTADDRREQ WSAEDESTADDRREQ


# define EDQUOT WSAEDQUOT


# define EHOSTDOWN WSAEHOSTDOWN


# define EHOSTUNREACH WSAEHOSTUNREACH


# define EINPROGRESS WSAEINPROGRESS


# define EISCONN WSAEISCONN


# define ELOOP WSAELOOP


# define EMSGSIZE WSAEMSGSIZE


# define ENETDOWN WSAENETDOWN


# define ENETRESET WSAENETRESET


# define ENETUNREACH WSAENETUNREACH


# define ENOBUFS WSAENOBUFS


# define ENOPROTOOPT WSAENOPROTOOPT


# define ENOTCONN WSAENOTCONN


# define ENOTSOCK WSAENOTSOCK


# define EOPNOTSUPP WSAEOPNOTSUPP


# define EPFNOSUPPORT WSAEPFNOSUPPORT


# define EPROCLIM WSAEPROCLIM


# define EPROTONOSUPPORT WSAEPROTONOSUPPORT


# define EPROTOTYPE WSAEPROTOTYPE


# define EREMOTE WSAEREMOTE


# define ESHUTDOWN WSAESHUTDOWN


# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT


# define ESTALE WSAESTALE


# define ETIMEDOUT WSAETIMEDOUT


# define ETOOMANYREFS WSAETOOMANYREFS


# define EUSERS WSAEUSERS


# define EWOULDBLOCK WSAEWOULDBLOCK

extern int of_wsaerr_to_errno(int);
#endif

/*!
 * @brief The base class for all exceptions in ObjFW
 *
 * The OFException class is the base class for all exceptions in ObjFW, except







>
|
>
>
|
>
>
|
>
>
|
>
|
|
>
>
|
>
|
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>
>
|
>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
@class OFString;
@class OFArray;
@class OFMutableArray;

#define OF_BACKTRACE_SIZE 32

#if defined(_WIN32) && defined(OF_HAVE_SOCKETS)
# ifndef EADDRINUSE
#  define EADDRINUSE WSAEADDRINUSE
# endif
# ifndef EADDRNOTAVAIL
#  define EADDRNOTAVAIL WSAEADDRNOTAVAIL
# endif
# ifndef EAFNOSUPPORT
#  define EAFNOSUPPORT WSAEAFNOSUPPORT
# endif
# ifndef EALREADY
#  define EALREADY WSAEALREADY
# endif
# ifndef ECONNABORTED
#  define ECONNABORTED WSAECONNABORTED
# endif
# ifndef ECONNREFUSED
#  define ECONNREFUSED WSAECONNREFUSED
# endif
# ifndef ECONNRESET
#  define ECONNRESET WSAECONNRESET
# endif
# ifndef EDESTADDRREQ
#  define EDESTADDRREQ WSAEDESTADDRREQ
# endif
# ifndef EDQUOT
#  define EDQUOT WSAEDQUOT
# endif
# ifndef EHOSTDOWN
#  define EHOSTDOWN WSAEHOSTDOWN
# endif
# ifndef EHOSTUNREACH
#  define EHOSTUNREACH WSAEHOSTUNREACH
# endif
# ifndef EINPROGRESS
#  define EINPROGRESS WSAEINPROGRESS
# endif
# ifndef EISCONN
#  define EISCONN WSAEISCONN
# endif
# ifndef ELOOP
#  define ELOOP WSAELOOP
# endif
# ifndef EMSGSIZE
#  define EMSGSIZE WSAEMSGSIZE
# endif
# ifndef ENETDOWN
#  define ENETDOWN WSAENETDOWN
# endif
# ifndef ENETRESET
#  define ENETRESET WSAENETRESET
# endif
# ifndef ENETUNREACH
#  define ENETUNREACH WSAENETUNREACH
# endif
# ifndef ENOBUFS
#  define ENOBUFS WSAENOBUFS
# endif
# ifndef ENOPROTOOPT
#  define ENOPROTOOPT WSAENOPROTOOPT
# endif
# ifndef ENOTCONN
#  define ENOTCONN WSAENOTCONN
# endif
# ifndef ENOTSOCK
#  define ENOTSOCK WSAENOTSOCK
# endif
# ifndef EOPNOTSUPP
#  define EOPNOTSUPP WSAEOPNOTSUPP
# endif
# ifndef EPFNOSUPPORT
#  define EPFNOSUPPORT WSAEPFNOSUPPORT
# endif
# ifndef EPROCLIM
#  define EPROCLIM WSAEPROCLIM
# endif
# ifndef EPROTONOSUPPORT
#  define EPROTONOSUPPORT WSAEPROTONOSUPPORT
# endif
# ifndef EPROTOTYPE
#  define EPROTOTYPE WSAEPROTOTYPE
# endif
# ifndef EREMOTE
#  define EREMOTE WSAEREMOTE
# endif
# ifndef ESHUTDOWN
#  define ESHUTDOWN WSAESHUTDOWN
# endif
# ifndef ESOCKTNOSUPPORT
#  define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
# endif
# ifndef ESTALE
#  define ESTALE WSAESTALE
# endif
# ifndef ETIMEDOUT
#  define ETIMEDOUT WSAETIMEDOUT
# endif
# ifndef ETOOMANYREFS
#  define ETOOMANYREFS WSAETOOMANYREFS
# endif
# ifndef EUSERS
#  define EUSERS WSAEUSERS
# endif
# ifndef EWOULDBLOCK
#  define EWOULDBLOCK WSAEWOULDBLOCK
# endif
extern int of_wsaerr_to_errno(int);
#endif

/*!
 * @brief The base class for all exceptions in ObjFW
 *
 * The OFException class is the base class for all exceptions in ObjFW, except

Modified src/exceptions/OFException.m from [d1f66eef49] to [258c074e64].

90
91
92
93
94
95
96








97
98








99
100


101
102






103
104
105
106






107
108












109
110


























111
112
113
114
115
116
117
118
119
#if defined(_WIN32) && defined(OF_HAVE_SOCKETS)
int
of_wsaerr_to_errno(int wsaerr)
{
	switch (wsaerr) {
	case WSAEACCES:
		return EACCES;








	case WSAEBADF:
		return EBADF;








	case WSAEDISCON:
		return EPIPE;


	case WSAEFAULT:
		return EFAULT;






	case WSAEINTR:
		return EINTR;
	case WSAEINVAL:
		return EINVAL;






	case WSAENAMETOOLONG:
		return ENAMETOOLONG;












	case WSAENOTEMPTY:
		return ENOTEMPTY;


























	case WSAEWOULDBLOCK:
		return EAGAIN;
	default:
		return wsaerr;
	}
}
#endif

@implementation OFException







>
>
>
>
>
>
>
>


>
>
>
>
>
>
>
>


>
>


>
>
>
>
>
>




>
>
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#if defined(_WIN32) && defined(OF_HAVE_SOCKETS)
int
of_wsaerr_to_errno(int wsaerr)
{
	switch (wsaerr) {
	case WSAEACCES:
		return EACCES;
	case WSAEADDRINUSE:
		return EADDRINUSE;
	case WSAEADDRNOTAVAIL:
		return EADDRNOTAVAIL;
	case WSAEAFNOSUPPORT:
		return EAFNOSUPPORT;
	case WSAEALREADY:
		return EALREADY;
	case WSAEBADF:
		return EBADF;
	case WSAECONNABORTED:
		return ECONNABORTED;
	case WSAECONNREFUSED:
		return ECONNREFUSED;
	case WSAECONNRESET:
		return ECONNRESET;
	case WSAEDESTADDRREQ:
		return EDESTADDRREQ;
	case WSAEDISCON:
		return EPIPE;
	case WSAEDQUOT:
		return EDQUOT;
	case WSAEFAULT:
		return EFAULT;
	case WSAEHOSTDOWN:
		return EHOSTDOWN;
	case WSAEHOSTUNREACH:
		return EHOSTUNREACH;
	case WSAEINPROGRESS:
		return EINPROGRESS;
	case WSAEINTR:
		return EINTR;
	case WSAEINVAL:
		return EINVAL;
	case WSAEISCONN:
		return EISCONN;
	case WSAELOOP:
		return ELOOP;
	case WSAEMSGSIZE:
		return EMSGSIZE;
	case WSAENAMETOOLONG:
		return ENAMETOOLONG;
	case WSAENETDOWN:
		return ENETDOWN;
	case WSAENETRESET:
		return ENETRESET;
	case WSAENETUNREACH:
		return ENETUNREACH;
	case WSAENOBUFS:
		return ENOBUFS;
	case WSAENOPROTOOPT:
		return ENOPROTOOPT;
	case WSAENOTCONN:
		return ENOTCONN;
	case WSAENOTEMPTY:
		return ENOTEMPTY;
	case WSAENOTSOCK:
		return ENOTSOCK;
	case WSAEOPNOTSUPP:
		return EOPNOTSUPP;
	case WSAEPFNOSUPPORT:
		return EPFNOSUPPORT;
	case WSAEPROCLIM:
		return EPROCLIM;
	case WSAEPROTONOSUPPORT:
		return EPROTONOSUPPORT;
	case WSAEPROTOTYPE:
		return EPROTOTYPE;
	case WSAEREMOTE:
		return EREMOTE;
	case WSAESHUTDOWN:
		return ESHUTDOWN;
	case WSAESOCKTNOSUPPORT:
		return ESOCKTNOSUPPORT;
	case WSAESTALE:
		return ESTALE;
	case WSAETIMEDOUT:
		return ETIMEDOUT;
	case WSAETOOMANYREFS:
		return ETOOMANYREFS;
	case WSAEUSERS:
		return EUSERS;
	case WSAEWOULDBLOCK:
		return EWOULDBLOCK;
	default:
		return wsaerr;
	}
}
#endif

@implementation OFException

Modified src/socket.h from [ef3d903192] to [dd03cd91b5].

23
24
25
26
27
28
29

30
31
32
33
34
35
36
#include <stdbool.h>

#ifdef OF_HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif

#ifdef _WIN32

# include <windows.h>
# include <ws2tcpip.h>
#endif

#ifdef __wii__
# define BOOL OGC_BOOL
# include <network.h>







>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdbool.h>

#ifdef OF_HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif

#ifdef _WIN32
# include <winsock2.h>
# include <windows.h>
# include <ws2tcpip.h>
#endif

#ifdef __wii__
# define BOOL OGC_BOOL
# include <network.h>

Modified src/threading.h from [23ee43131c] to [682651858d].

30
31
32
33
34
35
36








37
38
39
40
41
42
43
#if defined(OF_HAVE_PTHREADS)
# include <pthread.h>
typedef pthread_t of_thread_t;
typedef pthread_key_t of_tlskey_t;
typedef pthread_mutex_t of_mutex_t;
typedef pthread_cond_t of_condition_t;
#elif defined(_WIN32)








# include <windows.h>
typedef HANDLE of_thread_t;
typedef DWORD of_tlskey_t;
typedef CRITICAL_SECTION of_mutex_t;
typedef struct {
	HANDLE event;
	int count;







>
>
>
>
>
>
>
>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#if defined(OF_HAVE_PTHREADS)
# include <pthread.h>
typedef pthread_t of_thread_t;
typedef pthread_key_t of_tlskey_t;
typedef pthread_mutex_t of_mutex_t;
typedef pthread_cond_t of_condition_t;
#elif defined(_WIN32)
/*
 * winsock2.h needs to be included before windows.h. Not including it here
 * would make it impossible to use sockets after threading.h has been
 * imported.
 */
# ifdef OF_HAVE_SOCKETS
#  include <winsock2.h>
# endif
# include <windows.h>
typedef HANDLE of_thread_t;
typedef DWORD of_tlskey_t;
typedef CRITICAL_SECTION of_mutex_t;
typedef struct {
	HANDLE event;
	int count;