MCPcopy Create free account
hub / github.com/LAStools/LAStools / laszip_read_header

Function laszip_read_header

LASzip/src/laszip_dll.cpp:3687–4602  ·  view source on GitHub ↗

---------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

3685
3686/*---------------------------------------------------------------------------*/
3687static I32
3688laszip_read_header(
3689 laszip_dll_struct* laszip_dll
3690 , laszip_BOOL* is_compressed
3691)
3692{
3693 U32 i;
3694
3695 // read the header variable after variable
3696
3697 CHAR file_signature[5];
3698 try { laszip_dll->streamin->getBytes((U8*)file_signature, 4); } catch(...)
3699 {
3700 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "reading header.file_signature");
3701 return 1;
3702 }
3703 if (strncmp(file_signature, "LASF", 4) != 0)
3704 {
3705 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "wrong file_signature. not a LAS/LAZ file.");
3706 return 1;
3707 }
3708 try { laszip_dll->streamin->get16bitsLE((U8*)&(laszip_dll->header.file_source_ID)); } catch(...)
3709 {
3710 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "reading header.file_source_ID");
3711 return 1;
3712 }
3713 try { laszip_dll->streamin->get16bitsLE((U8*)&(laszip_dll->header.global_encoding)); } catch(...)
3714 {
3715 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "reading header.global_encoding");
3716 return 1;
3717 }
3718 try { laszip_dll->streamin->get32bitsLE((U8*)&(laszip_dll->header.project_ID_GUID_data_1)); } catch(...)
3719 {
3720 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "reading header.project_ID_GUID_data_1");
3721 return 1;
3722 }
3723 try { laszip_dll->streamin->get16bitsLE((U8*)&(laszip_dll->header.project_ID_GUID_data_2)); } catch(...)
3724 {
3725 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "reading header.project_ID_GUID_data_2");
3726 return 1;
3727 }
3728 try { laszip_dll->streamin->get16bitsLE((U8*)&(laszip_dll->header.project_ID_GUID_data_3)); } catch(...)
3729 {
3730 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "reading header.project_ID_GUID_data_3");
3731 return 1;
3732 }
3733 try { laszip_dll->streamin->getBytes((U8*)laszip_dll->header.project_ID_GUID_data_4, 8); } catch(...)
3734 {
3735 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "reading header.project_ID_GUID_data_4");
3736 return 1;
3737 }
3738 try { laszip_dll->streamin->getBytes((U8*)&(laszip_dll->header.version_major), 1); } catch(...)
3739 {
3740 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "reading header.version_major");
3741 return 1;
3742 }
3743 try { laszip_dll->streamin->getBytes((U8*)&(laszip_dll->header.version_minor), 1); } catch(...)
3744 {

Calls 13

malloc_lasFunction · 0.85
realloc_lasFunction · 0.85
LASMessageFunction · 0.85
laszip_remove_vlrFunction · 0.50
laszip_add_vlrFunction · 0.50
getBytesMethod · 0.45
get16bitsLEMethod · 0.45
get32bitsLEMethod · 0.45
get64bitsLEMethod · 0.45
checkMethod · 0.45
get_errorMethod · 0.45
setupMethod · 0.45

Tested by

no test coverage detected