| 175 | } |
| 176 | |
| 177 | Status Uncompress(const Slice& compressed, |
| 178 | uint8_t *uncompressed, |
| 179 | size_t uncompressed_length) const OVERRIDE { |
| 180 | int n = LZ4_decompress_safe(reinterpret_cast<const char *>(compressed.data()), |
| 181 | reinterpret_cast<char *>(uncompressed), |
| 182 | compressed.size(), uncompressed_length); |
| 183 | if (n != uncompressed_length) { |
| 184 | return Status::Corruption( |
| 185 | StringPrintf("unable to uncompress the buffer. error near %d, buffer", -n), |
| 186 | KUDU_REDACT(compressed.ToDebugString(100))); |
| 187 | } |
| 188 | return Status::OK(); |
| 189 | } |
| 190 | |
| 191 | size_t MaxCompressedLength(size_t source_bytes) const OVERRIDE { |
| 192 | return LZ4_compressBound(source_bytes); |