| 679 | shmFifo * m_out; |
| 680 | #else |
| 681 | void read( void * _buf, int _len ) |
| 682 | { |
| 683 | if( isInvalid() ) |
| 684 | { |
| 685 | memset( _buf, 0, _len ); |
| 686 | return; |
| 687 | } |
| 688 | char * buf = (char *) _buf; |
| 689 | int remaining = _len; |
| 690 | while ( remaining ) |
| 691 | { |
| 692 | ssize_t nread = ::read( m_socket, buf, remaining ); |
| 693 | switch ( nread ) |
| 694 | { |
| 695 | case -1: |
| 696 | fprintf( stderr, |
| 697 | "Error while reading.\n" ); |
| 698 | case 0: |
| 699 | invalidate(); |
| 700 | memset( _buf, 0, _len ); |
| 701 | return; |
| 702 | } |
| 703 | buf += nread; |
| 704 | remaining -= nread; |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | void write( const void * _buf, int _len ) |
| 709 | { |
no test coverage detected