MCPcopy Create free account
hub / github.com/cinder/Cinder / loadStreamMemory

Function loadStreamMemory

src/cinder/Stream.cpp:715–731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713}
714
715void loadStreamMemory( IStreamRef is, std::shared_ptr<uint8_t> *resultData, size_t *resultDataSize )
716{
717 // prevent crash if stream is not valid
718 if( ! is )
719 throw StreamExc();
720
721 off_t fileSize = is->size();
722 if( fileSize > std::numeric_limits<off_t>::max() )
723 throw StreamExcOutOfMemory();
724
725 *resultData = std::shared_ptr<uint8_t>( (uint8_t*)malloc( static_cast<size_t>( fileSize ) ), free );
726 if( ! (*resultData ) )
727 throw StreamExcOutOfMemory();
728
729 *resultDataSize = static_cast<size_t>( fileSize );
730 is->readDataAvailable( resultData->get(), static_cast<size_t>( fileSize ) );
731}
732
733BufferRef loadStreamBuffer( IStreamRef is )
734{

Callers

nothing calls this directly

Calls 4

maxFunction · 0.50
sizeMethod · 0.45
readDataAvailableMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected