MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / readData

Method readData

physx/source/fastxml/src/PsFastXml.cpp:354–445  ·  view source on GitHub ↗

if we have finished processing the data we had pending..

Source from the content-addressed store, hash-verified

352
353 // if we have finished processing the data we had pending..
354 char* readData(char* scan)
355 {
356 for(uint32_t i = 0; i < (mStackIndex + 1); i++)
357 {
358 if(!mStackAllocated[i])
359 {
360 const char* text = mStack[i];
361 if(text)
362 {
363 uint32_t tlen = uint32_t(strlen(text));
364 mStack[i] = static_cast<const char*>(mCallback->allocate(tlen + 1));
365 PxMemCopy(const_cast<void*>(static_cast<const void*>(mStack[i])), text, tlen + 1);
366 mStackAllocated[i] = true;
367 }
368 }
369 }
370
371 if(!mStreamFromMemory)
372 {
373 if(scan == NULL)
374 {
375 uint32_t seekLoc = mFileBuf->tell();
376 mReadBufferSize = (mFileBuf->getLength() - seekLoc);
377 }
378 else
379 {
380 return scan;
381 }
382 }
383
384 if(mReadBuffer == NULL)
385 {
386 mReadBuffer = static_cast<char*>(mCallback->allocate(mReadBufferSize + 1));
387 }
388 uint32_t offset = 0;
389 uint32_t readLen = mReadBufferSize;
390
391 if(scan)
392 {
393 offset = uint32_t(scan - mReadBuffer);
394 uint32_t copyLen = mReadBufferSize - offset;
395 if(copyLen)
396 {
397 PX_ASSERT(scan >= mReadBuffer);
398 memmove(mReadBuffer, scan, copyLen);
399 mReadBuffer[copyLen] = 0;
400 readLen = mReadBufferSize - copyLen;
401 }
402 offset = copyLen;
403 }
404
405 uint32_t readCount = mFileBuf->read(&mReadBuffer[offset], readLen);
406
407 while(readCount > 0)
408 {
409
410 mReadBuffer[readCount + offset] = 0; // end of string terminator...
411 mReadBufferEnd = &mReadBuffer[readCount + offset];

Callers

nothing calls this directly

Calls 6

PxMemCopyFunction · 0.85
getLengthMethod · 0.80
allocateMethod · 0.45
tellMethod · 0.45
readMethod · 0.45
deallocateMethod · 0.45

Tested by

no test coverage detected