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

Function unmapFile

pdal/util/FileUtils.cpp:586–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584}
585
586MapContext unmapFile(MapContext ctx)
587{
588 if (!ctx.m_addr)
589 {
590 ctx.m_error = "File not mapped.";
591 return ctx;
592 }
593#ifndef _WIN32
594 if (::munmap(ctx.m_addr, ctx.m_size) == -1)
595 ctx.m_error = "Couldn't unmap file.";
596 else
597 {
598 ctx.m_addr = nullptr;
599 ctx.m_size = 0;
600 ctx.m_error = "";
601 }
602 ::close(ctx.m_fd);
603#else
604 if (UnmapViewOfFile(ctx.m_addr) == 0)
605 ctx.m_error = "Couldn't unmap file.";
606 else
607 {
608 ctx.m_addr = nullptr;
609 ctx.m_size = 0;
610 ctx.m_error = "";
611 }
612 CloseHandle(ctx.m_handle);
613 ::_close(ctx.m_fd);
614#endif
615 return ctx;
616}
617
618} // namespace FileUtils
619} // namespace pdal

Callers 3

~SlpkInterfaceMethod · 0.85
operator()Method · 0.85
TESTFunction · 0.85

Calls 1

closeFunction · 0.70

Tested by 1

TESTFunction · 0.68