| 225 | } |
| 226 | |
| 227 | static bool DecompressBlock(const UopFileEntry *block, uint8_t *dst, uint8_t *src) |
| 228 | { |
| 229 | assert(block); |
| 230 | uLongf cLen = block->CompressedSize; |
| 231 | uLongf dLen = block->DecompressedSize; |
| 232 | if (cLen == 0 || block->Flags == 0) |
| 233 | { |
| 234 | dst = src; |
| 235 | return true; |
| 236 | } |
| 237 | |
| 238 | auto p = reinterpret_cast<unsigned char const *>(src); |
| 239 | int z_err = uncompress(dst, &dLen, p, cLen); |
| 240 | if (z_err != Z_OK) |
| 241 | { |
| 242 | Error(Data, "decompression failed %d", z_err); |
| 243 | return false; |
| 244 | } |
| 245 | return true; |
| 246 | } |
| 247 | |
| 248 | static bool UopDecompressBlock(const UopFileEntry *block, uint8_t *dst, int fileId) |
| 249 | { |
no test coverage detected