RcStatus SemCopyDataUntilEOF( WResFileOffset offset, WResFileID handle, void *buff, int buffsize, int *err_code ) /****************************************************************/ { bool error; WResFileSSize numread; if( RCSEEK( handle, offset, SEEK_SET ) == -1 ) { *err_code = errno; return( RS_READ_ERROR ); } numread = RCREAD( handle, buff, buffsize ); while( numread != 0 ) { if( RCIOERR( handle, numread ) ) { *err_code = errno; return( RS_READ_ERROR ); } error = ResWrite( buff, numread, CurrResFile.handle ); if( error ) { *err_code = LastWresErr(); return( RS_WRITE_ERROR ); } numread = RCREAD( handle, buff, buffsize ); } return( RS_OK ); }
/* * CopyData - */ RcStatus CopyData( uint_32 offset, uint_32 length, WResFileID handle, void *buff, int buffsize, int *err_code ) /***************************************************************************/ { bool error; WResFileSSize numread; if( RCSEEK( handle, offset, SEEK_SET ) == -1 ) { *err_code = errno; return( RS_READ_ERROR ); } while( length > buffsize ) { numread = RCREAD( handle, buff, buffsize ); if( numread != buffsize ) { *err_code = errno; return( RCIOERR( handle, numread ) ? RS_READ_ERROR : RS_READ_INCMPLT ); } length -= buffsize; error = ResWrite( buff, buffsize, CurrResFile.handle ); if( error ) { *err_code = LastWresErr(); return( RS_WRITE_ERROR ); } } numread = RCREAD( handle, buff, length ); if( numread != length ) { *err_code = errno; return( RCIOERR( handle, numread ) ? RS_READ_ERROR : RS_READ_INCMPLT ); } error = ResWrite( buff, length, CurrResFile.handle ); if( error ) { *err_code = errno; return( RS_WRITE_ERROR ); } return( RS_OK ); } /* CopyData */