MCPcopy Create free account
hub / github.com/PDAL/PDAL / readPhysicalPage

Method readPhysicalPage

plugins/e57/libE57Format/src/CheckedFile.cpp:743–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

741}
742
743void CheckedFile::readPhysicalPage( char *page_buffer, uint64_t page )
744{
745#ifdef E57_VERBOSE
746 // cout << "readPhysicalPage, page:" << page << std::endl;
747#endif
748
749#ifdef E57_CHECK_FILE_DEBUG
750 const uint64_t physicalLength = length( Physical );
751
752 assert( page * physicalPageSize < physicalLength );
753#endif
754
755 // Seek to start of physical page
756 seek( page * physicalPageSize, Physical );
757
758 if ( ( fd_ < 0 ) && ( bufView_ != nullptr ) )
759 {
760 bufView_->read( page_buffer, physicalPageSize );
761 return;
762 }
763
764#if defined( _MSC_VER )
765 int result = ::_read( fd_, page_buffer, physicalPageSize );
766#elif defined( __GNUC__ )
767 ssize_t result = ::read( fd_, page_buffer, physicalPageSize );
768#else
769#error "no supported compiler defined"
770#endif
771
772 if ( result < 0 || static_cast<size_t>( result ) != physicalPageSize )
773 {
774 throw E57_EXCEPTION2( ErrorReadFailed,
775 "fileName=" + fileName_ + " result=" + toString( result ) );
776 }
777}
778
779void CheckedFile::writePhysicalPage( char *page_buffer, uint64_t page )
780{

Callers

nothing calls this directly

Calls 4

readFunction · 0.85
toStringFunction · 0.70
seekFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected