MCPcopy Create free account
hub / github.com/KDE/labplot / uncompress

Method uncompress

src/3rdparty/vector_blf/src/Vector/BLF/LogContainer.cpp:65–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void LogContainer::uncompress() {
66 switch (compressionMethod) {
67 case 0: /* no compression */
68 uncompressedFile = compressedFile;
69 break;
70
71 case 2: { /* zlib compress */
72 /* create buffer */
73 uLong size = static_cast<uLong>(uncompressedFileSize);
74 uncompressedFile.resize(size);
75
76 /* inflate */
77 int retVal = ::uncompress(
78 reinterpret_cast<Byte *>(uncompressedFile.data()),
79 &size,
80 reinterpret_cast<Byte *>(compressedFile.data()),
81 static_cast<uLong>(compressedFileSize));
82 if (size != uncompressedFileSize)
83 throw Exception("LogContainer::uncompress(): unexpected uncompressedSize");
84 if (retVal != Z_OK)
85 throw Exception("LogContainer::uncompress(): uncompress error");
86 }
87 break;
88
89 default:
90 throw Exception("LogContainer::uncompress(): unknown compression method");
91 }
92}
93
94void LogContainer::compress(const uint16_t compressionMethod, const int compressionLevel) {
95 this->compressionMethod = compressionMethod;

Callers 1

Calls 2

resizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected