ObjFW  Check-in [13a4dee1da]

Overview
Comment:A few win32 fixes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 13a4dee1da163e87f85ef6831418e8b4fc8061696892766499610bc3ac4ad03d
User & Date: js on 2011-03-30 00:03:18
Other Links: manifest | tags
Context
2011-03-30
00:36
OFHTTPRequest: Disallow redirects from HTTPS to HTTP by default.
Still works when setting redirectsFromHTTPSToHTTPAllowed.
check-in: 46881c3773 user: js tags: trunk
00:03
A few win32 fixes. check-in: 13a4dee1da user: js tags: trunk
2011-03-29
23:32
Fix missing include in exceptions/common.h. check-in: 48c67b1444 user: js tags: trunk
Changes

Modified configure.ac from [18edb13d66] to [1fffbc5f80].

380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
	AC_DEFINE(OF_ATOMIC_OPS, 1, [Whether we have atomic operations])
	AC_SUBST(ATOMIC_H, "atomic.h")
])
AC_MSG_RESULT($atomic_ops)

AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
AC_CHECK_LIB(network, socket, LIBS="$LIBS -lnetwork")
AC_CHECK_LIB(ws2_32, socket, LIBS="$LIBS -lws2_32")

AC_CHECK_FUNC(gmtime_r, [
	AC_DEFINE(HAVE_GMTIME_R, 1, [Whether we have gmtime_r])
])
AC_CHECK_FUNC(localtime_r, [
	AC_DEFINE(HAVE_LOCALTIME_R, 1, [Whether we have localtime_r])
])







|







380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
	AC_DEFINE(OF_ATOMIC_OPS, 1, [Whether we have atomic operations])
	AC_SUBST(ATOMIC_H, "atomic.h")
])
AC_MSG_RESULT($atomic_ops)

AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
AC_CHECK_LIB(network, socket, LIBS="$LIBS -lnetwork")
AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32")

AC_CHECK_FUNC(gmtime_r, [
	AC_DEFINE(HAVE_GMTIME_R, 1, [Whether we have gmtime_r])
])
AC_CHECK_FUNC(localtime_r, [
	AC_DEFINE(HAVE_LOCALTIME_R, 1, [Whether we have localtime_r])
])

Modified src/OFStreamObserver.h from [e29e85d1f8] to [7555d40ac1].

81
82
83
84
85
86
87

88



89
90
91
92
93
94
95
#ifdef OF_HAVE_POLL
	OFDataArray *fds;
	OFMutableDictionary *fdToStream;
#else
	fd_set readfds;
	fd_set writefds;
	fd_set exceptfds;

	nfds_t nfds;



#endif
}

#ifdef OF_HAVE_PROPERTIES
@property (retain) id <OFStreamObserverDelegate> delegate;
#endif








>

>
>
>







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifdef OF_HAVE_POLL
	OFDataArray *fds;
	OFMutableDictionary *fdToStream;
#else
	fd_set readfds;
	fd_set writefds;
	fd_set exceptfds;
# ifndef _WIN32
	nfds_t nfds;
# else
	int nfds;
# endif
#endif
}

#ifdef OF_HAVE_PROPERTIES
@property (retain) id <OFStreamObserverDelegate> delegate;
#endif

Modified src/OFStreamSocket.m from [24f92d1402] to [2a532fea1c].

23
24
25
26
27
28
29

30
31

32
33
34
35
36
37
38
#ifndef _WIN32
# include <sys/types.h>
# include <sys/socket.h>
#endif

#import "OFStreamSocket.h"


#import "OFNotConnectedException.h"
#import "OFReadFailedException.h"

#import "OFWriteFailedException.h"

#ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
#endif

#ifdef _WIN32







>


>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef _WIN32
# include <sys/types.h>
# include <sys/socket.h>
#endif

#import "OFStreamSocket.h"

#import "OFInitializationFailedException.h"
#import "OFNotConnectedException.h"
#import "OFReadFailedException.h"
#import "OFSetOptionFailedException.h"
#import "OFWriteFailedException.h"

#ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
#endif

#ifdef _WIN32
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
- (void)setBlocking: (BOOL)enable
{
	u_long v = enable;
	isBlocking = enable;

	if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR)
		@throw [OFSetOptionFailedException newWithClass: isa
							 stream: stream];
}
#endif

- (int)fileDescriptor
{
	return sock;
}







|







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
- (void)setBlocking: (BOOL)enable
{
	u_long v = enable;
	isBlocking = enable;

	if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR)
		@throw [OFSetOptionFailedException newWithClass: isa
							 stream: self];
}
#endif

- (int)fileDescriptor
{
	return sock;
}

Modified src/OFString.m from [bb07f5cc36] to [0f0b8d53a9].

1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
#endif
			return [OFString stringWithCString: string
						    length: i];

#ifndef _WIN32
	if (string[0] == OF_PATH_DELIM)
#else
	if (path_c[i] == '/' || path_c[i] == '\\')
#endif
		return [OFString stringWithCString: string
					    length: 1];

	return @".";
}








|







1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
#endif
			return [OFString stringWithCString: string
						    length: i];

#ifndef _WIN32
	if (string[0] == OF_PATH_DELIM)
#else
	if (string[i] == '/' || string[i] == '\\')
#endif
		return [OFString stringWithCString: string
					    length: 1];

	return @".";
}