MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / PkwareCompress

Function PkwareCompress

Source/encrypt.cpp:105–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105uint32_t PkwareCompress(byte *srcData, uint32_t size)
106{
107 std::unique_ptr<char[]> ptr = std::make_unique<char[]>(CMP_BUFFER_SIZE);
108
109 unsigned destSize = 2 * size;
110 if (destSize < 2 * 4096)
111 destSize = 2 * 4096;
112
113 std::unique_ptr<byte[]> destData { new byte[destSize] };
114
115 TDataInfo param;
116 param.srcData = srcData;
117 param.srcOffset = 0;
118 param.destData = destData.get();
119 param.destOffset = 0;
120 param.size = size;
121
122 unsigned type = 0;
123 unsigned dsize = 4096;
124 implode(PkwareBufferRead, PkwareBufferWrite, ptr.get(), &param, &type, &dsize);
125
126 if (param.destOffset < size) {
127 memcpy(srcData, destData.get(), param.destOffset);
128 size = param.destOffset;
129 }
130
131 return size;
132}
133
134void PkwareDecompress(byte *inBuff, uint32_t recvSize, int maxBytes)
135{

Callers 2

CompressDataFunction · 0.85
WriteFileContentsMethod · 0.85

Calls 2

implodeFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected