ObjFW  Check-in [7ced2e7b6a]

Overview
Comment:Pass the stream for stream exceptions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7ced2e7b6a1464da458c45f68b9c94a7301d01e784da645d7b9a169057efa3a3
User & Date: js on 2011-03-24 21:17:29
Other Links: manifest | tags
Context
2011-03-24
21:29
Pass the parser for OFMalformedXMLExceptions. check-in: 3a9a5001cf user: js tags: trunk
21:17
Pass the stream for stream exceptions. check-in: 7ced2e7b6a user: js tags: trunk
20:36
Pass the socket for socket exceptions. check-in: a8df2cff5f user: js tags: trunk
Changes

Modified src/OFFile.m from [dfa9456896] to [941019ae14].

566
567
568
569
570
571
572

573
574
575
576
577
578
579
580
581
582
583
584
585
586

587
588
589
590
591
592
593
594
595

596
597
598
599
600
601
602
603

604
605
606
607
608
609
610
611
612
613

614
615
616
617
618
619
620
- (size_t)_readNBytes: (size_t)size
	   intoBuffer: (char*)buf
{
	size_t ret;

	if (fd == -1 || eos)
		@throw [OFReadFailedException newWithClass: isa

					     requestedSize: size];
	if ((ret = read(fd, buf, size)) == 0)
		eos = YES;

	return ret;
}

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

	if (fd == -1 || eos || (ret = write(fd, buf, size)) < size)
		@throw [OFWriteFailedException newWithClass: isa

					      requestedSize: size];

	return ret;
}

- (void)_seekToOffset: (off_t)offset
{
	if (lseek(fd, offset, SEEK_SET) == -1)
		@throw [OFSeekFailedException newWithClass: isa];

}

- (off_t)_seekForwardWithOffset: (off_t)offset
{
	off_t ret;

	if ((ret = lseek(fd, offset, SEEK_CUR)) == -1)
		@throw [OFSeekFailedException newWithClass: isa];


	return ret;
}

- (off_t)_seekToOffsetRelativeToEnd: (off_t)offset
{
	off_t ret;

	if ((ret = lseek(fd, offset, SEEK_END)) == -1)
		@throw [OFSeekFailedException newWithClass: isa];


	return ret;
}

- (int)fileDescriptor
{
	return fd;







>














>








|
>







|
>









|
>







566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
- (size_t)_readNBytes: (size_t)size
	   intoBuffer: (char*)buf
{
	size_t ret;

	if (fd == -1 || eos)
		@throw [OFReadFailedException newWithClass: isa
						    stream: self
					     requestedSize: size];
	if ((ret = read(fd, buf, size)) == 0)
		eos = YES;

	return ret;
}

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

	if (fd == -1 || eos || (ret = write(fd, buf, size)) < size)
		@throw [OFWriteFailedException newWithClass: isa
						     stream: self
					      requestedSize: size];

	return ret;
}

- (void)_seekToOffset: (off_t)offset
{
	if (lseek(fd, offset, SEEK_SET) == -1)
		@throw [OFSeekFailedException newWithClass: isa
						    stream: self];
}

- (off_t)_seekForwardWithOffset: (off_t)offset
{
	off_t ret;

	if ((ret = lseek(fd, offset, SEEK_CUR)) == -1)
		@throw [OFSeekFailedException newWithClass: isa
						    stream: self];

	return ret;
}

- (off_t)_seekToOffsetRelativeToEnd: (off_t)offset
{
	off_t ret;

	if ((ret = lseek(fd, offset, SEEK_END)) == -1)
		@throw [OFSeekFailedException newWithClass: isa
						    stream: self];

	return ret;
}

- (int)fileDescriptor
{
	return fd;

Modified src/OFStream.m from [d42d9a7020] to [d928d7a5b3].

712
713
714
715
716
717
718
719

720
721
722
723
724
725
726
727

728
729
730
731
732
733
734
{
#ifndef _WIN32
	int flags;

	isBlocking = enable;

	if ((flags = fcntl([self fileDescriptor], F_GETFL)) == -1)
		@throw [OFSetOptionFailedException newWithClass: isa];


	if (enable)
		flags &= ~O_NONBLOCK;
	else
		flags |= O_NONBLOCK;

	if (fcntl([self fileDescriptor], F_SETFL, flags) == -1)
		@throw [OFSetOptionFailedException newWithClass: isa];

#else
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
#endif
}

- (int)fileDescriptor







|
>







|
>







712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
{
#ifndef _WIN32
	int flags;

	isBlocking = enable;

	if ((flags = fcntl([self fileDescriptor], F_GETFL)) == -1)
		@throw [OFSetOptionFailedException newWithClass: isa
							 stream: self];

	if (enable)
		flags &= ~O_NONBLOCK;
	else
		flags |= O_NONBLOCK;

	if (fcntl([self fileDescriptor], F_SETFL, flags) == -1)
		@throw [OFSetOptionFailedException newWithClass: isa
							 stream: self];
#else
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
#endif
}

- (int)fileDescriptor

Modified src/OFStreamSocket.m from [60c85e14ca] to [e1ff8d6e4c].

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
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	if (eos) {
		OFReadFailedException *e;

		e = [OFReadFailedException newWithClass: isa

					  requestedSize: size];
#ifndef _WIN32
		e->errNo = ENOTCONN;
#else
		e->errNo = WSAENOTCONN;
#endif

		@throw e;
	}

	if ((ret = recv(sock, buf, size, 0)) < 0)
		@throw [OFReadFailedException newWithClass: isa

					     requestedSize: size];

	if (ret == 0)
		eos = YES;

	return ret;
}







>












>







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
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	if (eos) {
		OFReadFailedException *e;

		e = [OFReadFailedException newWithClass: isa
						 stream: self
					  requestedSize: size];
#ifndef _WIN32
		e->errNo = ENOTCONN;
#else
		e->errNo = WSAENOTCONN;
#endif

		@throw e;
	}

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

	if (ret == 0)
		eos = YES;

	return ret;
}
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
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	if (eos) {
		OFWriteFailedException *e;

		e = [OFWriteFailedException newWithClass: isa

					   requestedSize: size];
#ifndef _WIN32
		e->errNo = ENOTCONN;
#else
		e->errNo = WSAENOTCONN;
#endif

		@throw e;
	}

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

#ifdef _WIN32
- (void)setBlocking: (BOOL)enable
{
	u_long v = enable;
	isBlocking = enable;

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

}
#endif

- (int)fileDescriptor
{
	return sock;
}







>












>













|
>







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
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	if (eos) {
		OFWriteFailedException *e;

		e = [OFWriteFailedException newWithClass: isa
						  stream: self
					   requestedSize: size];
#ifndef _WIN32
		e->errNo = ENOTCONN;
#else
		e->errNo = WSAENOTCONN;
#endif

		@throw e;
	}

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

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

#ifdef _WIN32
- (void)setBlocking: (BOOL)enable
{
	u_long v = enable;
	isBlocking = enable;

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

- (int)fileDescriptor
{
	return sock;
}

Modified src/OFTCPSocket.m from [c2279eed1e] to [f3c6437253].

340
341
342
343
344
345
346
347

348
349
350
351
352
353
354
}

- (void)setKeepAlivesEnabled: (BOOL)enable
{
	int v = enable;

	if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, sizeof(v)))
		@throw [OFSetOptionFailedException newWithClass: isa];

}

- (OFString*)remoteAddress
{
	if (sockAddr == NULL || sockAddrLen == 0)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];







|
>







340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
}

- (void)setKeepAlivesEnabled: (BOOL)enable
{
	int v = enable;

	if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, sizeof(v)))
		@throw [OFSetOptionFailedException newWithClass: isa
							 stream: self];
}

- (OFString*)remoteAddress
{
	if (sockAddr == NULL || sockAddrLen == 0)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

Modified src/exceptions/OFAcceptFailedException.m from [12e9aaa538] to [7e7f947ee7].

15
16
17
18
19
20
21


22
23
24
25
26
27
28
29
30








31
32
33
34
35
36
37
 */

#include "config.h"

#import "OFAcceptFailedException.h"
#import "OFString.h"



#import "common.h"

@implementation OFAcceptFailedException
+ newWithClass: (Class)class_
	socket: (OFTCPSocket*)socket
{
	return [[self alloc] initWithClass: class_
				    socket: socket];
}









- initWithClass: (Class)class_
	 socket: (OFTCPSocket*)socket_
{
	self = [super initWithClass: class_];

	@try {







>
>









>
>
>
>
>
>
>
>







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

#include "config.h"

#import "OFAcceptFailedException.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

#import "common.h"

@implementation OFAcceptFailedException
+ newWithClass: (Class)class_
	socket: (OFTCPSocket*)socket
{
	return [[self alloc] initWithClass: class_
				    socket: socket];
}

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

- initWithClass: (Class)class_
	 socket: (OFTCPSocket*)socket_
{
	self = [super initWithClass: class_];

	@try {

Modified src/exceptions/OFAlreadyConnectedException.m from [865fb79629] to [8f294af99b].

14
15
16
17
18
19
20


21
22
23
24
25
26
27
28








29
30
31
32
33
34
35
 * file.
 */

#include "config.h"

#import "OFAlreadyConnectedException.h"
#import "OFString.h"



@implementation OFAlreadyConnectedException
+ newWithClass: (Class)class_
	socket: (OFTCPSocket*)socket
{
	return [[self alloc] initWithClass: class_
				    socket: socket];
}









- initWithClass: (Class)class_
	 socket: (OFTCPSocket*)socket_
{
	self = [super initWithClass: class_];

	@try {







>
>








>
>
>
>
>
>
>
>







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 "OFAlreadyConnectedException.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

@implementation OFAlreadyConnectedException
+ newWithClass: (Class)class_
	socket: (OFTCPSocket*)socket
{
	return [[self alloc] initWithClass: class_
				    socket: socket];
}

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

- initWithClass: (Class)class_
	 socket: (OFTCPSocket*)socket_
{
	self = [super initWithClass: class_];

	@try {

Modified src/exceptions/OFNotConnectedException.m from [25504636c1] to [ba0d7f211d].

14
15
16
17
18
19
20


21
22
23
24
25
26
27
28








29
30
31
32
33
34
35
 * file.
 */

#include "config.h"

#import "OFNotConnectedException.h"
#import "OFString.h"



@implementation OFNotConnectedException
+ newWithClass: (Class)class_
	socket: (OFStreamSocket*)socket
{
	return [[self alloc] initWithClass: class_
				    socket: socket];
}









- initWithClass: (Class)class_
	 socket: (OFStreamSocket*)socket_
{
	self = [super initWithClass: class_];

	@try {







>
>








>
>
>
>
>
>
>
>







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 "OFNotConnectedException.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

@implementation OFNotConnectedException
+ newWithClass: (Class)class_
	socket: (OFStreamSocket*)socket
{
	return [[self alloc] initWithClass: class_
				    socket: socket];
}

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

- initWithClass: (Class)class_
	 socket: (OFStreamSocket*)socket_
{
	self = [super initWithClass: class_];

	@try {

Modified src/exceptions/OFReadOrWriteFailedException.h from [046030975c] to [6e14e8add8].

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
39

40
41
42
43
44
45

46
47
48
49

50
51
52
53
54
55
56
57
58
59
60





61
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFException.h"



/**
 * \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

/**
 * \param class_ The class of the object which caused the exception

 * \param size The requested size of the data that couldn't be read / written
 * \return A new open file failed exception
 */
+  newWithClass: (Class)class_

  requestedSize: (size_t)size;

/**
 * Initializes an already allocated read or write failed exception.
 *
 * \param class_ The class of the object which caused the exception

 * \param size The requested size of the data that couldn't be read / written
 * \return A new open file failed exception
 */
- initWithClass: (Class)class_

  requestedSize: (size_t)size;

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

/**
 * \return The requested size of the data that couldn't be read / written
 */
- (size_t)requestedSize;





@end







>
>





>
|

|



>






>




>






>




>



|

|





>
>
>
>
>

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
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
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFException.h"

@class OFStream;

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

#ifdef OF_HAVE_PROPERTIES
@property (readonly, nonatomic) OFStream *stream;
@property (readonly) size_t requestedSize;
@property (readonly) int errNo;
#endif

/**
 * \param class_ The class of the object which caused the exception
 * \param stream The stream which caused the read or write failed exception
 * \param size The requested size of the data that couldn't be read / written
 * \return A new open file failed exception
 */
+  newWithClass: (Class)class_
	 stream: (OFStream*)stream
  requestedSize: (size_t)size;

/**
 * Initializes an already allocated read or write failed exception.
 *
 * \param class_ The class of the object which caused the exception
 * \param stream The stream which caused the read or write failed exception
 * \param size The requested size of the data that couldn't be read / written
 * \return A new open file failed exception
 */
- initWithClass: (Class)class_
	 stream: (OFStream*)stream
  requestedSize: (size_t)size;

/**
 * \return The stream which caused the read or write failed exception
 */
- (OFStream*)stream;

/**
 * \return The requested size of the data that couldn't be read / written
 */
- (size_t)requestedSize;

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

Modified src/exceptions/OFReadOrWriteFailedException.m from [a76983b7b0] to [e499bb5a9d].

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

#import "OFNotImplementedException.h"

#import "common.h"

@implementation OFReadOrWriteFailedException
+  newWithClass: (Class)class_

  requestedSize: (size_t)size
{
	return [[self alloc] initWithClass: class_

			     requestedSize: size];
}

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

- initWithClass: (Class)class_

  requestedSize: (size_t)size
{
	self = [super initWithClass: class_];



	requestedSize = size;

	if ([class_ isSubclassOfClass: [OFStreamSocket class]])
		errNo = GET_SOCK_ERRNO;
	else
		errNo = GET_ERRNO;




	return self;
}




- (int)errNo


{


	return errNo;
}

- (size_t)requestedSize
{
	return requestedSize;
}





@end







>



>












>




>
>
|

|
|
|
|
>
>
>




>
>
>
|
>
>
|
>
>
|






>
>
>
>
>

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

#import "OFNotImplementedException.h"

#import "common.h"

@implementation OFReadOrWriteFailedException
+  newWithClass: (Class)class_
	 stream: (OFStream*)stream
  requestedSize: (size_t)size
{
	return [[self alloc] initWithClass: class_
				    stream: stream
			     requestedSize: size];
}

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

- initWithClass: (Class)class_
	 stream: (OFStream*)stream_
  requestedSize: (size_t)size
{
	self = [super initWithClass: class_];

	@try {
		stream = [stream_ retain];
		requestedSize = size;

		if ([class_ isSubclassOfClass: [OFStreamSocket class]])
			errNo = GET_SOCK_ERRNO;
		else
			errNo = GET_ERRNO;
	} @catch (id e) {
		return e;
	}

	return self;
}

- (void)dealloc
{
	[stream release];

	[super dealloc];
}

- (OFStream*)stream
{
	return stream;
}

- (size_t)requestedSize
{
	return requestedSize;
}

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

Modified src/exceptions/OFSeekFailedException.h from [b2cc5cbfa4] to [e0877600fb].

12
13
14
15
16
17
18


19
20
21
22
23

24
25
26
27

28
29
30





















31
32
33
34
35
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFException.h"



/**
 * \brief An exception indicating that seeking in a stream failed.
 */
@interface OFSeekFailedException: OFException
{

	int errNo;
}

#ifdef OF_HAVE_PROPERTIES

@property (readonly) int errNo;
#endif






















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







>
>





>
|



>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFException.h"

@class OFSeekableStream;

/**
 * \brief An exception indicating that seeking in a stream failed.
 */
@interface OFSeekFailedException: OFException
{
	OFSeekableStream *stream;
	int		 errNo;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, nonatomic) OFSeekableStream *stream;
@property (readonly) int errNo;
#endif

/**
 * \param stream The stream for which seeking failed
 * \return A new seek failed exception
 */
+ newWithClass: (Class)class_
	stream: (OFSeekableStream*)stream;

/**
 * Initializes an already allocated seek failed exception.
 *
 * \param stream The stream for which seeking failed
 * \return An initialized seek failed exception
 */
- initWithClass: (Class)class_
	 stream: (OFSeekableStream*)stream;

/**
 * \return The stream for which seeking failed
 */
- (OFSeekableStream*)stream;

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

Modified src/exceptions/OFSeekFailedException.m from [f136f958cb] to [22f9ab7eaa].

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

#include "config.h"

#import "OFSeekFailedException.h"
#import "OFString.h"



#import "common.h"

@implementation OFSeekFailedException







- initWithClass: (Class)class_









{
	self = [super initWithClass: class_];



	errNo = GET_ERRNO;





	return self;
}








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

	description = [[OFString alloc] initWithFormat:
	    @"Seeking failed in class %@! " ERRFMT, inClass, ERRPARAM];

	return description;
}






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







>
>



>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>



>
>
|
>
>
>
>



>
>
>
>
>
>
>











>
>
>
>
>






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
84
85
 */

#include "config.h"

#import "OFSeekFailedException.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

#import "common.h"

@implementation OFSeekFailedException
+ newWithClass: (Class)class_
	stream: (OFSeekableStream*)stream
{
	return [[self alloc] initWithClass: class_
				    stream: stream];
}

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

- initWithClass: (Class)class_
	 stream: (OFSeekableStream*)stream_
{
	self = [super initWithClass: class_];

	@try {
		stream = [stream_ retain];
		errNo = GET_ERRNO;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[stream	release];

	[super dealloc];
}

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

	description = [[OFString alloc] initWithFormat:
	    @"Seeking failed in class %@! " ERRFMT, inClass, ERRPARAM];

	return description;
}

- (OFSeekableStream*)stream
{
	return stream;
}

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

Modified src/exceptions/OFSetOptionFailedException.h from [2231035311] to [0409392fd7].

12
13
14
15
16
17
18


19
20
21
22




























23
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFException.h"



/**
 * \brief An exception indicating that setting an option failed.
 */
@interface OFSetOptionFailedException: OFException




























@end







>
>

|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFException.h"

@class OFStream;

/**
 * \brief An exception indicating that setting an option for a stream failed.
 */
@interface OFSetOptionFailedException: OFException
{
	OFStream *stream;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, nonatomic) OFStream *stream;
#endif

/**
 * \param stream The stream for which the option could not be set
 * \return A new set option failed exception
 */
+ newWithClass: (Class)class_
	stream: (OFStream*)stream;

/**
 * Initializes an already allocated set option failed exception.
 *
 * \param stream The stream for which the option could not be set
 * \return An initialized set option failed exception
 */
- initWithClass: (Class)class_
	 stream: (OFStream*)stream;

/**
 * \return The stream for which the option could not be set
 */
- (OFStream*)stream;
@end

Modified src/exceptions/OFSetOptionFailedException.m from [7f4c316959] to [dcdd902585].

14
15
16
17
18
19
20
21


22





































23
24
25
26
27
28
29
30
31
32





33
 * file.
 */

#include "config.h"

#import "OFSetOptionFailedException.h"
#import "OFString.h"



@implementation OFSetOptionFailedException





































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

	description = [[OFString alloc] initWithFormat:
	    @"Setting an option in class %@ failed!", inClass];

	return description;
}





@end








>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










>
>
>
>
>

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
 * file.
 */

#include "config.h"

#import "OFSetOptionFailedException.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

@implementation OFSetOptionFailedException
+ newWithClass: (Class)class_
	stream: (OFStream*)stream
{
	return [[self alloc] initWithClass: class_
				    stream: stream];
}

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

- initWithClass: (Class)class_
	 stream: (OFStream*)stream_
{
	self = [super initWithClass: class_];

	@try {
		stream = [stream_ retain];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[stream release];

	[super dealloc];
}

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

	description = [[OFString alloc] initWithFormat:
	    @"Setting an option in class %@ failed!", inClass];

	return description;
}

- (OFStream*)stream
{
	return stream;
}
@end