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

Method run

pdal/compression/LzmaCompression.cpp:55–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 }
54
55 void run(const char *buf, size_t bufsize, lzma_action mode)
56 {
57 m_strm.avail_in = bufsize;
58 m_strm.next_in = reinterpret_cast<unsigned char *>(
59 const_cast<char *>(buf));
60 int ret = LZMA_OK;
61 do
62 {
63 m_strm.avail_out = CHUNKSIZE;
64 m_strm.next_out = m_tmpbuf;
65 ret = lzma_code(&m_strm, mode);
66 size_t written = CHUNKSIZE - m_strm.avail_out;
67 if (written)
68 m_cb(reinterpret_cast<char *>(m_tmpbuf), written);
69 } while (ret == LZMA_OK);
70 if (ret == LZMA_STREAM_END)
71 return;
72
73 switch (ret)
74 {
75 case LZMA_MEM_ERROR:
76 throw compression_error("Memory allocation failure.");
77 case LZMA_DATA_ERROR:
78 throw compression_error("LZMA data error.");
79 case LZMA_OPTIONS_ERROR:
80 throw compression_error("Unsupported option.");
81 case LZMA_UNSUPPORTED_CHECK:
82 throw compression_error("Unsupported integrity check.");
83 }
84 }
85
86protected:
87 lzma_stream m_strm;

Callers

nothing calls this directly

Calls 1

compression_errorClass · 0.85

Tested by

no test coverage detected