Modified src/OFDeflateStream.m
from [57e457dcdc]
to [f380a0e937].
︙ | | |
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
-
+
|
uint_fast16_t bits, i, tmp;
uint16_t value;
size_t bytesWritten = 0;
uint8_t *slidingWindow;
uint_fast16_t slidingWindowIndex;
if (_atEndOfStream)
@throw [OFReadFailedException exceptionWithStream: self
@throw [OFReadFailedException exceptionWithObject: self
requestedLength: length];
start:
switch (_state) {
case BLOCK_HEADER:
if OF_UNLIKELY (_inLastBlock) {
[_stream unreadFromBuffer: _buffer + _bufferIndex
|
︙ | | |
Modified src/OFFile.m
from [71494b29e0]
to [79751d7dbc].
︙ | | |
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
|
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
|
-
+
-
+
|
- (size_t)lowlevelReadIntoBuffer: (void*)buffer
length: (size_t)length
{
ssize_t ret;
if (_fd == -1 || _atEndOfStream ||
(ret = read(_fd, buffer, length)) < 0)
@throw [OFReadFailedException exceptionWithStream: self
@throw [OFReadFailedException exceptionWithObject: self
requestedLength: length];
if (ret == 0)
_atEndOfStream = true;
return ret;
}
- (void)lowlevelWriteBuffer: (const void*)buffer
length: (size_t)length
{
if (_fd == -1 || _atEndOfStream || write(_fd, buffer, length) < length)
@throw [OFWriteFailedException exceptionWithStream: self
@throw [OFWriteFailedException exceptionWithObject: self
requestedLength: length];
}
- (off_t)lowlevelSeekToOffset: (off_t)offset
whence: (int)whence
{
off_t ret = lseek(_fd, offset, whence);
|
︙ | | |
Modified src/OFHTTPClient.m
from [c52721c175]
to [3007afbd2c].
︙ | | |
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
-
+
|
- (size_t)lowlevelReadIntoBuffer: (void*)buffer
length: (size_t)length
{
if (_atEndOfStream) {
OFReadFailedException *e;
e = [OFReadFailedException exceptionWithStream: self
e = [OFReadFailedException exceptionWithObject: self
requestedLength: length];
e->_errNo = ENOTCONN;
@throw e;
}
if (!_hasContentLength && !_chunked)
return [_socket readIntoBuffer: buffer
|
︙ | | |
Modified src/OFProcess.m
from [8b087c9ef5]
to [754335c8dd].
︙ | | |
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
-
+
|
!ReadFile(_readPipe[0], buffer, length, &ret, NULL)) {
if (GetLastError() == ERROR_BROKEN_PIPE) {
_atEndOfStream = true;
return 0;
}
#endif
@throw [OFReadFailedException exceptionWithStream: self
@throw [OFReadFailedException exceptionWithObject: self
requestedLength: length];
}
if (ret == 0)
_atEndOfStream = true;
return ret;
|
︙ | | |
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
-
+
|
#else
DWORD ret;
if (_writePipe[1] == NULL || _atEndOfStream ||
!WriteFile(_writePipe[1], buffer, length, &ret, NULL) ||
ret < length)
#endif
@throw [OFWriteFailedException exceptionWithStream: self
@throw [OFWriteFailedException exceptionWithObject: self
requestedLength: length];
}
- (int)fileDescriptorForReading
{
#ifndef _WIN32
return _readPipe[0];
|
︙ | | |
Modified src/OFStdIOStream.m
from [8f40232493]
to [5073a1b1d8].
︙ | | |
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
|
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
|
-
+
-
+
|
- (size_t)lowlevelReadIntoBuffer: (void*)buffer
length: (size_t)length
{
ssize_t ret;
if (_fd == -1 || _atEndOfStream ||
(ret = read(_fd, buffer, length)) < 0)
@throw [OFReadFailedException exceptionWithStream: self
@throw [OFReadFailedException exceptionWithObject: self
requestedLength: length];
if (ret == 0)
_atEndOfStream = true;
return ret;
}
- (void)lowlevelWriteBuffer: (const void*)buffer
length: (size_t)length
{
if (_fd == -1 || _atEndOfStream || write(_fd, buffer, length) < length)
@throw [OFWriteFailedException exceptionWithStream: self
@throw [OFWriteFailedException exceptionWithObject: self
requestedLength: length];
}
- (int)fileDescriptorForReading
{
return _fd;
}
|
︙ | | |
Modified src/OFStreamSocket.m
from [42d45e3daf]
to [5b827e504d].
︙ | | |
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
|
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
|
-
+
-
+
-
+
-
+
|
if (_socket == INVALID_SOCKET)
@throw [OFNotConnectedException exceptionWithSocket: self];
if (_atEndOfStream) {
OFReadFailedException *e;
e = [OFReadFailedException exceptionWithStream: self
e = [OFReadFailedException exceptionWithObject: self
requestedLength: length];
e->_errNo = ENOTCONN;
@throw e;
}
if ((ret = recv(_socket, buffer, length, 0)) < 0)
@throw [OFReadFailedException exceptionWithStream: self
@throw [OFReadFailedException exceptionWithObject: self
requestedLength: length];
if (ret == 0)
_atEndOfStream = true;
return ret;
}
- (void)lowlevelWriteBuffer: (const void*)buffer
length: (size_t)length
{
if (_socket == INVALID_SOCKET)
@throw [OFNotConnectedException exceptionWithSocket: self];
if (_atEndOfStream) {
OFWriteFailedException *e;
e = [OFWriteFailedException exceptionWithStream: self
e = [OFWriteFailedException exceptionWithObject: self
requestedLength: length];
e->_errNo = ENOTCONN;
@throw e;
}
if (send(_socket, buffer, length, 0) < length)
@throw [OFWriteFailedException exceptionWithStream: self
@throw [OFWriteFailedException exceptionWithObject: self
requestedLength: length];
}
#ifdef _WIN32
- (void)setBlocking: (bool)enable
{
u_long v = enable;
|
︙ | | |
Modified src/OFZIPArchive.m
from [9442194f09]
to [85d6f8f249].
︙ | | |
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
|
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
|
-
+
|
- (size_t)lowlevelReadIntoBuffer: (void*)buffer
length: (size_t)length
{
size_t min, ret;
if (_atEndOfStream)
@throw [OFReadFailedException exceptionWithStream: self
@throw [OFReadFailedException exceptionWithObject: self
requestedLength: length];
if (_hasDataDescriptor) {
if ([_stream isAtEndOfStream]) {
uint32_t CRC32;
_atEndOfStream = true;
|
︙ | | |
Modified src/exceptions/OFAddressTranslationFailedException.h
from [9113e61311]
to [7cb02c2c3b].
︙ | | |
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
-
-
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
|
#import "OFException.h"
#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif
@class OFTCPSocket;
/*!
* @brief An exception indicating the translation of an address failed.
*/
@interface OFAddressTranslationFailedException: OFException
{
OFTCPSocket *_socket;
OFString *_host;
int _errNo;
id _socket;
OFString *_host;
int _errNo;
}
#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFString *host;
@property (readonly, retain) OFTCPSocket *socket;
@property (readonly, retain) id socket;
@property (readonly) int errNo;
#endif
/*!
* @brief Creates a new, autoreleased address translation failed exception.
*
* @param socket The socket which could not translate the address
* @return A new, autoreleased address translation failed exception
*/
+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket;
+ (instancetype)exceptionWithSocket: (id)socket;
/*!
* @brief Creates a new, autoreleased address translation failed exception.
*
* @param host The host for which translation was requested
* @return A new, autoreleased address translation failed exception
*/
+ (instancetype)exceptionWithHost: (OFString*)host;
/*!
* @brief Creates a new, autoreleased address translation failed exception.
*
* @param host The host for which translation was requested
* @param socket The socket which could not translate the address
* @return A new, autoreleased address translation failed exception
*/
+ (instancetype)exceptionWithHost: (OFString*)host
socket: (OFTCPSocket*)socket;
socket: (id)socket;
/*!
* @brief Initializes an already allocated address translation failed exception.
*
* @param socket The socket which could not translate the address
* @return An initialized address translation failed exception
*/
- initWithSocket: (OFTCPSocket*)socket;
- initWithSocket: (id)socket;
/*!
* @brief Initializes an already allocated address translation failed exception.
*
* @param host The host for which translation was requested
* @return An initialized address translation failed exception
*/
- initWithHost: (OFString*)host;
/*!
* @brief Initializes an already allocated address translation failed exception.
*
* @param host The host for which translation was requested
* @param socket The socket which could not translate the address
* @return An initialized address translation failed exception
*/
- initWithHost: (OFString*)host
socket: (OFTCPSocket*)socket;
socket: (id)socket;
/*!
* @brief Returns the host for which the address translation was requested.
*
* @return The host for which the address translation was requested
*/
- (OFString*)host;
/*!
* @brief Returns the socket which could not translate the address.
*
* @return The socket which could not translate the address
*/
- (OFTCPSocket*)socket;
- (id)socket;
/*!
* @brief Returns the errno from when the exception was created.
*
* @return The errno from when the exception was created
*/
- (int)errNo;
@end
|
Modified src/exceptions/OFAddressTranslationFailedException.m
from [c1844d2c7e]
to [9b225aa65d].
︙ | | |
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
-
-
+
-
+
-
+
-
+
|
* file.
*/
#include "config.h"
#import "OFAddressTranslationFailedException.h"
#import "OFString.h"
#import "OFTCPSocket.h"
#import "common.h"
#import "macros.h"
@implementation OFAddressTranslationFailedException
+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket
+ (instancetype)exceptionWithSocket: (id)socket
{
return [[[self alloc] initWithSocket: socket] autorelease];
}
+ (instancetype)exceptionWithHost: (OFString*)host
{
return [[[self alloc] initWithHost: host] autorelease];
}
+ (instancetype)exceptionWithHost: (OFString*)host
socket: (OFTCPSocket*)socket
socket: (id)socket
{
return [[[self alloc] initWithHost: host
socket: socket] autorelease];
}
- init
{
OF_INVALID_INIT_METHOD
}
- initWithSocket: (OFTCPSocket*)socket
- initWithSocket: (id)socket
{
return [self initWithHost: nil
socket: socket];
}
- initWithHost: (OFString*)host
{
return [self initWithHost: host
socket: nil];
}
- initWithHost: (OFString*)host
socket: (OFTCPSocket*)socket
socket: (id)socket
{
self = [super init];
@try {
_host = [host copy];
_socket = [socket retain];
_errNo = GET_AT_ERRNO;
|
︙ | | |
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
-
+
|
}
- (OFString*)host
{
OF_GETTER(_host, true)
}
- (OFTCPSocket*)socket
- (id)socket
{
OF_GETTER(_socket, true)
}
- (int)errNo
{
#ifdef _WIN32
return of_wsaerr_to_errno(_errNo);
#else
return _errNo;
#endif
}
@end
|
Modified src/exceptions/OFBindFailedException.h
from [0d8b00fa8e]
to [e51e2f0116].
︙ | | |
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
-
-
-
-
-
-
+
+
+
+
-
+
-
+
-
+
-
+
|
#import "OFException.h"
#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif
@class OFTCPSocket;
/*!
* @brief An exception indicating that binding a socket failed.
*/
@interface OFBindFailedException: OFException
{
OFTCPSocket *_socket;
OFString *_host;
uint16_t _port;
int _errNo;
id _socket;
OFString *_host;
uint16_t _port;
int _errNo;
}
#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFString *host;
@property (readonly) uint16_t port;
@property (readonly, retain) OFTCPSocket *socket;
@property (readonly, retain) id socket;
@property (readonly) int errNo;
#endif
/*!
* @brief Creates a new, autoreleased bind failed exception.
*
* @param host The host on which binding failed
* @param port The port on which binding failed
* @param socket The socket which could not be bound
* @return A new, autoreleased bind failed exception
*/
+ (instancetype)exceptionWithHost: (OFString*)host
port: (uint16_t)port
socket: (OFTCPSocket*)socket;
socket: (id)socket;
/*!
* @brief Initializes an already allocated bind failed exception.
*
* @param host The host on which binding failed
* @param port The port on which binding failed
* @param socket The socket which could not be bound
* @return An initialized bind failed exception
*/
- initWithHost: (OFString*)host
port: (uint16_t)port
socket: (OFTCPSocket*)socket;
socket: (id)socket;
/*!
* @brief Returns the host on which binding failed.
*
* @return The host on which binding failed
*/
- (OFString*)host;
/*!
* @brief Return the port on which binding failed.
*
* @return The port on which binding failed
*/
- (uint16_t)port;
/*!
* @brief Returns the socket which could not be bound.
*
* @return The socket which could not be bound
*/
- (OFTCPSocket*)socket;
- (id)socket;
/*!
* @brief Returns the errno from when the exception was created.
*
* @return The errno from when the exception was created
*/
- (int)errNo;
@end
|
Modified src/exceptions/OFBindFailedException.m
from [fd6546c3c3]
to [7ed64ab589].
︙ | | |
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
39
40
41
42
43
44
45
46
47
48
49
50
|
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
39
40
41
42
43
44
45
46
47
48
49
|
-
-
+
-
+
|
* file.
*/
#include "config.h"
#import "OFBindFailedException.h"
#import "OFString.h"
#import "OFTCPSocket.h"
#import "common.h"
#import "macros.h"
@implementation OFBindFailedException
+ (instancetype)exceptionWithHost: (OFString*)host
port: (uint16_t)port
socket: (OFTCPSocket*)socket
socket: (id)socket
{
return [[[self alloc] initWithHost: host
port: port
socket: socket] autorelease];
}
- init
{
OF_INVALID_INIT_METHOD
}
- initWithHost: (OFString*)host
port: (uint16_t)port
socket: (OFTCPSocket*)socket
socket: (id)socket
{
self = [super init];
@try {
_host = [host copy];
_port = port;
_socket = [socket retain];
|
︙ | | |
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
-
+
|
}
- (uint16_t)port
{
return _port;
}
- (OFTCPSocket*)socket
- (id)socket
{
OF_GETTER(_socket, true)
}
- (int)errNo
{
#ifdef _WIN32
return of_wsaerr_to_errno(_errNo);
#else
return _errNo;
#endif
}
@end
|
Modified src/exceptions/OFListenFailedException.h
from [e45067b3a1]
to [ab3ab8d43b].
︙ | | |
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
-
-
-
+
-
+
-
+
-
+
-
+
|
#import "OFException.h"
#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif
@class OFTCPSocket;
/*!
* @brief An exception indicating that listening on the socket failed.
*/
@interface OFListenFailedException: OFException
{
OFTCPSocket *_socket;
id _socket;
int _backLog, _errNo;
}
#ifdef OF_HAVE_PROPERTIES
@property (readonly, retain) OFTCPSocket *socket;
@property (readonly, retain) id socket;
@property (readonly) int backLog, errNo;
#endif
/*!
* @brief Creates a new, autoreleased listen failed exception.
*
* @param socket The socket which failed to listen
* @param backLog The requested size of the back log
* @return A new, autoreleased listen failed exception
*/
+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket
+ (instancetype)exceptionWithSocket: (id)socket
backLog: (int)backLog;
/*!
* @brief Initializes an already allocated listen failed exception
*
* @param socket The socket which failed to listen
* @param backLog The requested size of the back log
* @return An initialized listen failed exception
*/
- initWithSocket: (OFTCPSocket*)socket
- initWithSocket: (id)socket
backLog: (int)backLog;
/*!
* @brief Returns the socket which failed to listen.
*
* @return The socket which failed to listen
*/
- (OFTCPSocket*)socket;
- (id)socket;
/*!
* @brief Returns the requested back log.
*
* @return The requested back log
*/
- (int)backLog;
|
︙ | | |
Modified src/exceptions/OFListenFailedException.m
from [55d0f6fc06]
to [b2b7b98b39].
︙ | | |
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
39
40
41
42
43
44
45
46
|
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
39
40
41
42
43
44
45
|
-
-
+
-
+
|
* file.
*/
#include "config.h"
#import "OFListenFailedException.h"
#import "OFString.h"
#import "OFTCPSocket.h"
#import "common.h"
#import "macros.h"
@implementation OFListenFailedException
+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket
+ (instancetype)exceptionWithSocket: (id)socket
backLog: (int)backLog
{
return [[[self alloc] initWithSocket: socket
backLog: backLog] autorelease];
}
- init
{
OF_INVALID_INIT_METHOD
}
- initWithSocket: (OFTCPSocket*)socket
- initWithSocket: (id)socket
backLog: (int)backLog
{
self = [super init];
_socket = [socket retain];
_backLog = backLog;
_errNo = GET_SOCK_ERRNO;
|
︙ | | |
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
-
+
|
- (OFString*)description
{
return [OFString stringWithFormat:
@"Failed to listen in socket of type %@ with a back log of %d! "
ERRFMT, [_socket class], _backLog, ERRPARAM];
}
- (OFTCPSocket*)socket
- (id)socket
{
OF_GETTER(_socket, true)
}
- (int)backLog
{
return _backLog;
|
︙ | | |
Modified src/exceptions/OFNotConnectedException.h
from [4d081e6530]
to [913bbdc96f].
︙ | | |
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
54
55
56
57
58
59
|
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
54
55
56
57
|
-
-
-
+
-
+
-
+
-
+
-
+
|
#import "OFException.h"
#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif
@class OFStreamSocket;
/*!
* @brief An exception indicating a socket is not connected or bound.
*/
@interface OFNotConnectedException: OFException
{
OFStreamSocket *_socket;
id _socket;
}
#ifdef OF_HAVE_PROPERTIES
@property (readonly, retain) OFStreamSocket *socket;
@property (readonly, retain) id socket;
#endif
/*!
* @brief Creates a new, autoreleased not connected exception.
*
* @param socket The socket which is not connected
* @return A new, autoreleased not connected exception
*/
+ (instancetype)exceptionWithSocket: (OFStreamSocket*)socket;
+ (instancetype)exceptionWithSocket: (id)socket;
/*!
* @brief Initializes an already allocated not connected exception.
*
* @param socket The socket which is not connected
* @return An initialized not connected exception
*/
- initWithSocket: (OFStreamSocket*)socket;
- initWithSocket: (id)socket;
/*!
* @brief Returns the socket which is not connected.
*
* @return The socket which is not connected
*/
- (OFStreamSocket*)socket;
- (id)socket;
@end
|
Modified src/exceptions/OFNotConnectedException.m
from [630fdbfb50]
to [916c8267e0].
︙ | | |
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
39
40
41
42
43
44
|
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
39
40
41
42
43
|
-
-
+
-
+
|
* file.
*/
#include "config.h"
#import "OFNotConnectedException.h"
#import "OFString.h"
#import "OFTCPSocket.h"
#import "common.h"
#import "macros.h"
@implementation OFNotConnectedException
+ (instancetype)exceptionWithSocket: (OFStreamSocket*)socket
+ (instancetype)exceptionWithSocket: (id)socket
{
return [[[self alloc] initWithSocket: socket] autorelease];
}
- init
{
OF_INVALID_INIT_METHOD
}
- initWithSocket: (OFStreamSocket*)socket
- initWithSocket: (id)socket
{
self = [super init];
_socket = [socket retain];
return self;
}
|
︙ | | |
53
54
55
56
57
58
59
60
61
62
63
64
|
52
53
54
55
56
57
58
59
60
61
62
63
|
-
+
|
- (OFString*)description
{
return [OFString stringWithFormat:
@"The socket of type %@ is not connected or bound!",
[_socket class]];
}
- (OFStreamSocket*)socket
- (id)socket
{
OF_GETTER(_socket, true)
}
@end
|
Modified src/exceptions/OFReadFailedException.h
from [46fdd760d4]
to [9d61550da4].
︙ | | |
13
14
15
16
17
18
19
20
21
22
23
|
13
14
15
16
17
18
19
20
21
22
23
|
-
+
|
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFReadOrWriteFailedException.h"
/*!
* @brief An exception indicating a read on a stream failed.
* @brief An exception indicating that reading from an object failed.
*/
@interface OFReadFailedException: OFReadOrWriteFailedException
@end
|
Modified src/exceptions/OFReadFailedException.m
from [dfa0e4d747]
to [47786b607d].
︙ | | |
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
-
-
-
+
+
|
* file.
*/
#include "config.h"
#import "OFReadFailedException.h"
#import "OFString.h"
#import "OFStream.h"
#import "common.h"
@implementation OFReadFailedException
- (OFString*)description
{
return [OFString stringWithFormat:
@"Failed to read %zu bytes in a stream of type %@! " ERRFMT,
_requestedLength, [_stream class], ERRPARAM];
@"Failed to read %zu bytes from an object of type %@! " ERRFMT,
_requestedLength, [_object class], ERRPARAM];
}
@end
|
Modified src/exceptions/OFReadOrWriteFailedException.h
from [efb2743042]
to [1abbcc8757].
︙ | | |
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
-
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
* file.
*/
#include <errno.h>
#import "OFException.h"
@class OFStream;
/*!
* @brief An exception indicating a read or write to a stream failed.
* @brief An exception indicating that reading from or writing to an object
* failed.
*/
@interface OFReadOrWriteFailedException: OFException
{
OFStream *_stream;
size_t _requestedLength;
id _object;
size_t _requestedLength;
@public
int _errNo;
int _errNo;
}
#ifdef OF_HAVE_PROPERTIES
@property (readonly, retain) OFStream *stream;
@property (readonly, retain) id object;
@property (readonly) size_t requestedLength;
@property (readonly) int errNo;
#endif
/*!
* @brief Creates a new, autoreleased read or write failed exception.
*
* @param stream The stream which caused the read or write failed exception
* @param object The object from which reading or to which writing failed
* @param requestedLength The requested length of the data that couldn't be
* read / written
* @return A new, autoreleased read or write failed exception
*/
+ (instancetype)exceptionWithStream: (OFStream*)stream
+ (instancetype)exceptionWithObject: (id)object
requestedLength: (size_t)requestedLength;
/*!
* @brief Initializes an already allocated read or write failed exception.
*
* @param stream The stream which caused the read or write failed exception
* @param object The object from which reading or to which writing failed
* @param requestedLength The requested length of the data that couldn't be
* read / written
* @return A new open file failed exception
*/
- initWithStream: (OFStream*)stream
- initWithObject: (id)object
requestedLength: (size_t)requestedLength;
/*!
* @brief Returns the stream which caused the read or write failed exception.
* @brief Returns the object from which reading or to which writing failed
*
* @return The stream which caused the read or write failed exception
*/
- (OFStream*)stream;
- (id)object;
/*!
* @brief Returns the requested length of the data that couldn't be read /
* written.
*
* @return The requested length of the data that couldn't be read / written
*/
|
︙ | | |
Modified src/exceptions/OFReadOrWriteFailedException.m
from [fa0e710750]
to [d342160908].
︙ | | |
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
-
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
|
* file.
*/
#include "config.h"
#import "OFReadOrWriteFailedException.h"
#import "OFString.h"
#import "OFStream.h"
#ifdef OF_HAVE_SOCKETS
# import "OFStreamSocket.h"
#endif
#import "common.h"
#import "macros.h"
@implementation OFReadOrWriteFailedException
+ (instancetype)exceptionWithStream: (OFStream*)stream
+ (instancetype)exceptionWithObject: (id)object
requestedLength: (size_t)requestedLength
{
return [[[self alloc] initWithStream: stream
return [[[self alloc] initWithObject: object
requestedLength: requestedLength] autorelease];
}
- init
{
OF_INVALID_INIT_METHOD
}
- initWithStream: (OFStream*)stream
- initWithObject: (id)object
requestedLength: (size_t)requestedLength
{
self = [super init];
_stream = [stream retain];
_object = [object retain];
_requestedLength = requestedLength;
#ifdef OF_HAVE_SOCKETS
if ([stream isKindOfClass: [OFStreamSocket class]])
if ([object isKindOfClass: [OFStreamSocket class]])
_errNo = GET_SOCK_ERRNO;
else
#endif
_errNo = GET_ERRNO;
return self;
}
- (void)dealloc
{
[_stream release];
[_object release];
[super dealloc];
}
- (OFString*)description
{
return [OFString stringWithFormat:
@"Failed to read or write %zu bytes in a stream of type "
@"%@! " ERRFMT, _requestedLength, [_stream class], ERRPARAM];
@"Failed to read or write %zu bytes from / to an object of type "
@"%@! " ERRFMT, _requestedLength, [_object class], ERRPARAM];
}
- (OFStream*)stream
- (id)object
{
OF_GETTER(_stream, true)
OF_GETTER(_object, true)
}
- (size_t)requestedLength
{
return _requestedLength;
}
|
︙ | | |
Modified src/exceptions/OFWriteFailedException.h
from [ff3d60b170]
to [be49e51e6a].
︙ | | |
13
14
15
16
17
18
19
20
21
22
23
|
13
14
15
16
17
18
19
20
21
22
23
|
-
+
|
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFReadOrWriteFailedException.h"
/*!
* @brief An exception indicating a write to a stream failed.
* @brief An exception indicating that writing to an object failed.
*/
@interface OFWriteFailedException: OFReadOrWriteFailedException
@end
|
Modified src/exceptions/OFWriteFailedException.m
from [ee35e3bb2f]
to [49b4f5d815].
︙ | | |
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
-
-
-
+
+
|
* file.
*/
#include "config.h"
#import "OFWriteFailedException.h"
#import "OFString.h"
#import "OFStream.h"
#import "common.h"
@implementation OFWriteFailedException
- (OFString*)description
{
return [OFString stringWithFormat:
@"Failed to write %zu bytes in a stream of type %@! " ERRFMT,
_requestedLength, [_stream class], ERRPARAM];
@"Failed to write %zu bytes to an object of type %@! " ERRFMT,
_requestedLength, [_object class], ERRPARAM];
}
@end
|