#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/extras/preload_data/decoder.h"
#include "base/check_op.h"
#include "base/notreached.h"
namespace net::extras {
PreloadDecoder::BitReader::BitReader(const uint8_t* bytes, size_t num_bits)
: … { … }
bool PreloadDecoder::BitReader::Next(bool* out) { … }
bool PreloadDecoder::BitReader::Read(unsigned num_bits, uint32_t* out) { … }
namespace {
bool ReadBit(PreloadDecoder::BitReader* reader, uint8_t* bits) { … }
}
bool PreloadDecoder::BitReader::DecodeSize(size_t* out) { … }
bool PreloadDecoder::BitReader::Seek(size_t offset) { … }
PreloadDecoder::HuffmanDecoder::HuffmanDecoder(const uint8_t* tree,
size_t tree_bytes)
: … { … }
bool PreloadDecoder::HuffmanDecoder::Decode(PreloadDecoder::BitReader* reader,
char* out) const { … }
PreloadDecoder::PreloadDecoder(const uint8_t* huffman_tree,
size_t huffman_tree_size,
const uint8_t* trie,
size_t trie_bits,
size_t trie_root_position)
: … { … }
PreloadDecoder::~PreloadDecoder() = default;
bool PreloadDecoder::Decode(const std::string& search, bool* out_found) { … }
}