ObjFW  Check-in [1d6a89a772]

Overview
Comment:Merge changes into 0.4 branch.

Changesets:
* 67f56a9b2701
* e93dc7881ac2
* 39cee2729741
* e3ae6cbe1a1d
* e60e7e4639b4
* d9ef36b4546b
* 4c582ed164a4
* 51f21db0e6e1
* 3da138c08f0b
* 2972e6711adc
* 1702fb32d80a
* 3ed63a403236
* a20f977e123d
* f567f4aeef62
* 09f1e3e3c19a
* d141b8e84772
* 5a56c5392288
* 1690e3a42d1c
* 82b11d582d4e
* e7d95ae95836
* 3b7d2b31079d
* b42a0f893345
* a3e7c9bc7fb6

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 0.4
Files: files | file ages | folders
SHA3-256: 1d6a89a77251efc5de55ef15929ee755eaea6a695799245c8ff3f846d4cc896d
User & Date: js on 2011-01-23 01:07:38
Other Links: branch diff | manifest | tags
Context
2011-05-02
00:51
Close 0.4 branch. Closed-Leaf check-in: 58271e4029 user: js tags: 0.4
2011-01-23
01:07
Merge changes into 0.4 branch. check-in: 1d6a89a772 user: js tags: 0.4
2011-01-03
21:51
Update ChangeLog for 0.4-alpha1. check-in: 253d5f1043 user: js tags: 0.4, 0.4-alpha1
Changes

Modified ChangeLog from [f70c6798b5] to [0897229476].

1
2
3
4



























5
6
7
8
9
10
11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38




+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







Legend:
 * Changes of existing features or bugfixes.
 + New features.

ObjFW 0.4-alpha1 -> 0.4-alpha2, XX.XX.2011
 * Fixed a nasty typo in OFDate that could lead to date differences being wrong
   about a second.
 * Possible SIGPIPEs are now ignored when using OFStream.
 * Documentation fixes.
 * Replaced -[sleepForNMilliseconds:] with
   -[sleepForTimeInterval:microseconds:].
 + Added +[sleepUntilDate] to OFDate.
 * Some systems don't allow usleep for values > 1000000, so we use sleep and
   usleep sequentially now to sleep the correct time.
 + Family is now autodetected in -[bindService:onNode:].
 * -[writeLine:] does not send two packets anymore.
 + -framework is now allowed in ObjFW compile.
 * errNo of socket related exceptions is now correctly set to ENOTCONN on Win32.
 * Fixed missing retain + autorelease in TLS-object handling.
 * Renamed +[tlsKey] to +[TLSKey] to conform to the convention.
 * Added missing files to .xcodeproj.
 * Got rid of a few useless #ifdefs.
 * Fixed a missing include (about which for some strange reason only clang
   complains).
 + Added + as a prefix in -[OFString decimalValue].
 * enums are now defined using typedef.
 * Updated the buildsys, fixes make install when only building a static library.
 * Made OFBlocks compile with ObjFW-RT.
 + Added +[thread] to OFThread and allow -[init].
 * Removed useless variables from objfw-compile.

ObjFW 0.3.1 -> 0.4-alpha1, 03.01.2011
 * ObjFW is now available under the terms of the QPL, GPLv2 and GPLv3.
 + Support for blocks was added, including a blocks runtime.
 + Added support for the new GNU runtime, introduced in GCC 4.6.
 * Objects returned from collections are no longer retained and autoreleased.
 + Added new classes OFXMLParser, OFXMLElement, OFXMLAttribute and
   OFXMLElementBuilder.

Modified ObjFW.xcodeproj/project.pbxproj from [fddeda06ea] to [9b445ea901].

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
138
139
140
141
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
138
139







-
+






-
+






-
+






-
+


















-
-







			remoteGlobalIDString = 4B5D8DE91099E1F1000896FF;
			remoteInfo = configure;
		};
		4BD86D711237A65E00ED9912 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 4BD86D4C1237A58400ED9912 /* libobjfw */;
			remoteGlobalIDString = 4BD86D4C1237A58400ED9912;
			remoteInfo = libobjfw;
		};
		4BD86D731237A66300ED9912 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 4BD86D4C1237A58400ED9912 /* libobjfw */;
			remoteGlobalIDString = 4BD86D4C1237A58400ED9912;
			remoteInfo = libobjfw;
		};
		4BD86D751237A66600ED9912 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 4B08AE9E109AE10E00989F6E /* Framework */;
			remoteGlobalIDString = 4B08AE9E109AE10E00989F6E;
			remoteInfo = Framework;
		};
		4BD86D771237A66D00ED9912 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 4BD86D6E1237A65300ED9912 /* Tests */;
			remoteGlobalIDString = 4BD86D6E1237A65300ED9912;
			remoteInfo = Tests;
		};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
		4B0108C910EB8C9300631877 /* OFEnumerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFEnumerator.h; path = src/OFEnumerator.h; sourceTree = "<group>"; };
		4B0108CA10EB8C9300631877 /* OFEnumerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFEnumerator.m; path = src/OFEnumerator.m; sourceTree = "<group>"; };
		4B0D249411DFAA3D00ED6FFC /* OFXMLElementBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFXMLElementBuilder.h; path = src/OFXMLElementBuilder.h; sourceTree = "<group>"; };
		4B0D249511DFAA3D00ED6FFC /* OFXMLElementBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFXMLElementBuilder.m; path = src/OFXMLElementBuilder.m; sourceTree = "<group>"; };
		4B175C1D116D130B003C99CB /* OFApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFApplication.h; path = src/OFApplication.h; sourceTree = "<group>"; };
		4B175C1E116D130B003C99CB /* OFApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFApplication.m; path = src/OFApplication.m; sourceTree = "<group>"; };
		4B4986DF1101F64500A2CFDA /* objc_properties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = objc_properties.m; path = src/objc_properties.m; sourceTree = "<group>"; };
		4B6799561099E7C50041064A /* asprintf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = asprintf.h; path = src/asprintf.h; sourceTree = "<group>"; };
		4B6799581099E7C50041064A /* objc_sync.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = objc_sync.m; path = src/objc_sync.m; sourceTree = "<group>"; };
		4B67995A1099E7C50041064A /* OFArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFArray.h; path = src/OFArray.h; sourceTree = "<group>"; };
		4B67995B1099E7C50041064A /* OFArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFArray.m; path = src/OFArray.m; sourceTree = "<group>"; };
		4B67995C1099E7C50041064A /* OFAutoreleasePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFAutoreleasePool.h; path = src/OFAutoreleasePool.h; sourceTree = "<group>"; };
		4B67995D1099E7C50041064A /* OFAutoreleasePool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFAutoreleasePool.m; path = src/OFAutoreleasePool.m; sourceTree = "<group>"; };
		4B67995E1099E7C50041064A /* OFConstString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFConstString.h; path = src/OFConstString.h; sourceTree = "<group>"; };
		4B67995F1099E7C50041064A /* OFConstString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFConstString.m; path = src/OFConstString.m; sourceTree = "<group>"; };
		4B6799601099E7C50041064A /* OFDataArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFDataArray.h; path = src/OFDataArray.h; sourceTree = "<group>"; };
		4B6799611099E7C50041064A /* OFDataArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFDataArray.m; path = src/OFDataArray.m; sourceTree = "<group>"; };
		4B6799621099E7C50041064A /* OFDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFDictionary.h; path = src/OFDictionary.h; sourceTree = "<group>"; };
		4B6799631099E7C50041064A /* OFDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFDictionary.m; path = src/OFDictionary.m; sourceTree = "<group>"; };
		4B6799641099E7C50041064A /* OFExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFExceptions.h; path = src/OFExceptions.h; sourceTree = "<group>"; };
		4B6799651099E7C50041064A /* OFExceptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFExceptions.m; path = src/OFExceptions.m; sourceTree = "<group>"; };
		4B6799661099E7C50041064A /* OFFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFFile.h; path = src/OFFile.h; sourceTree = "<group>"; };
201
202
203
204
205
206
207






208
209
210
211
212
213
214
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218







+
+
+
+
+
+







		4BAF5F48123460C900F4E111 /* OFStreamObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFStreamObserver.m; path = src/OFStreamObserver.m; sourceTree = "<group>"; };
		4BAF5F49123460C900F4E111 /* OFStreamSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFStreamSocket.h; path = src/OFStreamSocket.h; sourceTree = "<group>"; };
		4BAF5F4A123460C900F4E111 /* OFStreamSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFStreamSocket.m; path = src/OFStreamSocket.m; sourceTree = "<group>"; };
		4BBA36C411406AB700CBA3AC /* atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atomic.h; path = src/atomic.h; sourceTree = "<group>"; };
		4BBA36C511406AB700CBA3AC /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macros.h; path = src/macros.h; sourceTree = "<group>"; };
		4BD86D801237A6C600ED9912 /* OFBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFBlock.h; path = src/OFBlock.h; sourceTree = SOURCE_ROOT; };
		4BD86D811237A6C600ED9912 /* OFBlock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFBlock.m; path = src/OFBlock.m; sourceTree = SOURCE_ROOT; };
		4BE5F0D712DF4225005C7A0C /* OFConstantString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFConstantString.h; path = src/OFConstantString.h; sourceTree = SOURCE_ROOT; };
		4BE5F0D812DF4225005C7A0C /* OFConstantString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFConstantString.m; path = src/OFConstantString.m; sourceTree = SOURCE_ROOT; };
		4BE5F0D912DF4225005C7A0C /* OFDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFDate.h; path = src/OFDate.h; sourceTree = SOURCE_ROOT; };
		4BE5F0DA12DF4225005C7A0C /* OFDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFDate.m; path = src/OFDate.m; sourceTree = SOURCE_ROOT; };
		4BE5F0E412DF4259005C7A0C /* OFBlockTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFBlockTests.m; path = tests/OFBlockTests.m; sourceTree = SOURCE_ROOT; };
		4BE5F0E512DF4259005C7A0C /* OFDateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFDateTests.m; path = tests/OFDateTests.m; sourceTree = SOURCE_ROOT; };
		4BF1BCBF11C9663F0025511F /* objfw-defs.h.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "objfw-defs.h.in"; path = "src/objfw-defs.h.in"; sourceTree = "<group>"; };
		4BF1BCC011C9663F0025511F /* OFHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFHash.h; path = src/OFHash.h; sourceTree = "<group>"; };
		4BF1BCC111C9663F0025511F /* OFHash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFHash.m; path = src/OFHash.m; sourceTree = "<group>"; };
		4BF1BCC211C9663F0025511F /* OFMD5Hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFMD5Hash.h; path = src/OFMD5Hash.h; sourceTree = "<group>"; };
		4BF1BCC311C9663F0025511F /* OFMD5Hash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFMD5Hash.m; path = src/OFMD5Hash.m; sourceTree = "<group>"; };
		4BF1BCC411C9663F0025511F /* OFSHA1Hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFSHA1Hash.h; path = src/OFSHA1Hash.h; sourceTree = "<group>"; };
		4BF1BCC511C9663F0025511F /* OFSHA1Hash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFSHA1Hash.m; path = src/OFSHA1Hash.m; sourceTree = "<group>"; };
243
244
245
246
247
248
249
250
251


252
253


254
255
256
257
258
259
260
247
248
249
250
251
252
253


254
255
256
257
258
259
260
261
262
263
264
265
266







-
-
+
+


+
+







				4B67995A1099E7C50041064A /* OFArray.h */,
				4B67995B1099E7C50041064A /* OFArray.m */,
				4B67995C1099E7C50041064A /* OFAutoreleasePool.h */,
				4B67995D1099E7C50041064A /* OFAutoreleasePool.m */,
				4BD86D801237A6C600ED9912 /* OFBlock.h */,
				4BD86D811237A6C600ED9912 /* OFBlock.m */,
				4BAF5F46123460C900F4E111 /* OFCollection.h */,
				4B67995E1099E7C50041064A /* OFConstString.h */,
				4B67995F1099E7C50041064A /* OFConstString.m */,
				4BE5F0D712DF4225005C7A0C /* OFConstantString.h */,
				4BE5F0D812DF4225005C7A0C /* OFConstantString.m */,
				4B6799601099E7C50041064A /* OFDataArray.h */,
				4B6799611099E7C50041064A /* OFDataArray.m */,
				4BE5F0D912DF4225005C7A0C /* OFDate.h */,
				4BE5F0DA12DF4225005C7A0C /* OFDate.m */,
				4B6799621099E7C50041064A /* OFDictionary.h */,
				4B6799631099E7C50041064A /* OFDictionary.m */,
				4B0108C910EB8C9300631877 /* OFEnumerator.h */,
				4B0108CA10EB8C9300631877 /* OFEnumerator.m */,
				4B6799641099E7C50041064A /* OFExceptions.h */,
				4B6799651099E7C50041064A /* OFExceptions.m */,
				4B6799661099E7C50041064A /* OFFile.h */,
328
329
330
331
332
333
334

335

336
337
338
339
340
341
342
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350







+

+







		};
		4B6EF66D123535480076B512 /* Tests */ = {
			isa = PBXGroup;
			children = (
				4B6EF6831235359D0076B512 /* Plugin */,
				4B6EF682123535960076B512 /* objc_sync */,
				4B6EF66E1235358D0076B512 /* OFArrayTests.m */,
				4BE5F0E412DF4259005C7A0C /* OFBlockTests.m */,
				4B6EF66F1235358D0076B512 /* OFDataArrayTests.m */,
				4BE5F0E512DF4259005C7A0C /* OFDateTests.m */,
				4B6EF6701235358D0076B512 /* OFDictionaryTests.m */,
				4B6EF6711235358D0076B512 /* OFFileTests.m */,
				4B6EF6721235358D0076B512 /* OFListTests.m */,
				4B6EF6731235358D0076B512 /* OFMD5HashTests.m */,
				4B6EF6741235358D0076B512 /* OFNumberTests.m */,
				4B6EF6751235358D0076B512 /* OFObjectTests.m */,
				4B6EF6761235358D0076B512 /* OFPluginTests.m */,
422
423
424
425
426
427
428

429






430
431
432
433
434
435
436
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451







+

+
+
+
+
+
+







/* End PBXLegacyTarget section */

/* Begin PBXProject section */
		08FB7793FE84155DC02AAC07 /* Project object */ = {
			isa = PBXProject;
			buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "ObjFW" */;
			compatibilityVersion = "Xcode 3.1";
			developmentRegion = English;
			hasScannedForEncodings = 1;
			knownRegions = (
				English,
				Japanese,
				French,
				German,
			);
			mainGroup = 08FB7794FE84155DC02AAC07 /* ObjFW */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				4BD86D601237A5B200ED9912 /* All */,
				4B5D8DDD1099E1B0000896FF /* autogen.sh */,
				4B5D8DE91099E1F1000896FF /* configure */,

Modified buildsys.mk.in from [291249d72c] to [4eb32fd7f2].

133
134
135
136
137
138
139
140

141
142
143
144
145
146
147
133
134
135
136
137
138
139

140
141
142
143
144
145
146
147







-
+







			${DEPEND_FAILED}; \
		fi; \
	fi

.c.c.dep .cc.cc.dep .cxx.cxx.dep .m.m.dep .mm.mm.dep .S.S.dep:
	${CPP} ${CPPFLAGS} -M $< | \
	sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.plugin.o:/' >$@ || \
	(rm -f $@; exit 1)
	{ rm -f $@; false; }

pre-depend:

${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS}
	${LINK_STATUS}
	if ${LD} -o $@ ${OBJS} ${LDFLAGS} ${LIBS}; then \
		${LINK_OK}; \
360
361
362
363
364
365
366
367

368
369
370
371
372
373
374
360
361
362
363
364
365
366

367
368
369
370
371
372
373
374







-
+







		${DIR_ENTER}; \
		${MAKE} ${MFLAGS} install || exit 1; \
		${DIR_LEAVE}; \
	done

	for i in ${LIB}; do \
		${INSTALL_STATUS}; \
		if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL_LIB}; then \
		if ${MKDIR_P} ${DESTDIR}${libdir} ${INSTALL_LIB}; then \
			${INSTALL_OK}; \
		else \
			${INSTALL_FAILED}; \
		fi \
	done

	for i in ${STATIC_LIB}; do \
441
442
443
444
445
446
447
448

449
450
451
452
453
454
455
441
442
443
444
445
446
447

448
449
450
451
452
453
454
455







-
+







		${DIR_ENTER}; \
		${MAKE} ${MFLAGS} uninstall || exit 1; \
		${DIR_LEAVE}; \
	done

	for i in ${LIB}; do \
		if test -f ${DESTDIR}${libdir}/$$i; then \
			if ${UNINSTALL_LIB}; then \
			if : ${UNINSTALL_LIB}; then \
				${DELETE_OK}; \
			else \
				${DELETE_FAILED}; \
			fi \
		fi; \
	done

Modified configure.ac from [568955531f] to [9f635f5862].

251
252
253
254
255
256
257
258

259
260
261
262
263
264
265
251
252
253
254
255
256
257

258
259
260
261
262
263
264
265







-
+








AC_ARG_ENABLE(threads,
	AS_HELP_STRING([--disable-threads], [disable thread support]))
AS_IF([test x"$enable_threads" != x"no"], [
	case "$host_os" in
	mingw*)
		AC_MSG_CHECKING(for threads)
		AC_MSG_RESULT(win32)
		AC_MSG_RESULT(WinAPI)
		;;
	*)
		ACX_PTHREAD([
			CPPLAGS="$CPPFLAGS $PTHREAD_CFLAGS"
			LIBS="$LIBS $PTHREAD_LIBS"
			AC_DEFINE(OF_HAVE_PTHREADS, 1,
				[Whether we have pthreads])

Modified m4/buildsys.m4 from [4956c740c5] to [96981d90bc].

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
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







-
-
+
+












-
-
+
+












-
-
+
+












-
-
+
+












-
-
+
+







			LIB_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}'
			LIB_PREFIX='lib'
			LIB_SUFFIX='.dylib'
			LDFLAGS_RPATH='-Wl,-rpath,${libdir}'
			PLUGIN_CFLAGS='-fPIC -DPIC'
			PLUGIN_LDFLAGS='-bundle -undefined dynamic_lookup'
			PLUGIN_SUFFIX='.impl'
			INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$$i'
			UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib'
			INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$$i'
			UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib'
			CLEAN_LIB=''
			;;
		solaris*)
			AC_MSG_RESULT(Solaris)
			LIB_CFLAGS='-fPIC -DPIC'
			LIB_LDFLAGS='-shared -Wl,-soname=${LIB}.${LIB_MAJOR}.${LIB_MINOR}'
			LIB_PREFIX='lib'
			LIB_SUFFIX='.so'
			LDFLAGS_RPATH='-Wl,-rpath,${libdir}'
			PLUGIN_CFLAGS='-fPIC -DPIC'
			PLUGIN_LDFLAGS='-shared'
			PLUGIN_SUFFIX='.so'
			INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR} && rm -f ${DESTDIR}${libdir}/$$i && ${LN_S} $$i.${LIB_MAJOR}.${LIB_MINOR} ${DESTDIR}${libdir}/$$i'
			UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}'
			INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR} && rm -f ${DESTDIR}${libdir}/$$i && ${LN_S} $$i.${LIB_MAJOR}.${LIB_MINOR} ${DESTDIR}${libdir}/$$i'
			UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}'
			CLEAN_LIB=''
			;;
		openbsd* | mirbsd*)
			AC_MSG_RESULT(OpenBSD)
			LIB_CFLAGS='-fPIC -DPIC'
			LIB_LDFLAGS='-shared'
			LIB_PREFIX='lib'
			LIB_SUFFIX='.so.${LIB_MAJOR}.${LIB_MINOR}'
			LDFLAGS_RPATH='-Wl,-rpath,${libdir}'
			PLUGIN_CFLAGS='-fPIC -DPIC'
			PLUGIN_LDFLAGS='-shared'
			PLUGIN_SUFFIX='.so'
			INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i'
			UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i'
			INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i'
			UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i'
			CLEAN_LIB=''
			;;
		cygwin* | mingw*)
			AC_MSG_RESULT(Win32)
			LIB_CFLAGS=''
			LIB_LDFLAGS='-shared -Wl,--out-implib,${LIB}.a'
			LIB_PREFIX='lib'
			LIB_SUFFIX='.dll'
			LDFLAGS_RPATH='-Wl,-rpath,${libdir}'
			PLUGIN_CFLAGS=''
			PLUGIN_LDFLAGS='-shared'
			PLUGIN_SUFFIX='.dll'
			INSTALL_LIB='${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i && ${INSTALL} -m 755 $$i.a ${DESTDIR}${libdir}/$$i.a'
			UNINSTALL_LIB='rm -f ${DESTDIR}${bindir}/$$i ${DESTDIR}${libdir}/$$i.a'
			INSTALL_LIB='&& ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i && ${INSTALL} -m 755 $$i.a ${DESTDIR}${libdir}/$$i.a'
			UNINSTALL_LIB='&& rm -f ${DESTDIR}${bindir}/$$i ${DESTDIR}${libdir}/$$i.a'
			CLEAN_LIB='${LIB}.a'
			;;
		*)
			AC_MSG_RESULT(GNU)
			LIB_CFLAGS='-fPIC -DPIC'
			LIB_LDFLAGS='-shared -Wl,-soname=${LIB}.${LIB_MAJOR}'
			LIB_PREFIX='lib'
			LIB_SUFFIX='.so'
			LDFLAGS_RPATH='-Wl,-rpath,${libdir}'
			PLUGIN_CFLAGS='-fPIC -DPIC'
			PLUGIN_LDFLAGS='-shared'
			PLUGIN_SUFFIX='.so'
			INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0 && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i'
			UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0'
			INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0 && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i'
			UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0'
			CLEAN_LIB=''
			;;
	esac

	AC_SUBST(LIB_CFLAGS)
	AC_SUBST(LIB_LDFLAGS)
	AC_SUBST(LIB_PREFIX)

Modified src/OFBlock.m from [3f030b240f] to [1de0172b54].

57
58
59
60
61
62
63


64
65
66
67

68
69
70
71
72
73
74
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77







+
+




+







	unsigned long version, info, instance_size;
	void *ivars, *methodlist, *dtable, *subclass_list, *sibling_class;
	void *protocols, *gc_object_type;
	long abi_version;
	void *ivar_offsets, *properties;
};

#ifndef OF_OBJFW_RUNTIME
/* ObjFW-RT already defines those */
enum objc_abi_class_info {
	OBJC_CLASS_INFO_CLASS	  = 0x01,
	OBJC_CLASS_INFO_METACLASS = 0x02
};
#endif

extern void __objc_exec_class(void*);

/* Begin of ObjC module */
static struct objc_abi_metaclass _NSConcreteStackBlock_metaclass = {
	"OFBlock", "OFBlock", "OFStackBlock", 8, OBJC_CLASS_INFO_METACLASS,
	sizeof(struct objc_class), NULL, NULL
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
180
181
182
183
184
185
186

187
188
189


190


191

192
193
194
195
196
197
198







-



-
-

-
-

-







		return copy;
	}

	if (block->isa == (Class)&_NSConcreteMallocBlock) {
#if defined(OF_ATOMIC_OPS)
		of_atomic_inc_int(&block->flags);
#else
# ifdef OF_THREADS
		unsigned hash = SPINLOCK_HASH(block);

		assert(of_spinlock_lock(&spinlocks[hash]));
# endif

		block->flags++;

# ifdef OF_THREADS
		assert(of_spinlock_unlock(&spinlocks[hash]));
# endif
#endif
	}

	return block;
}

void
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
207
208
209
210
211
212
213

214
215
216


217

218

219
220
221
222
223
224


225

226
227
228
229
230
231
232







-



-
-

-

-






-
-

-







	if ((of_atomic_dec_int(&block->flags) & OF_BLOCK_REFCOUNT_MASK) == 0) {
		if (block->flags & OF_BLOCK_HAS_COPY_DISPOSE)
			block->descriptor->dispose_helper(block);

		free(block);
	}
#else
# ifdef OF_THREADS
	unsigned hash = SPINLOCK_HASH(block);

	assert(of_spinlock_lock(&spinlocks[hash]));
# endif

	if ((--block->flags & OF_BLOCK_REFCOUNT_MASK) == 0) {
# ifdef OF_THREADS
		assert(of_spinlock_unlock(&spinlocks[hash]));
# endif

		if (block->flags & OF_BLOCK_HAS_COPY_DISPOSE)
			block->descriptor->dispose_helper(block);

		free(block);
	}

# ifdef OF_THREADS
	assert(of_spinlock_unlock(&spinlocks[hash]));
# endif
#endif
}

void
_Block_object_assign(void *dst_, const void *src_, const int flags_)
{
	int flags = flags_ & (OF_BLOCK_FIELD_IS_BLOCK |
331
332
333
334
335
336
337
338

339
340
341
342
343
344
345
320
321
322
323
324
325
326

327
328
329
330
331
332
333
334







-
+







		@throw [OFInitializationFailedException newWithClass: self];
	memcpy(&_NSConcreteMallocBlock, tmp, sizeof(_NSConcreteMallocBlock));
	free(tmp);
	objc_registerClassPair((Class)&_NSConcreteMallocBlock);
}
#endif

#if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS)
#if !defined(OF_ATOMIC_OPS)
+ (void)initialize
{
	size_t i;

	for (i = 0; i < NUM_SPINLOCKS; i++)
		if (!of_spinlock_new(&spinlocks[i]))
			@throw [OFInitializationFailedException

Modified src/OFConstantString.m from [e612866855] to [5e08953a1a].

49
50
51
52
53
54
55
56

57
58
59
60
61
62
63

64
65
66
67
68
69
70
49
50
51
52
53
54
55

56
57
58
59
60
61
62

63
64
65
66
67
68
69
70







-
+






-
+







- initWithCString: (const char*)str
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding;
	 encoding: (of_string_encoding_t)encoding;
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding
	 encoding: (of_string_encoding_t)encoding
	   length: (size_t)len
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str

Modified src/OFDataArray.m from [142cc7b552] to [b8580a2b5b].

205
206
207
208
209
210
211
212

213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

233
234
235
236
237
238
239
205
206
207
208
209
210
211

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231

232
233
234
235
236
237
238
239







-
+



















-
+







	count -= nitems;
	@try {
		data = [self resizeMemory: data
				 toNItems: count
				 withSize: itemSize];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- (void)removeNItems: (size_t)nitems
	     atIndex: (size_t)index
{
	if (nitems > count)
		@throw [OFOutOfRangeException newWithClass: isa];

	memmove(data + index * itemSize, data + (index + nitems) * itemSize,
	    (count - index - nitems) * itemSize);

	count -= nitems;
	@try {
		data = [self resizeMemory: data
				 toNItems: count
				 withSize: itemSize];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- copy
{
	OFDataArray *new = [[OFDataArray alloc] initWithItemSize: itemSize];
	[new addNItems: count

Modified src/OFDate.h from [49341feeb2] to [4848b2e679].

220
221
222
223
224
225
226
227

228
229
230
231
232

233
234
235
236
237
238
239
220
221
222
223
224
225
226

227
228
229
230
231

232
233
234
235
236
237
238
239







-
+




-
+








/**
 * \return The microseconds part of the seconds since 1970-01-01T00:00:00Z
 */
- (uint32_t)microsecondsOfTimeIntervalSince1970;

/**
 * \return The seconds the date is after the receiver
 * \return The seconds the receiver is after the date.
 */
- (int64_t)timeIntervalSinceDate: (OFDate*)date;

/**
 * \return The microseconds part of the seconds the date is after the receiver
 * \return The microseconds part of the seconds the receiver is after the date
 */
- (uint32_t)microsecondsOfTimeIntervalSinceDate: (OFDate*)date;

/**
 * Returns a new date with the specified time interval added.
 *
 * \param sec The seconds after the date

Modified src/OFDate.m from [31a8bddc6c] to [d1491b40fa].

461
462
463
464
465
466
467
468

469
470
471
472
473
474
475
476
477
478
479
480
481
482
483

484
485
486
487
488
489
490
461
462
463
464
465
466
467

468
469
470
471
472
473
474
475
476
477
478
479
480
481
482

483
484
485
486
487
488
489
490







-
+














-
+







	int32_t usec_ = (int32_t)usec - date->usec;

	while (usec_ > 999999) {
		usec_ -= 1000000;
		sec_++;
	}

	while (usec < 0) {
	while (usec_ < 0) {
		usec_ += 1000000;
		sec_--;
	}

	return sec_;
}

- (uint32_t)microsecondsOfTimeIntervalSinceDate: (OFDate*)date
{
	int32_t usec_ = (int32_t)usec - date->usec;

	while (usec_ > 999999)
		usec_ -= 1000000;

	while (usec < 0)
	while (usec_ < 0)
		usec_ += 1000000;

	return usec_;
}

- (OFDate*)dateByAddingTimeInterval: (int64_t)sec_
{

Modified src/OFExceptions.h from [4c46e6fa5d] to [78d3a5daf4].

324
325
326
327
328
329
330

331
332
333
334
335
336
337
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338







+








/**
 * \brief An exception indicating a read or write to a stream failed.
 */
@interface OFReadOrWriteFailedException: OFException
{
	size_t requestedSize;
@public
	int    errNo;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) size_t requestedSize;
@property (readonly) int errNo;
#endif
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065

1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079

1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1039
1040
1041
1042
1043
1044
1045

1046
1047
1048
1049
1050
1051

1052
1053
1054
1055
1056
1057
1058

1059
1060
1061
1062

1063

1064
1065
1066
1067
1068
1069
1070

1071
1072
1073
1074

1075

1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090





1091
1092
1093
1094
1095
1096
1097







-






-







-




-
+
-







-




-
+
-















-
-
-
-
-







/**
 * \brief An exception indicating that binding a socket failed.
 */
@interface OFBindFailedException: OFException
{
	OFString *node;
	OFString *service;
	int	 family;
	int	 errNo;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, nonatomic) OFString *node;
@property (readonly, nonatomic) OFString *service;
@property (readonly) int family;
@property (readonly) int errNo;
#endif

/**
 * \param class_ The class of the object which caused the exception
 * \param node The node on which binding failed
 * \param service The service on which binding failed
 * \param family The family for which binnding failed
 * \return A new bind failed exception
 */
+ newWithClass: (Class)class_
	  node: (OFString*)node
       service: (OFString*)service
       service: (OFString*)service;
	family: (int)family;

/**
 * Initializes an already allocated bind failed exception.
 *
 * \param class_ The class of the object which caused the exception
 * \param node The node on which binding failed
 * \param service The service on which binding failed
 * \param family The family for which binnding failed
 * \return An initialized bind failed exception
 */
- initWithClass: (Class)class_
	   node: (OFString*)node
	service: (OFString*)service
	service: (OFString*)service;
	 family: (int)family;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

/**
 * \return The node on which binding failed
 */
- (OFString*)node;

/**
 * \return The service on which binding failed
 */
- (OFString*)service;

/**
 * \return The family for which binding failed
 */
- (int)family;
@end

/**
 * \brief An exception indicating that listening on the socket failed.
 */
@interface OFListenFailedException: OFException
{

Modified src/OFExceptions.m from [537ffd5aae] to [f691692ed4].

1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528

1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1517
1518
1519
1520
1521
1522
1523

1524
1525
1526

1527

1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540

1541
1542
1543
1544
1545
1546

1547
1548
1549
1550
1551
1552
1553







-



-
+
-













-






-







}
@end

@implementation OFBindFailedException
+ newWithClass: (Class)class_
	  node: (OFString*)node
       service: (OFString*)service
	family: (int)family
{
	return [[self alloc] initWithClass: class_
				      node: node
				   service: service
				   service: service];
				    family: family];
}

- initWithClass: (Class)class_
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException newWithClass: c
					      selector: _cmd];
}

- initWithClass: (Class)class_
	   node: (OFString*)node_
	service: (OFString*)service_
	 family: (int)family_
{
	self = [super initWithClass: class_];

	@try {
		node	= [node_ copy];
		service	= [service_ copy];
		family	= family_;
		errNo	= GET_SOCK_ERRNO;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576



1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1563
1564
1565
1566
1567
1568
1569



1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590





1591
1592
1593
1594
1595
1596
1597







-
-
-
+
+
+


















-
-
-
-
-








- (OFString*)description
{
	if (description != nil)
		return description;

	description = [[OFString alloc] initWithFormat:
	    @"Binding service %s on node %s using family %d failed in class "
	    @"%s! " ERRFMT, [service cString], [node cString], family,
	    class_getName(inClass), ERRPARAM];
	    @"Binding service %s on node %s failed in class %s! " ERRFMT,
	    [service cString], [node cString], class_getName(inClass),
	    ERRPARAM];

	return description;
}

- (int)errNo
{
	return errNo;
}

- (OFString*)node
{
	return node;
}

- (OFString*)service
{
	return service;
}

- (int)family
{
	return family;
}
@end

@implementation OFListenFailedException
+ newWithClass: (Class)class_
       backLog: (int)backlog
{
	return [[self alloc] initWithClass: class_

Modified src/OFMutableString.m from [353370f742] to [8301473e4d].

401
402
403
404
405
406
407
408

409
410
411
412
413
414
415
401
402
403
404
405
406
407

408
409
410
411
412
413
414
415







-
+







	string[length] = 0;

	@try {
		string = [self resizeMemory: string
				     toSize: length + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- (void)removeCharactersInRange: (of_range_t)range
{
	[self removeCharactersFromIndex: range.start
				toIndex: range.start + range.length];
518
519
520
521
522
523
524
525

526
527
528
529
530
531
532
518
519
520
521
522
523
524

525
526
527
528
529
530
531
532







-
+







	string[length] = '\0';

	@try {
		string = [self resizeMemory: string
				     toSize: length + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- (void)removeTrailingWhitespaces
{
	size_t d;
	char *p;
543
544
545
546
547
548
549
550

551
552
553
554
555
556
557
543
544
545
546
547
548
549

550
551
552
553
554
555
556
557







-
+







	length -= d;

	@try {
		string = [self resizeMemory: string
				     toSize: length + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- (void)removeLeadingAndTrailingWhitespaces
{
	size_t d, i;
	char *p;
577
578
579
580
581
582
583
584

585
586
587
588
589
590
591
592
577
578
579
580
581
582
583

584
585
586
587
588
589
590
591
592







-
+








	string[length] = '\0';

	@try {
		string = [self resizeMemory: string
				     toSize: length + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- copy
{
	return [[OFString alloc] initWithString: self];
}
@end

Modified src/OFNumber.h from [14ca51589b] to [914f43516c].

14
15
16
17
18
19
20



21

22
23
24
25
26
27
28
14
15
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31







+
+
+
-
+







 * file.
 */

#include <unistd.h>

#import "OFObject.h"

/**
 * \brief The type of a number.
 */
enum of_number_type {
typedef enum of_number_type_t {
	OF_NUMBER_BOOL,
	OF_NUMBER_CHAR,
	OF_NUMBER_SHORT,
	OF_NUMBER_INT,
	OF_NUMBER_LONG,
	OF_NUMBER_UCHAR,
	OF_NUMBER_USHORT,
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58







-
+







	OF_NUMBER_INTMAX,
	OF_NUMBER_UINTMAX,
	OF_NUMBER_PTRDIFF,
	OF_NUMBER_INTPTR,
	OF_NUMBER_UINTPTR,
	OF_NUMBER_FLOAT,
	OF_NUMBER_DOUBLE,
};
} of_number_type_t;

/**
 * \brief Provides a way to store a number in an object.
 */
@interface OFNumber: OFObject <OFCopying>
{
	union {
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
79
80
81
82
83
84
85

86
87
88
89
90
91
92
93







-
+







		uintmax_t      uintmax;
		ptrdiff_t      ptrdiff;
		intptr_t       intptr;
		uintptr_t      uintptr;
		float	       float_;
		double	       double_;
	} value;
	enum of_number_type type;
	of_number_type_t type;
}

/**
 * \param bool_ A BOOL which the OFNumber should contain
 * \return A new autoreleased OFNumber
 */
+ numberWithBool: (BOOL)bool_;
444
445
446
447
448
449
450
451

452
453
454

455
456
457
458
459
460
461
447
448
449
450
451
452
453

454

455

456
457
458
459
460
461
462
463







-
+
-

-
+







 *
 * \param double_ A double which the OFNumber should contain
 * \return An initialized OFNumber
 */
- initWithDouble: (double)double_;

/**
 * \return An enum of type of_number_type indicating the type of contained
 * \return An of_number_type_t indicating the type of the number
 *	   number of the OFNumber
 */
- (enum of_number_type)type;
- (of_number_type_t)type;

/**
 * \return The OFNumber as a BOOL
 */
- (BOOL)boolValue;

/**

Modified src/OFNumber.m from [9b41925c57] to [8d4f8ec1f8].

698
699
700
701
702
703
704
705

706
707
708
709
710
711
712
698
699
700
701
702
703
704

705
706
707
708
709
710
711
712







-
+








	value.double_ = double_;
	type = OF_NUMBER_DOUBLE;

	return self;
}

- (enum of_number_type)type
- (of_number_type_t)type
{
	return type;
}

- (BOOL)boolValue
{
	RETURN_AS(BOOL)

Modified src/OFObject.m from [07b4e58e79] to [a02b47cd7d].

56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70







-
+







# define class_getSuperclass class_get_super_class
#endif

struct pre_ivar {
	void	      **memchunks;
	size_t	      memchunks_size;
	int32_t	      retain_count;
#if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS)
#if !defined(OF_ATOMIC_OPS)
	of_spinlock_t retain_spinlock;
#endif
};

/* Hopefully no arch needs more than 16 bytes padding */
#define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + 15) & ~15)
#define PRE_IVAR ((struct pre_ivar*)((char*)self - PRE_IVAR_ALIGN))
144
145
146
147
148
149
150
151

152
153
154
155
156
157
158
144
145
146
147
148
149
150

151
152
153
154
155
156
157
158







-
+







		@throw (OFAllocFailedException*)&alloc_failed_exception;
	}

	((struct pre_ivar*)instance)->memchunks = NULL;
	((struct pre_ivar*)instance)->memchunks_size = 0;
	((struct pre_ivar*)instance)->retain_count = 1;

#if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS)
#if !defined(OF_ATOMIC_OPS)
	if (!of_spinlock_new(&((struct pre_ivar*)instance)->retain_spinlock)) {
		free(instance);
		@throw [OFInitializationFailedException newWithClass: self];
	}
#endif

	instance = (OFObject*)((char*)instance + PRE_IVAR_ALIGN);
661
662
663
664
665
666
667
668

669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690

691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
661
662
663
664
665
666
667

668
669
670
671


672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687

688
689
690
691
692
693
694
695
696



697
698
699
700
701
702
703







-
+



-
-
















-
+








-
-
-







						      pointer: ptr];
}

- retain
{
#if defined(OF_ATOMIC_OPS)
	of_atomic_inc_32(&PRE_IVAR->retain_count);
#elif defined(OF_THREADS)
#else
	assert(of_spinlock_lock(&PRE_IVAR->retain_spinlock));
	PRE_IVAR->retain_count++;
	assert(of_spinlock_unlock(&PRE_IVAR->retain_spinlock));
#else
	PRE_IVAR->retain_count++;
#endif

	return self;
}

- (size_t)retainCount
{
	assert(PRE_IVAR->retain_count >= 0);
	return (size_t)PRE_IVAR->retain_count;
}

- (void)release
{
#if defined(OF_ATOMIC_OPS)
	if (of_atomic_dec_32(&PRE_IVAR->retain_count) <= 0)
		[self dealloc];
#elif defined(OF_THREADS)
#else
	size_t c;

	assert(of_spinlock_lock(&PRE_IVAR->retain_spinlock));
	c = --PRE_IVAR->retain_count;
	assert(of_spinlock_unlock(&PRE_IVAR->retain_spinlock));

	if (!c)
		[self dealloc];
#else
	if (--PRE_IVAR->retain_count <= 0)
		[self dealloc];
#endif
}

- autorelease
{
	/*
	 * Cache OFAutoreleasePool since class lookups are expensive with the

Modified src/OFStream.h from [0a6b8c3f80] to [74be59fb41].

13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28







+

-







 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include <stdarg.h>

#import "OFObject.h"
#import "OFString.h"

@class OFString;
@class OFDataArray;

/**
 * \brief A base class for different types of streams.
 *
 * IMPORTANT: If you want to subclass this, override _readNBytes:intoBuffer:,
 * _writeNBytes:fromBuffer: and _isAtEndOfStream, but nothing else. Those are
181
182
183
184
185
186
187
188

189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208

209
210
211
212
213
214
215
181
182
183
184
185
186
187

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207

208
209
210
211
212
213
214
215







-
+



















-
+







 * Read with the specified encoding until a newline, \\0 or end of stream
 * occurs.
 *
 * \param encoding The encoding used by the stream
 * \return The line that was read, autoreleased, or nil if the end of the
 *	   stream has been reached.
 */
- (OFString*)readLineWithEncoding: (enum of_string_encoding)encoding;
- (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding;

/**
 * Read until the specified string or \\0 is found or the end of stream occurs.
 *
 * \param delimiter The delimiter
 * \return The line that was read, autoreleased, or nil if the end of the
 *	   stream has been reached.
 */
- (OFString*)readTillDelimiter: (OFString*)delimiter;

/**
 * Read until the specified string or \\0 is found or the end of stream occurs.
 *
 * \param delimiter The delimiter
 * \param encoding The encoding used by the stream
 * \return The line that was read, autoreleased, or nil if the end of the
 *	   stream has been reached.
 */
- (OFString*)readTillDelimiter: (OFString*)delimiter
		  withEncoding: (enum of_string_encoding)encoding;
		  withEncoding: (of_string_encoding_t)encoding;

/**
 * \return A boolean whether writes are buffered
 */
- (BOOL)buffersWrites;

/**

Modified src/OFStream.m from [3b625f7cf5] to [c9c58ea96b].

20
21
22
23
24
25
26




27
28
29
30
31
32
33
34
35
36








37
38
39
40
41
42
43
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







+
+
+
+










+
+
+
+
+
+
+
+







#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>
#include <fcntl.h>

#ifndef _WIN32
# include <signal.h>
#endif

#import "OFStream.h"
#import "OFString.h"
#import "OFDataArray.h"
#import "OFExceptions.h"
#import "macros.h"

#import "asprintf.h"

@implementation OFStream
#ifndef _WIN32
+ (void)initialize
{
	if (self == [OFStream class])
		signal(SIGPIPE, SIG_IGN);
}
#endif

- init
{
	if (isa == [OFStream class]) {
		Class c = isa;
		[self release];
		@throw [OFNotImplementedException newWithClass: c
						      selector: _cmd];
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
250
251
252
253
254
255
256

257
258
259
260
261
262
263
264







-
+







}

- (OFString*)readLine
{
	return [self readLineWithEncoding: OF_STRING_ENCODING_UTF_8];
}

- (OFString*)readLineWithEncoding: (enum of_string_encoding)encoding
- (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding
{
	size_t i, len, ret_len;
	char *ret_c, *tmp, *tmp2;
	OFString *ret;

	/* Look if there's a line or \0 in our cache */
	if (cache != NULL) {
386
387
388
389
390
391
392
393

394
395
396
397
398
399
400
398
399
400
401
402
403
404

405
406
407
408
409
410
411
412







-
+







- (OFString*)readTillDelimiter: (OFString*)delimiter
{
	return [self readTillDelimiter: delimiter
			  withEncoding: OF_STRING_ENCODING_UTF_8];
}

- (OFString*)readTillDelimiter: (OFString*)delimiter
		  withEncoding: (enum of_string_encoding)encoding
		  withEncoding: (of_string_encoding_t)encoding
{
	const char *delim;
	size_t i, j, delim_len, len, ret_len;
	char *ret_c, *tmp, *tmp2;
	OFString *ret;

	/* FIXME: Convert delimiter to specified charset */
628
629
630
631
632
633
634


635
636






637
638





639
640
641
642
643
644
645
640
641
642
643
644
645
646
647
648


649
650
651
652
653
654
655

656
657
658
659
660
661
662
663
664
665
666
667







+
+
-
-
+
+
+
+
+
+

-
+
+
+
+
+







{
	return [self writeNBytes: [str cStringLength]
		      fromBuffer: [str cString]];
}

- (size_t)writeLine: (OFString*)str
{
	size_t len = [str cStringLength];
	char *buf;
	size_t ret = [self writeString: str];
	[self writeInt8: '\n'];

	buf = [self allocMemoryWithSize: len + 1];

	@try {
		memcpy(buf, [str cString], len);
		buf[len] = '\n';

	return ret + 1;
		return [self writeNBytes: len + 1
			      fromBuffer: buf];
	} @finally {
		[self freeMemory: buf];
	}
}

- (size_t)writeFormat: (OFString*)fmt, ...
{
	va_list args;
	size_t ret;

Modified src/OFStreamSocket.m from [688fd9e6b1] to [57b1d6b16e].

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
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







+
+
+
+
+

-
-
-
+
+
+


+
+
+
-
+

















+
+
+
+
+

-
-
-
+
+
+


+
+
+
-
+







	   intoBuffer: (char*)buf
{
	ssize_t ret;

	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException newWithClass: isa];

	if (eos) {
		OFReadFailedException *e;

		e = [OFReadFailedException newWithClass: isa
					  requestedSize: size];
#ifndef _WIN32
	/* FIXME: We want a sane error message on Win32 as well */
	if (eos)
		errno = ENOTCONN;
		e->errNo = ENOTCONN;
#else
		e->errNo = WSAENOTCONN;
#endif

		@throw e;
	}

	if (eos || (ret = recv(sock, buf, size, 0)) < 0)
	if ((ret = recv(sock, buf, size, 0)) < 0)
		@throw [OFReadFailedException newWithClass: isa
					     requestedSize: size];

	if (ret == 0)
		eos = YES;

	return ret;
}

- (size_t)_writeNBytes: (size_t)size
	    fromBuffer: (const char*)buf
{
	ssize_t ret;

	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException newWithClass: isa];

	if (eos) {
		OFWriteFailedException *e;

		e = [OFWriteFailedException newWithClass: isa
					   requestedSize: size];
#ifndef _WIN32
	/* FIXME: We want a sane error message on Win32 as well */
	if (eos)
		errno = ENOTCONN;
		e->errNo = ENOTCONN;
#else
		e->errNo = WSAENOTCONN;
#endif

		@throw e;
	}

	if (eos || (ret = send(sock, buf, size, 0)) == -1)
	if ((ret = send(sock, buf, size, 0)) == -1)
		@throw [OFWriteFailedException newWithClass: isa
					      requestedSize: size];

	/* This is safe, as we already checked for -1 */
	return ret;
}

Modified src/OFString.h from [c3d27af413] to [78d3e88b84].

17
18
19
20
21
22
23



24

25
26
27
28
29

30
31
32
33
34
35
36
17
18
19
20
21
22
23
24
25
26

27
28
29
30
31

32
33
34
35
36
37
38
39







+
+
+
-
+




-
+







#include <stdio.h>
#include <stdarg.h>

#import "OFObject.h"

typedef uint32_t of_unichar_t;

/**
 * \brief The encoding of a string.
 */
enum of_string_encoding {
typedef enum of_string_encoding_t {
	OF_STRING_ENCODING_UTF_8,
	OF_STRING_ENCODING_ISO_8859_1,
	OF_STRING_ENCODING_ISO_8859_15,
	OF_STRING_ENCODING_WINDOWS_1252
};
} of_string_encoding_t;

extern int of_string_check_utf8(const char*, size_t);
extern size_t of_string_unicode_to_utf8(of_unichar_t, char*);
extern size_t of_string_utf8_to_unicode(const char*, size_t, of_unichar_t*);
extern size_t of_string_position_to_index(const char*, size_t);
extern size_t of_string_index_to_position(const char*, size_t, size_t);

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
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







-
+











-
+







 * Creates a new OFString from a C string with the specified encoding.
 *
 * \param str A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)str
	   encoding: (enum of_string_encoding)encoding;
	   encoding: (of_string_encoding_t)encoding;

/**
 * Creates a new OFString from a C string with the specified encoding and
 * length.
 *
 * \param str A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \param len The length of the C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)str
	   encoding: (enum of_string_encoding)encoding
	   encoding: (of_string_encoding_t)encoding
	     length: (size_t)len;

/**
 * Creates a new OFString from a UTF-8 encoded C string with the specified
 * length.
 *
 * \param str A UTF-8 encoded C string to initialize the OFString with
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
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







-
+


















-
+











-
+







 * specified encoding.
 *
 * \param path The path to the file
 * \param encoding The encoding of the file
 * \return A new autoreleased OFString
 */
+ stringWithContentsOfFile: (OFString*)path
		  encoding: (enum of_string_encoding)encoding;
		  encoding: (of_string_encoding_t)encoding;

/**
 * Initializes an already allocated OFString from a UTF-8 encoded C string.
 *
 * \param str A UTF-8 encoded C string to initialize the OFString with
 * \return An initialized OFString
 */
- initWithCString: (const char*)str;

/**
 * Initializes an already allocated OFString from a C string with the specified
 * encoding.
 *
 * \param str A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding;
	 encoding: (of_string_encoding_t)encoding;

/**
 * Initializes an already allocated OFString from a C string with the specified
 * encoding and length.
 *
 * \param str A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \param len The length of the C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding
	 encoding: (of_string_encoding_t)encoding
	   length: (size_t)len;

/**
 * Initializes an already allocated OFString from a UTF-8 encoded C string with
 * the specified length.
 *
 * \param str A UTF-8 encoded C string to initialize the OFString with
245
246
247
248
249
250
251
252

253
254
255
256
257
258
259
248
249
250
251
252
253
254

255
256
257
258
259
260
261
262







-
+







 * file in the specified encoding.
 *
 * \param path The path to the file
 * \param encoding The encoding of the file
 * \return An initialized OFString
 */
- initWithContentsOfFile: (OFString*)path
		encoding: (enum of_string_encoding)encoding;
		encoding: (of_string_encoding_t)encoding;

/**
 * \return The OFString as a UTF-8 encoded C string
 */
- (const char*)cString;

/**

Modified src/OFString.m from [76062f9e81] to [a9943514ef].

238
239
240
241
242
243
244
245

246
247
248
249
250
251
252

253
254
255
256
257
258
259
238
239
240
241
242
243
244

245
246
247
248
249
250
251

252
253
254
255
256
257
258
259







-
+






-
+








+ stringWithCString: (const char*)str
{
	return [[[self alloc] initWithCString: str] autorelease];
}

+ stringWithCString: (const char*)str
	   encoding: (enum of_string_encoding)encoding
	   encoding: (of_string_encoding_t)encoding
{
	return [[[self alloc] initWithCString: str
				     encoding: encoding] autorelease];
}

+ stringWithCString: (const char*)str
	   encoding: (enum of_string_encoding)encoding
	   encoding: (of_string_encoding_t)encoding
	     length: (size_t)len
{
	return [[[self alloc] initWithCString: str
				     encoding: encoding
				       length: len] autorelease];
}

297
298
299
300
301
302
303
304

305
306
307
308
309
310
311
312
313
314
315
316
317
318

319
320
321
322
323
324
325
326

327
328
329
330
331
332
333
297
298
299
300
301
302
303

304
305
306
307
308
309
310
311
312
313
314
315
316
317

318
319
320
321
322
323
324
325

326
327
328
329
330
331
332
333







-
+













-
+







-
+








+ stringWithContentsOfFile: (OFString*)path
{
	return [[[self alloc] initWithContentsOfFile: path] autorelease];
}

+ stringWithContentsOfFile: (OFString*)path
		  encoding: (enum of_string_encoding)encoding
		  encoding: (of_string_encoding_t)encoding
{
	return [[[self alloc] initWithContentsOfFile: path
					    encoding: encoding] autorelease];
}

- initWithCString: (const char*)str
{
	return [self initWithCString: str
			    encoding: OF_STRING_ENCODING_UTF_8
			      length: strlen(str)];
}

- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding
	 encoding: (of_string_encoding_t)encoding
{
	return [self initWithCString: str
			    encoding: encoding
			      length: strlen(str)];
}

- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding
	 encoding: (of_string_encoding_t)encoding
	   length: (size_t)len
{
	self = [super init];

	@try {
		size_t i, j;
		const uint16_t *table;
615
616
617
618
619
620
621
622

623
624
625
626
627
628
629
615
616
617
618
619
620
621

622
623
624
625
626
627
628
629







-
+







- initWithContentsOfFile: (OFString*)path
{
	return [self initWithContentsOfFile: path
				   encoding: OF_STRING_ENCODING_UTF_8];
}

- initWithContentsOfFile: (OFString*)path
		encoding: (enum of_string_encoding)encoding
		encoding: (of_string_encoding_t)encoding
{
	self = [super init];

	@try {
		OFFile *file;
		char *tmp;
		struct stat s;
972
973
974
975
976
977
978
979

980
981
982
983
984
985
986
972
973
974
975
976
977
978

979
980
981
982
983
984
985
986







-
+







}

- (intmax_t)decimalValue
{
	int i = 0;
	intmax_t num = 0;

	if (string[0] == '-')
	if (string[0] == '-' || string[0] == '+')
		i++;

	for (; i < length; i++) {
		if (string[i] >= '0' && string[i] <= '9') {
			if (INTMAX_MAX / 10 < num ||
			    INTMAX_MAX - num * 10 < string[i] - '0')
				@throw [OFOutOfRangeException

Modified src/OFTCPSocket.h from [5f5aec5406] to [4276a55e09].

54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
54
55
56
57
58
59
60

61

62
63
64
65
66
67
68







-
+
-







 *
 * \param service The service to bind
 * \param node The node to bind to. Use @"0.0.0.0" for IPv4 or @"::" for IPv6
 *	       to bind to all.
 * \param family The family to use (AF_INET for IPv4 or AF_INET6 for IPv6)
 */
- (void)bindService: (OFString*)service
	     onNode: (OFString*)node
	     onNode: (OFString*)node;
	 withFamily: (int)family;

/**
 * Listen on the socket.
 *
 * \param backlog Maximum length for the queue of pending connections.
 */
- (void)listenWithBackLog: (int)backlog;

Modified src/OFTCPSocket.m from [5bed299304] to [8771225ab8].

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227

228
229
230

231
232
233
234
235
236
237





238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
253
197
198
199
200
201
202
203

204
205
206
207














208
209
210
211

212
213
214

215


216
217
218
219

220
221
222
223
224
225
226
227
228
229
230
231

232

233
234
235
236
237
238
239







-




-
-
-
-
-
-
-
-
-
-
-
-
-
-




-
+


-
+
-
-




-
+
+
+
+
+







-
+
-







		@throw [OFConnectionFailedException newWithClass: isa
							    node: node
							 service: service];
}

- (void)bindService: (OFString*)service
	     onNode: (OFString*)node
	 withFamily: (int)family
{
	if (sock != INVALID_SOCKET)
		@throw [OFAlreadyConnectedException newWithClass: isa];

#ifndef HAVE_THREADSAFE_GETADDRINFO
	if (family != AF_INET)
		@throw [OFBindFailedException newWithClass: isa
						      node: node
						   service: service
						    family: family];
#endif

	if ((sock = socket(family, SOCK_STREAM, 0)) == INVALID_SOCKET)
		@throw [OFBindFailedException newWithClass: isa
						      node: node
						   service: service
						    family: family];

#ifdef HAVE_THREADSAFE_GETADDRINFO
	struct addrinfo hints, *res;

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = family;
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;

	if (getaddrinfo([node cString], [service cString], &hints, &res)) {
	if (getaddrinfo([node cString], [service cString], &hints, &res))
		close(sock);
		sock = INVALID_SOCKET;
		@throw [OFAddressTranslationFailedException
		    newWithClass: isa
			    node: node
			 service: service];
	}

	if ((sock = socket(res->ai_family, SOCK_STREAM, 0)) == INVALID_SOCKET)
		@throw [OFBindFailedException newWithClass: isa
						      node: node
						   service: service];

	if (bind(sock, res->ai_addr, res->ai_addrlen) == -1) {
		freeaddrinfo(res);
		close(sock);
		sock = INVALID_SOCKET;
		@throw [OFBindFailedException newWithClass: isa
						      node: node
						   service: service
						   service: service];
						    family: family];
	}

	freeaddrinfo(res);
#else
	struct hostent *he;
	struct servent *se;
	struct sockaddr_in addr;
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305




306
307
308
309
310
311
312

313
314
315
316
317
318
319
320
256
257
258
259
260
261
262


263
264
265
266
267
268
269
270
271
272
273
274
275
276


277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297

298

299
300
301
302
303
304
305







-
-














-
-











+
+
+
+






-
+
-







	if ((se = getservbyname([service cString], "TCP")) != NULL)
		port = se->s_port;
	else if ((port = OF_BSWAP16_IF_LE(strtol([service cString], NULL,
	    10))) == 0) {
# ifdef OF_THREADS
		[mutex unlock];
# endif
		close(sock);
		sock = INVALID_SOCKET;
		@throw [OFAddressTranslationFailedException
		    newWithClass: isa
			    node: node
			 service: service];
	}

	memset(&addr, 0, sizeof(addr));
	addr.sin_family = AF_INET;
	addr.sin_port = port;

	if (he->h_addrtype != AF_INET || he->h_addr_list[0] == NULL) {
# ifdef OF_THREADS
		[mutex unlock];
# endif
		close(sock);
		sock = INVALID_SOCKET;
		@throw [OFAddressTranslationFailedException
		    newWithClass: isa
			    node: node
			 service: service];
	}

	memcpy(&addr.sin_addr.s_addr, he->h_addr_list[0], he->h_length);

# ifdef OF_THREADS
	[mutex unlock];
# endif
	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
		@throw [OFBindFailedException newWithClass: isa
						      node: node
						   service: service];

	if (bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) {
		close(sock);
		sock = INVALID_SOCKET;
		@throw [OFBindFailedException newWithClass: isa
						      node: node
						   service: service
						   service: service];
						    family: family];
	}
#endif
}

- (void)listenWithBackLog: (int)backlog
{
	if (sock == INVALID_SOCKET)
348
349
350
351
352
353
354
355

356
357
358
359
360

361
362
363
364
365
366
367
333
334
335
336
337
338
339

340
341
342
343
344

345
346
347
348
349
350
351
352







-
+




-
+








	newsock = [[[isa alloc] init] autorelease];
	addrlen = sizeof(struct sockaddr);

	@try {
		addr = [newsock allocMemoryWithSize: sizeof(struct sockaddr)];
	} @catch (id e) {
		[newsock dealloc];
		[newsock release];
		@throw e;
	}

	if ((s = accept(sock, addr, &addrlen)) == INVALID_SOCKET) {
		[newsock dealloc];
		[newsock release];
		@throw [OFAcceptFailedException newWithClass: isa];
	}

	newsock->sock = s;
	newsock->sockAddr = addr;
	newsock->sockAddrLen = addrlen;

Modified src/OFThread.h from [c73592c469] to [365e7ac8cd].

15
16
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
42
43
44

45
46
47
48
49
50
51
15
16
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
42
43
44
45

46
47
48
49
50
51
52
53







+
+
















-
+





-
+







 */

#import "OFObject.h"
#import "OFList.h"

#import "threading.h"

@class OFDate;

/**
 * \brief A class for Thread Local Storage keys.
 */
@interface OFTLSKey: OFObject
{
@public
	of_tlskey_t key;
@protected
	void (*destructor)(id);
	of_list_object_t *listobj;
	BOOL initialized;
}

/**
 * \return A new autoreleased Thread Local Storage key
 */
+ tlsKey;
+ TLSKey;

/**
 * \param destructor A destructor that is called when the thread is terminated
 * \return A new autoreleased Thread Local Storage key
 */
+ tlsKeyWithDestructor: (void(*)(id))destructor;
+ TLSKeyWithDestructor: (void(*)(id))destructor;

+ (void)callAllDestructors;

/**
 * \return An initialized Thread Local Storage key
 */
- init;
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
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
138
139
140
141
142
143
144
145
146








+
+
+
+
+

-
+












-

-
-
+
+

















-
+
+
+

+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+







		OF_THREAD_NOT_RUNNING,
		OF_THREAD_RUNNING,
		OF_THREAD_WAITING_FOR_JOIN
	} running;
	id retval;
}

/**
 * \return A new, autoreleased thread
 */
+ thread;

/**
 * \param obj An object that is passed to the main method as a copy or nil
 * \return A new autoreleased thread
 * \return A new, autoreleased thread
 */
+ threadWithObject: (id)obj;

/**
 * Sets the Thread Local Storage for the specified key.
 *
 * The specified object is first retained and then the object stored before is
 * released. You can specify nil as object if you want the old object to be
 * released and don't want any new object for the TLS key.
 *
 * \param key The Thread Local Storage key
 * \param obj The object the Thread Local Storage key will be set to
 * \return The old object, autoreleased
 */
+ (id)setObject: (id)obj
      forTLSKey: (OFTLSKey*)key;
+ (void)setObject: (id)obj
	forTLSKey: (OFTLSKey*)key;

/**
 * Returns the object for the specified Thread Local Storage key.
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \param key The Thread Local Storage key
 */
+ (id)objectForTLSKey: (OFTLSKey*)key;

/**
 * \return The current thread or nil if we are in the main thread
 */
+ (OFThread*)currentThread;

/**
 * Suspends execution of the current thread for N milliseconds.
 * Suspends execution of the current thread for the specified time interval.
 *
 * \param sec The number of seconds to sleep
 */
+ (void)sleepForTimeInterval: (int64_t)sec;

/**
 * Suspends execution of the current thread for the specified time interval.
 *
 * \param sec The number of seconds to sleep
 * \param usec The number of microseconds to sleep
 */
+ (void)sleepForNMilliseconds: (unsigned int)msecs;
+ (void)sleepForTimeInterval: (int64_t)sec
		microseconds: (uint32_t)usec;

/**
 * Suspends execution of the current thread until the specified date.
 */
+ (void)sleepUntilDate: (OFDate*)date;

/**
 * Yields a processor voluntarily and moves the thread at the end of the queue
 * for its priority.
 */
+ (void)yield;

Modified src/OFThread.m from [5063c8614f] to [7cfc6bc1be].

21
22
23
24
25
26
27

28
29
30
31
32
33
34
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35







+







# include <sched.h>
#else
# include <windows.h>
#endif

#import "OFThread.h"
#import "OFList.h"
#import "OFDate.h"
#import "OFAutoreleasePool.h"
#import "OFExceptions.h"

#import "threading.h"

static OFList *tlskeys;
static of_tlskey_t thread_self;
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
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
138
139
140
141
142
143
144

145
146
147
148
149
150
151
152
153
154
155







+
+
+
+
+






-
-
+
+







-
+




-
+




-
+


-
+

+
+
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+







{
	if (self != [OFThread class])
		return;

	if (!of_tlskey_new(&thread_self))
		@throw [OFInitializationFailedException newWithClass: self];
}

+ thread
{
	return [[[self alloc] init] autorelease];
}

+ threadWithObject: (id)obj
{
	return [[[self alloc] initWithObject: obj] autorelease];
}

+ (id)setObject: (id)obj
      forTLSKey: (OFTLSKey*)key
+ (void)setObject: (id)obj
	forTLSKey: (OFTLSKey*)key
{
	id old = of_tlskey_get(key->key);

	if (!of_tlskey_set(key->key, [obj retain]))
		@throw [OFInvalidArgumentException newWithClass: self
						       selector: _cmd];

	return [old autorelease];
	[old release];
}

+ (id)objectForTLSKey: (OFTLSKey*)key
{
	return of_tlskey_get(key->key);
	return [[of_tlskey_get(key->key) retain] autorelease];
}

+ (OFThread*)currentThread
{
	return of_tlskey_get(thread_self);
	return [[of_tlskey_get(thread_self) retain] autorelease];
}

+ (void)sleepForNMilliseconds: (unsigned int)msecs;
+ (void)sleepForTimeInterval: (int64_t)sec
{
	if (sec < 0)
		@throw [OFOutOfRangeException newWithClass: self];

#ifndef _WIN32
	sleep(sec);
#else
	Sleep(sec * 1000);
#endif
}

+ (void)sleepForTimeInterval: (int64_t)sec
		microseconds: (uint32_t)usec
{
	if (sec < 0)
		@throw [OFOutOfRangeException newWithClass: self];

#ifndef _WIN32
	sleep(sec);
	usleep(msecs * 1000);
	usleep(usec);
#else
	Sleep(sec * 1000 + usec / 1000);
#endif
}

+ (void)sleepUntilDate: (OFDate*)date
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFDate *now = [OFDate date];
	int64_t sec;
	uint32_t usec;

	if ((sec = [date timeIntervalSinceDate: now]) < 0)
		@throw [OFOutOfRangeException newWithClass: self];

	usec = [date microsecondsOfTimeIntervalSinceDate: now];

	[pool release];

#ifndef _WIN32
	Sleep(msecs);
	sleep(sec);
	usleep(usec);
#else
	Sleep(sec * 1000 + usec / 1000);
#endif
}

+ (void)yield
{
#ifndef _WIN32
	sched_yield();
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
179
180
181
182
183
184
185








186
187
188
189
190
191
192







-
-
-
-
-
-
-
-







	[OFAutoreleasePool releaseAll];

	[thread release];

	of_thread_exit();
}

- init
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException newWithClass: c
					      selector: _cmd];
}

- initWithObject: (id)obj
{
	self = [super init];

	@try {
		object = [obj retain];
	} @catch (id e) {
212
213
214
215
216
217
218
219

220
221
222
223
224

225
226
227
228
229
230
231
249
250
251
252
253
254
255

256
257
258
259
260

261
262
263
264
265
266
267
268







-
+




-
+







@implementation OFTLSKey
+ (void)initialize
{
	if (self == [OFTLSKey class])
		tlskeys = [[OFList alloc] init];
}

+ tlsKey
+ TLSKey
{
	return [[[self alloc] init] autorelease];
}

+ tlsKeyWithDestructor: (void(*)(id))destructor
+ TLSKeyWithDestructor: (void(*)(id))destructor
{
	return [[[self alloc] initWithDestructor: destructor] autorelease];
}

+ (void)callAllDestructors
{
	of_list_object_t *iter;

Modified tests/OFBlockTests.m from [43c311ce1f] to [08a11f6547].

21
22
23
24
25
26
27


28
29
30
31
32
33
34
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36







+
+







#import "OFAutoreleasePool.h"
#import "OFExceptions.h"

#if defined(OF_OBJFW_RUNTIME)
# include <objfw-rt.h>
#elif defined(OF_OLD_GNU_RUNTIME)
# include <objc/objc-api.h>
#elif defined(OF_APPLE_RUNTIME)
# include <objc/runtime.h>
#endif
#if defined(OF_OLD_GNU_RUNTIME) || defined(OF_OBJFW_RUNTIME)
# define objc_getClass objc_get_class
#endif

#import "TestsAppDelegate.h"

Modified tests/OFStringTests.m from [5d85ec7796] to [f983422e61].

224
225
226
227
228
229
230

231
232
233
234
235
236
237
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238







+







	    [[a objectAtIndex: i++] isEqual: @""] &&
	    [[a objectAtIndex: i++] isEqual: @"baz"] &&
	    [[a objectAtIndex: i++] isEqual: @""] &&
	    [[a objectAtIndex: i++] isEqual: @""])

	TEST(@"-[decimalValue]",
	    [@"1234" decimalValue] == 1234 &&
	    [@"+123" decimalValue] == 123 &&
	    [@"-500" decimalValue] == -500 &&
	    [@"" decimalValue] == 0)

	TEST(@"-[hexadecimalValue]",
	    [@"123f" hexadecimalValue] == 0x123f &&
	    [@"0xABcd" hexadecimalValue] == 0xABCD &&
	    [@"xbCDE" hexadecimalValue] == 0xBCDE &&

Modified tests/OFTCPSocketTests.m from [85d97971df] to [fca04a710e].

45
46
47
48
49
50
51
52

53
54

55
56
57
58
59
60
61
62
45
46
47
48
49
50
51

52
53

54

55
56
57
58
59
60
61







-
+

-
+
-







		port += 1024;
	service = [OFString stringWithFormat: @"%d", port];

	TEST(@"+[socket]", (server = [OFTCPSocket socket]) &&
	    (client = [OFTCPSocket socket]))

	msg = [OFString stringWithFormat:
	    @"-[bindService:onNode:withFamily:] (port %d)", port];
	    @"-[bindService:onNode:] (port %d)", port];
	TEST(msg, R([server bindService: service
				 onNode: @"127.0.0.1"
				 onNode: @"127.0.0.1"]))
			     withFamily: AF_INET]))

	TEST(@"-[listen]", R([server listen]))

	TEST(@"-[connectToService:onNode:]",
	    R([client connectToService: service
				onNode: @"127.0.0.1"]))

Modified tests/OFThreadTests.m from [cbb2d85d6a] to [827e358280].

48
49
50
51
52
53
54
55

56
57
58
59
60
61


62
63
64
65
66
67
68
48
49
50
51
52
53
54

55
56
57
58
59


60
61
62
63
64
65
66
67
68







-
+




-
-
+
+







	TEST(@"+[threadWithObject:]",
	    (t = [TestThread threadWithObject: @"foo"]))

	TEST(@"-[start]", R([t start]))

	TEST(@"-[join]", [[t join] isEqual: @"success"])

	TEST(@"OFTLSKey's +[tlsKey]", (key = [OFTLSKey tlsKey]))
	TEST(@"OFTLSKey's +[TLSKey]", (key = [OFTLSKey TLSKey]))

	TEST(@"+[setObject:forTLSKey:]",
	    R([OFThread setObject: @"setme"
			forTLSKey: key]) &&
	    [[OFThread setObject: @"foo"
		       forTLSKey: key] isEqual: @"setme"])
	    R([OFThread setObject: @"foo"
			forTLSKey: key]))

	TEST(@"+[objectForTLSKey:]",
	    [[OFThread objectForTLSKey: key] isEqual: @"foo"])

	[pool drain];
}
@end

Modified utils/objfw-compile from [d0a384a73a] to [2d1b114a41].

101
102
103
104
105
106
107




108
109
110
111
112
113
114
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118







+
+
+
+







		-D)
			shift
			CPPFLAGS="$CPPFLAGS -D$1"
			;;
		-D*)
			CPPFLAGS="$CPPFLAGS $1"
			;;
		-framework)
			shift
			LIBS="$LIBS -framework $1"
			;;
		-g*)
			OBJCFLAGS="$OBJCFLAGS $1"
			;;
		-I)
			shift
			CPPFLAGS="$CPPFLAGS -I$1"
			;;
176
177
178
179
180
181
182
183

184
185
186
187
188
189
190
191
180
181
182
183
184
185
186

187

188
189
190
191
192
193
194







-
+
-







	elif test x"$plugin" = x"yes"; then
		obj="${i%.m}.plugin.o"
	else
		obj="${i%.m}.o"
	fi
	objs="$objs $obj"
	build="no"
	deps=$($OBJC -E -M $CPPFLAGS $ENV_CPPFLAGS $i | \
	deps=$($OBJC -E -M $CPPFLAGS $i | sed 's/.*: //' | sed 's/\\//g')
	       sed 's/.*: //' | sed 's/\\//g')

	if test -f "$obj"; then
		for dep in $deps; do
			test "$dep" -nt $obj && build="yes"
		done
	else
		build="yes"
206
207
208
209
210
211
212
213
214


215
216
209
210
211
212
213
214
215


216
217
218
219







-
-
+
+


if test x"$lib" = x"yes"; then
	export LIB="$out_prefix$out$out_suffix"
	LDFLAGS="$LDFLAGS $($OBJFW_CONFIG --lib-ldflags)"
fi

if test ! -f "$out_prefix$out$out_suffix" -o x"$link" = x"yes"; then
	status_linking $out_prefix$out$out_suffix
	$OBJC -o $out_prefix$out$out_suffix $objs $LIBS $ENV_LIBS $LDFLAGS \
		$ENV_LDFLAGS || status_link_failed $out $?
	$OBJC -o $out_prefix$out$out_suffix $objs $LIBS $LDFLAGS || \
		status_link_failed $out $?
	status_linked $out_prefix$out$out_suffix
fi