Fix README with API changes

This commit is contained in:
Jack Andersen 2019-07-13 11:33:55 -10:00 committed by GitHub
parent 343f9707f6
commit 55a3d116fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -32,16 +32,18 @@ int compress_and_decompress(const uint8_t* data, std::size_t length) {
*/
lzokay::Dict<> dict;
std::size_t compressed_size = lzokay::compress_worst_size(length);
std::unique_ptr<uint8_t[]> compressed(new uint8_t[compressed_size]);
error = lzokay::compress(data, length, compressed.get(), compressed_size, dict);
std::size_t estimated_size = lzokay::compress_worst_size(length);
std::unique_ptr<uint8_t[]> compressed(new uint8_t[estimated_size]);
std::size_t compressed_size;
error = lzokay::compress(data, length, compressed.get(), estimated_size,
compressed_size, dict);
if (error < lzokay::EResult::Success)
return 1;
std::unique_ptr<uint8_t[]> decompressed(new uint8_t[length]);
std::size_t decompressed_size = length;
std::size_t decompressed_size;
error = lzokay::decompress(compressed.get(), compressed_size,
decompressed.get(), decompressed_size);
decompressed.get(), length, decompressed_size);
if (error < lzokay::EResult::Success)
return 1;