MCPcopy Create free account
hub / github.com/Kitware/VTK / ReadBlock

Method ReadBlock

IO/XMLParser/vtkXMLDataParser.cxx:594–617  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

592
593//------------------------------------------------------------------------------
594int vtkXMLDataParser::ReadBlock(vtkTypeUInt64 block, unsigned char* buffer)
595{
596 size_t uncompressedSize = this->FindBlockSize(block);
597 size_t compressedSize = this->BlockCompressedSizes[block];
598
599 if (!this->DataStream->Seek(this->BlockStartOffsets[block]))
600 {
601 return 0;
602 }
603
604 unsigned char* readBuffer = new unsigned char[compressedSize];
605
606 if (this->DataStream->Read(readBuffer, compressedSize) < compressedSize)
607 {
608 delete[] readBuffer;
609 return 0;
610 }
611
612 size_t result =
613 this->Compressor->Uncompress(readBuffer, compressedSize, buffer, uncompressedSize);
614
615 delete[] readBuffer;
616 return result > 0;
617}
618
619//------------------------------------------------------------------------------
620unsigned char* vtkXMLDataParser::ReadBlock(vtkTypeUInt64 block)

Callers 1

ReadCompressedDataMethod · 0.95

Calls 4

FindBlockSizeMethod · 0.95
SeekMethod · 0.45
ReadMethod · 0.45
UncompressMethod · 0.45

Tested by

no test coverage detected