MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / ReadData

Method ReadData

Source/Utility/ZLibWrapper.cpp:187–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185//
186//*****************************************************************************
187bool CInStream::ReadData( void * data, u32 length )
188{
189 if ( mFile != NULL )
190 {
191 u8 * current_ptr( reinterpret_cast< u8 * >( data ) );
192 u32 bytes_remaining( length );
193
194 while( bytes_remaining > 0 )
195 {
196 u32 bytes_to_process( Min( bytes_remaining, u32(mBytesAvailable) ) );
197
198 if( bytes_to_process > 0 )
199 {
200 #ifdef DAEDALUS_ENABLE_ASSERTS
201 DAEDALUS_ASSERT( mBufferOffset + bytes_to_process <= u32(BUFFER_SIZE), "Reading too many bytes" );
202 #endif
203 memcpy( current_ptr, mBuffer + mBufferOffset, bytes_to_process );
204
205 current_ptr += bytes_to_process;
206 bytes_remaining -= bytes_to_process;
207 mBufferOffset += bytes_to_process;
208 mBytesAvailable -= bytes_to_process;
209 }
210
211 if( mBytesAvailable == 0 )
212 {
213 if( !Fill() )
214 {
215 return false;
216 }
217 }
218 }
219
220 return true;
221 }
222
223 return false;
224}
225
226//*****************************************************************************
227//

Callers 4

SynchPointMethod · 0.80
SynchDataMethod · 0.80
skipMethod · 0.80
readMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected