1.1 --- a/BLIP/BLIPReader.m Sat May 24 13:26:02 2008 -0700
1.2 +++ b/BLIP/BLIPReader.m Sun May 25 13:43:03 2008 -0700
1.3 @@ -102,11 +102,9 @@
1.4 SInt32 headerLeft = sizeof(BLIPFrameHeader) - _curBytesRead;
1.5 if( headerLeft > 0 ) {
1.6 // Read (more of) the header:
1.7 - NSInteger bytesRead = [(NSInputStream*)_stream read: (uint8_t*)&_curHeader +_curBytesRead
1.8 - maxLength: headerLeft];
1.9 - if( bytesRead < 0 ) {
1.10 - [self _gotError];
1.11 - } else {
1.12 + NSInteger bytesRead = [self read: (uint8_t*)&_curHeader +_curBytesRead
1.13 + maxLength: headerLeft];
1.14 + if( bytesRead > 0 ) {
1.15 _curBytesRead += bytesRead;
1.16 if( _curBytesRead < sizeof(BLIPFrameHeader) ) {
1.17 // Incomplete header:
1.18 @@ -135,10 +133,8 @@
1.19 if( bodyRemaining > 0 ) {
1.20 uint8_t *dst = _curBody.mutableBytes;
1.21 dst += _curBody.length - bodyRemaining;
1.22 - NSInteger bytesRead = [(NSInputStream*)_stream read: dst maxLength: bodyRemaining];
1.23 - if( bytesRead < 0 )
1.24 - return (void)[self _gotError];
1.25 - else if( bytesRead > 0 ) {
1.26 + NSInteger bytesRead = [self read: dst maxLength: bodyRemaining];
1.27 + if( bytesRead > 0 ) {
1.28 _curBytesRead += bytesRead;
1.29 bodyRemaining -= bytesRead;
1.30 LogTo(BLIPVerbose,@"%@: Read %u bytes of frame body (%u left)",self,bytesRead,bodyRemaining);