Differences From Artifact [befd533abe]:
- File src/OFStream.m — part of check-in [be6adc6e06] at 2012-09-17 15:48:52 on branch trunk — Add -[asyncReadIntoBuffer:exactLength:block:]. (user: js, size: 27988) [annotate] [blame] [check-ins using]
To Artifact [c4d6ff9c2a]:
- File
src/OFStream.m
— part of check-in
[4d9a641d87]
at
2012-09-19 23:02:02
on branch trunk
— Make async I/O possible without blocks.
Async connecting is still missing. (user: js, size: 28993) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
139 140 141 142 143 144 145 146 147 148 149 150 151 152 | { size_t readLength = 0; while (readLength < length) readLength += [self readIntoBuffer: (char*)buffer + readLength length: length - readLength]; } #ifdef OF_HAVE_BLOCKS - (void)asyncReadIntoBuffer: (void*)buffer length: (size_t)length block: (of_stream_async_read_block_t)block { [OFRunLoop OF_addAsyncReadForStream: self | > > > > > > > > > > > > > > > > > > > > > > > > | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | { size_t readLength = 0; while (readLength < length) readLength += [self readIntoBuffer: (char*)buffer + readLength length: length - readLength]; } - (void)asyncReadIntoBuffer: (void*)buffer length: (size_t)length target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer length: length target: target selector: selector]; } - (void)asyncReadIntoBuffer: (void*)buffer exactLength: (size_t)length target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer exactLength: length target: target selector: selector]; } #ifdef OF_HAVE_BLOCKS - (void)asyncReadIntoBuffer: (void*)buffer length: (size_t)length block: (of_stream_async_read_block_t)block { [OFRunLoop OF_addAsyncReadForStream: self |
︙ | ︙ | |||
691 692 693 694 695 696 697 698 699 700 701 702 703 704 | while ((line = [self tryReadLineWithEncoding: encoding]) == nil) if ([self isAtEndOfStream]) return nil; return line; } #ifdef OF_HAVE_BLOCKS - (void)asyncReadLineWithBlock: (of_stream_async_read_line_block_t)block { return [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 block: block]; } | > > > > > > > > > > > > > > > > > > | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | while ((line = [self tryReadLineWithEncoding: encoding]) == nil) if ([self isAtEndOfStream]) return nil; return line; } - (void)asyncReadLineWithTarget: (id)target selector: (SEL)selector { return [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 target: target selector: selector]; } - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadLineForStream: self encoding: encoding target: target selector: selector]; } #ifdef OF_HAVE_BLOCKS - (void)asyncReadLineWithBlock: (of_stream_async_read_line_block_t)block { return [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 block: block]; } |
︙ | ︙ |