Overview
Comment: | Pass offset and whence for OFSeekFailedExceptions. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b940af1dd62b7165cc50c6d09c520be4 |
User & Date: | js on 2011-03-27 17:16:27 |
Other Links: | manifest | tags |
Context
2011-03-27
| ||
17:17 | Add src/exceptions to Doxyfile. check-in: 6d7bdcfc21 user: js tags: trunk | |
17:16 | Pass offset and whence for OFSeekFailedExceptions. check-in: b940af1dd6 user: js tags: trunk | |
2011-03-25
| ||
15:48 | Pass the condition for condition exceptions. check-in: b7142607c2 user: js tags: trunk | |
Changes
Modified src/OFFile.m from [941019ae14] to [e6cadbff05].
︙ | ︙ | |||
591 592 593 594 595 596 597 | return ret; } - (void)_seekToOffset: (off_t)offset { if (lseek(fd, offset, SEEK_SET) == -1) @throw [OFSeekFailedException newWithClass: isa | | > > | > > | > > | 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 626 627 628 629 630 631 | return ret; } - (void)_seekToOffset: (off_t)offset { if (lseek(fd, offset, SEEK_SET) == -1) @throw [OFSeekFailedException newWithClass: isa stream: self offset: offset whence: SEEK_SET]; } - (off_t)_seekForwardWithOffset: (off_t)offset { off_t ret; if ((ret = lseek(fd, offset, SEEK_CUR)) == -1) @throw [OFSeekFailedException newWithClass: isa stream: self offset: offset whence: SEEK_CUR]; 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 offset: offset whence: SEEK_END]; return ret; } - (int)fileDescriptor { return fd; |
︙ | ︙ |
Modified src/exceptions/OFSeekFailedException.h from [e0877600fb] to [9d9ba3b111].
︙ | ︙ | |||
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 39 | * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * 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_ | > > > > > > > > | > > > > | > > > > > > > > > > > > | 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 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 | * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * 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. */ #include <unistd.h> #import "OFException.h" @class OFSeekableStream; /** * \brief An exception indicating that seeking in a stream failed. */ @interface OFSeekFailedException: OFException { OFSeekableStream *stream; off_t offset; int whence; int errNo; } #ifdef OF_HAVE_PROPERTIES @property (readonly, nonatomic) OFSeekableStream *stream; @property (readonly) off_t offset; @property (readonly) int whence; @property (readonly) int errNo; #endif /** * \param stream The stream for which seeking failed * \param offset The offset to which seeking failed * \param whence To what the offset is relative * \return A new seek failed exception */ + newWithClass: (Class)class_ stream: (OFSeekableStream*)stream offset: (off_t)offset whence: (int)whence; /** * Initializes an already allocated seek failed exception. * * \param stream The stream for which seeking failed * \param offset The offset to which seeking failed * \param whence To what the offset is relative * \return An initialized seek failed exception */ - initWithClass: (Class)class_ stream: (OFSeekableStream*)stream offset: (off_t)offset whence: (int)whence; /** * \return The stream for which seeking failed */ - (OFSeekableStream*)stream; /** * \return The offset to which seeking failed */ - (off_t)offset; /** * \return To what the offset is relative */ - (int)whence; /** * \return The errno from when the exception was created */ - (int)errNo; @end |
Modified src/exceptions/OFSeekFailedException.m from [22f9ab7eaa] to [6ded05d92b].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 | #import "OFNotImplementedException.h" #import "common.h" @implementation OFSeekFailedException + newWithClass: (Class)class_ stream: (OFSeekableStream*)stream { return [[self alloc] initWithClass: class_ | > > | > > > > > > | 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 | #import "OFNotImplementedException.h" #import "common.h" @implementation OFSeekFailedException + newWithClass: (Class)class_ stream: (OFSeekableStream*)stream offset: (off_t)offset whence: (int)whence { return [[self alloc] initWithClass: class_ stream: stream offset: offset whence: whence]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - initWithClass: (Class)class_ stream: (OFSeekableStream*)stream_ offset: (off_t)offset_ whence: (int)whence_ { self = [super initWithClass: class_]; @try { stream = [stream_ retain]; offset = offset_; whence = whence_; errNo = GET_ERRNO; } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 | return description; } - (OFSeekableStream*)stream { return stream; } - (int)errNo { return errNo; } @end | > > > > > > > > > > | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | return description; } - (OFSeekableStream*)stream { return stream; } - (off_t)offset { return offset; } - (int)whence { return whence; } - (int)errNo { return errNo; } @end |