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

Function write_laszip_vlr_header

LASzip/src/laszip_dll.cpp:2450–2493  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2448
2449/*---------------------------------------------------------------------------*/
2450static I32
2451write_laszip_vlr_header(
2452 laszip_dll_struct* laszip_dll
2453 , const LASzip* laszip
2454 , ByteStreamOut* out
2455)
2456{
2457 // write the LASzip VLR header
2458
2459 U16 reserved = 0x0;
2460 try { out->put16bitsLE((U8*)&reserved); } catch(...)
2461 {
2462 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "writing LASzip VLR header.reserved");
2463 return 1;
2464 }
2465 U8 user_id[16] = "laszip encoded\0";
2466 try { out->putBytes((U8*)user_id, 16); } catch(...)
2467 {
2468 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "writing LASzip VLR header.user_id");
2469 return 1;
2470 }
2471 U16 record_id = 22204;
2472 try { out->put16bitsLE((U8*)&record_id); } catch(...)
2473 {
2474 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "writing LASzip VLR header.record_id");
2475 return 1;
2476 }
2477 U16 record_length_after_header = (U16)laszip_vrl_payload_size(laszip);
2478 try { out->put16bitsLE((U8*)&record_length_after_header); } catch(...)
2479 {
2480 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "writing LASzip VLR header.record_length_after_header");
2481 return 1;
2482 }
2483 CHAR description[32];
2484 memset(description, 0, 32);
2485 snprintf(description, sizeof(description), "LASzip DLL %d.%d r%d (%d)", LASZIP_VERSION_MAJOR, LASZIP_VERSION_MINOR, LASZIP_VERSION_REVISION, LASZIP_VERSION_BUILD_DATE);
2486 try { out->putBytes((U8*)description, 32); } catch(...)
2487 {
2488 snprintf(laszip_dll->error, sizeof(laszip_dll->error), "writing LASzip VLR header.description");
2489 return 1;
2490 }
2491
2492 return 0;
2493}
2494
2495/*---------------------------------------------------------------------------*/
2496static I32

Callers 2

laszip_write_headerFunction · 0.85

Calls 3

laszip_vrl_payload_sizeFunction · 0.85
put16bitsLEMethod · 0.45
putBytesMethod · 0.45

Tested by

no test coverage detected