ObjFW  Diff

Differences From Artifact [b27451c5d4]:

  • File src/OFSequencedPacketSocket.m — part of check-in [1833194867] at 2021-01-14 02:29:31 on branch trunk — Define _HPUX_ALT_XOPEN_SOCKET_API where necessary

    There is a nasty bug in HP-UX: When using the proper socket APIs that
    take a socklen_t (which is 64 bit in LP64 mode), it still calls into
    methods that expect an int - so there is a type mismatch between the
    headers and the compiled system libraries. This leads to all socklen_t
    being interpreted as 0 (due to big endian). Defining
    _HPUX_ALT_XOPEN_SOCKET_API makes it use the correct symbols in the
    system libraries instead. (user: js, size: 11148) [annotate] [blame] [check-ins using]

To Artifact [7bba0bbd14]:


145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
145
146
147
148
149
150
151

152

153
154
155
156
157
158
159







-
+
-








	_canBlock = canBlock;
#else
	OF_UNRECOGNIZED_SELECTOR
#endif
}

- (size_t)receiveIntoBuffer: (void *)buffer
- (size_t)receiveIntoBuffer: (void *)buffer length: (size_t)length
		     length: (size_t)length
{
	ssize_t ret;

	if (_socket == INVALID_SOCKET)
		@throw [OFNotOpenException exceptionWithObject: self];

#ifndef OF_WINDOWS
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188
172
173
174
175
176
177
178

179

180
181
182
183
184
185
186







-
+
-







			requestedLength: length
				  errNo: of_socket_errno()];
#endif

	return ret;
}

- (void)asyncReceiveIntoBuffer: (void *)buffer
- (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length
			length: (size_t)length
{
	[self asyncReceiveIntoBuffer: buffer
			      length: length
			 runLoopMode: of_run_loop_mode_default];
}

- (void)asyncReceiveIntoBuffer: (void *)buffer
224
225
226
227
228
229
230
231

232
233
234
235
236
237
238
239
222
223
224
225
226
227
228

229

230
231
232
233
234
235
236







-
+
-







						       length: length
							 mode: runLoopMode
							block: block
						     delegate: nil];
}
#endif

- (void)sendBuffer: (const void *)buffer
- (void)sendBuffer: (const void *)buffer length: (size_t)length
	    length: (size_t)length
{
	if (_socket == INVALID_SOCKET)
		@throw [OFNotOpenException exceptionWithObject: self];

#ifndef OF_WINDOWS
	ssize_t bytesWritten;

265
266
267
268
269
270
271
272

273
274
275
276
277
278
279
280
262
263
264
265
266
267
268

269

270
271
272
273
274
275
276







-
+
-







						   requestedLength: length
						      bytesWritten: bytesWritten
							     errNo: 0];
}

- (void)asyncSendData: (OFData *)data
{
	[self asyncSendData: data
	[self asyncSendData: data runLoopMode: of_run_loop_mode_default];
		runLoopMode: of_run_loop_mode_default];
}

- (void)asyncSendData: (OFData *)data
	  runLoopMode: (of_run_loop_mode_t)runLoopMode
{
	[OFRunLoop of_addAsyncSendForSequencedPacketSocket: self
						      data: data