Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Brotli_Decoder.cpp
Go to the documentation of this file.
4
5#include <brotli/decode.h>
6
7namespace joedb
8{
9 ////////////////////////////////////////////////////////////////////////////
10 void Brotli_Decoder::decode
11 ////////////////////////////////////////////////////////////////////////////
12 (
13 const std::string &encoded,
14 char *decoded,
15 size_t decoded_size
16 )
17 {
18 size_t brotli_decoded_size = decoded_size;
19
20 const auto result = BrotliDecoderDecompress
21 (
22 encoded.size(),
23 (const uint8_t *)(encoded.data()),
24 &brotli_decoded_size,
25 (uint8_t *)decoded
26 );
27
28 JOEDB_ASSERT(brotli_decoded_size == decoded_size);
29
30 if (result != BROTLI_DECODER_RESULT_SUCCESS)
31 throw Exception("Brotli decompression failed");
32 }
33}
#define JOEDB_ASSERT(x)
Definition assert.h:18
Definition Blob.h:7