ObjFW  Check-in [a62b254fda]

Overview
Comment:Document more exceptions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a62b254fda546e37a417bf467a18b90fd3ddc2dacee89f3684dc8ae3a73cadc8
User & Date: js on 2022-10-21 13:07:59
Other Links: manifest | tags
Context
2022-10-21
22:15
OFSPXStreamSocket: Fix wrong socket type check-in: 005cf5cd96 user: js tags: trunk
13:07
Document more exceptions check-in: a62b254fda user: js tags: trunk
2022-10-20
21:18
Document more exceptions check-in: 84a7314f5c user: js tags: trunk
Changes

Modified src/OFString+Serialization.h from [2c9a0f8857] to [6689bf6870].

24
25
26
27
28
29
30







31
32
33
34
35
#ifdef __cplusplus
}
#endif

@interface OFString (Serialization)
/**
 * @brief The string interpreted as serialization and parsed as an object.







 */
@property (readonly, nonatomic) id objectByDeserializing;
@end

OF_ASSUME_NONNULL_END







>
>
>
>
>
>
>





24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifdef __cplusplus
}
#endif

@interface OFString (Serialization)
/**
 * @brief The string interpreted as serialization and parsed as an object.
 *
 * @throw OFMalformedXMLException The XML was malformed
 * @throw OFUnboundNamespaceException A prefix was used that was not bound to
 *				      any namespace
 * @throw OFInvalidEncodingException The XML is not in the encoding it specified
 * @throw OFUnsupportedVersionException The serialization is in an unsupported
 *					version
 */
@property (readonly, nonatomic) id objectByDeserializing;
@end

OF_ASSUME_NONNULL_END

Modified src/OFString+Serialization.m from [feafb9e064] to [a02a87cd97].

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
	void *pool = objc_autoreleasePoolPush();
	OFXMLElement *root;
	OFString *version;
	OFArray *elements;
	id object;

	@try {
		root = [OFXMLElement elementWithXMLString: self];
	} @catch (OFMalformedXMLException *e) {
		@throw [OFInvalidArgumentException exception];
	} @catch (OFUnboundNamespaceException *e) {
		@throw [OFInvalidArgumentException exception];
	}

	version = [root attributeForName: @"version"].stringValue;
	if (version == nil)
		@throw [OFInvalidArgumentException exception];

	if (version.unsignedLongLongValue != 1)
		@throw [OFUnsupportedVersionException







<
|
<
<
<
<
<







34
35
36
37
38
39
40

41





42
43
44
45
46
47
48
{
	void *pool = objc_autoreleasePoolPush();
	OFXMLElement *root;
	OFString *version;
	OFArray *elements;
	id object;


	root = [OFXMLElement elementWithXMLString: self];






	version = [root attributeForName: @"version"].stringValue;
	if (version == nil)
		@throw [OFInvalidArgumentException exception];

	if (version.unsignedLongLongValue != 1)
		@throw [OFUnsupportedVersionException

Modified src/OFSubprocess.h from [edb6555d8e] to [1691c8fd4f].

190
191
192
193
194
195
196


197
198
199
200
201
202
203
204



205
206
207
208
209

/**
 * @brief Closes the write direction of the subprocess.
 *
 * This method needs to be called for some programs before data can be read,
 * since some programs don't start processing before the write direction is
 * closed.


 */
- (void)closeForWriting;

/**
 * @brief Waits for the subprocess to terminate and returns the exit status.
 *
 * If the subprocess has already exited, this returns the exit status
 * immediately.



 */
- (int)waitForTermination;
@end

OF_ASSUME_NONNULL_END







>
>








>
>
>





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

/**
 * @brief Closes the write direction of the subprocess.
 *
 * This method needs to be called for some programs before data can be read,
 * since some programs don't start processing before the write direction is
 * closed.
 *
 * @throw OFNotOpenException The subprocess was already closed
 */
- (void)closeForWriting;

/**
 * @brief Waits for the subprocess to terminate and returns the exit status.
 *
 * If the subprocess has already exited, this returns the exit status
 * immediately.
 *
 * @return The status code of the subprocess
 * @throw OFNotOpenException The subprocess was already closed
 */
- (int)waitForTermination;
@end

OF_ASSUME_NONNULL_END

Modified src/OFTLSStream.h from [66003bcff2] to [8cbbbbbe33].

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

/**
 * @brief Asynchronously performs the TLS client handshake for the specified
 *	  host and calls the delegate afterwards.
 *
 * @param host The host to perform the handshake with


 */
- (void)asyncPerformClientHandshakeWithHost: (OFString *)host;

/**
 * @brief Asynchronously performs the TLS client handshake for the specified
 *	  host and calls the delegate afterwards.
 *
 * @param host The host to perform the handshake with
 * @param runLoopMode The run loop mode in which to perform the async handshake


 */
- (void)asyncPerformClientHandshakeWithHost: (OFString *)host
				runLoopMode: (OFRunLoopMode)runLoopMode;

/**
 * @brief Performs the TLS client handshake for the specified host.
 *
 * @param host The host to perform the handshake with
 * @throw OFTLSHandshakeFailedException The TLS handshake failed

 */
- (void)performClientHandshakeWithHost: (OFString *)host;
@end

#ifdef __cplusplus
extern "C" {
#endif







>
>









>
>









>







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

/**
 * @brief Asynchronously performs the TLS client handshake for the specified
 *	  host and calls the delegate afterwards.
 *
 * @param host The host to perform the handshake with
 * @throw OFTLSHandshakeFailedException The TLS handshake failed
 * @throw OFAlreadyConnectedException The handshake was already performed
 */
- (void)asyncPerformClientHandshakeWithHost: (OFString *)host;

/**
 * @brief Asynchronously performs the TLS client handshake for the specified
 *	  host and calls the delegate afterwards.
 *
 * @param host The host to perform the handshake with
 * @param runLoopMode The run loop mode in which to perform the async handshake
 * @throw OFTLSHandshakeFailedException The TLS handshake failed
 * @throw OFAlreadyConnectedException The handshake was already performed
 */
- (void)asyncPerformClientHandshakeWithHost: (OFString *)host
				runLoopMode: (OFRunLoopMode)runLoopMode;

/**
 * @brief Performs the TLS client handshake for the specified host.
 *
 * @param host The host to perform the handshake with
 * @throw OFTLSHandshakeFailedException The TLS handshake failed
 * @throw OFAlreadyConnectedException The handshake was already performed
 */
- (void)performClientHandshakeWithHost: (OFString *)host;
@end

#ifdef __cplusplus
extern "C" {
#endif

Modified src/OFURI.h from [b3a4d03434] to [90c837e175].

197
198
199
200
201
202
203

204
205
206
207
208
209
210
 * @brief Creates a new URI with the specified local file path.
 *
 * If a directory exists at the specified path, a slash is appended if there is
 * no slash yet.
 *
 * @param path The local file path
 * @return A new, autoreleased OFURI

 */
+ (instancetype)fileURIWithPath: (OFString *)path;

/**
 * @brief Creates a new URI with the specified local file path.
 *
 * @param path The local file path







>







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
 * @brief Creates a new URI with the specified local file path.
 *
 * If a directory exists at the specified path, a slash is appended if there is
 * no slash yet.
 *
 * @param path The local file path
 * @return A new, autoreleased OFURI
 * @throw OFInvalidFormatException The specified path is not a valid path
 */
+ (instancetype)fileURIWithPath: (OFString *)path;

/**
 * @brief Creates a new URI with the specified local file path.
 *
 * @param path The local file path
244
245
246
247
248
249
250

251
252
253
254
255
256
257
 *	  path.
 *
 * If a directory exists at the specified path, a slash is appended if there is
 * no slash yet.
 *
 * @param path The local file path
 * @return An initialized OFURI

 */
- (instancetype)initFileURIWithPath: (OFString *)path;

/**
 * @brief Initializes an already allocated OFURI with the specified local file
 *	  path.
 *







>







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
 *	  path.
 *
 * If a directory exists at the specified path, a slash is appended if there is
 * no slash yet.
 *
 * @param path The local file path
 * @return An initialized OFURI
 * @throw OFInvalidFormatException The specified path is not a valid path
 */
- (instancetype)initFileURIWithPath: (OFString *)path;

/**
 * @brief Initializes an already allocated OFURI with the specified local file
 *	  path.
 *

Modified src/platform/POSIX/OFSubprocess.m from [f41e3bb02c] to [9ff417c581].

359
360
361
362
363
364
365
366


367
368
369
370
371
372
373
374
- (int)fileDescriptorForWriting
{
	return _writePipe[1];
}

- (void)closeForWriting
{
	if (_writePipe[1] != -1)


		close(_writePipe[1]);

	_writePipe[1] = -1;
}

- (void)close
{
	if (_readPipe[0] == -1)







|
>
>
|







359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
- (int)fileDescriptorForWriting
{
	return _writePipe[1];
}

- (void)closeForWriting
{
	if (_readPipe[0] == -1 || _writePipe[1] == -1)
		@throw [OFNotOpenException exceptionWithObject: self];

	close(_writePipe[1]);

	_writePipe[1] = -1;
}

- (void)close
{
	if (_readPipe[0] == -1)

Modified src/platform/Windows/OFSubprocess.m from [4951913bf9] to [bef5ba2521].

366
367
368
369
370
371
372
373


374
375
376
377
378
379
380
381
	}

	return (size_t)bytesWritten;
}

- (void)closeForWriting
{
	if (_writePipe[1] != NULL)


		CloseHandle(_writePipe[1]);

	_writePipe[1] = NULL;
}

- (void)close
{
	if (_readPipe[0] == NULL)







|
>
>
|







366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
	}

	return (size_t)bytesWritten;
}

- (void)closeForWriting
{
	if (_readPipe[0] == NULL || _writePipe[1] == NULL)
		@throw [OFNotOpenException exceptionWithObject: self];

	CloseHandle(_writePipe[1]);

	_writePipe[1] = NULL;
}

- (void)close
{
	if (_readPipe[0] == NULL)