forgot to change this line

This commit is contained in:
Phuntsok Drak-pa 2018-06-11 22:11:58 +02:00
parent 6c3fb8b6a7
commit 5b9f3ccd6a

View File

@ -17,24 +17,12 @@ using vuint16 = vector<uint16_t>;
ustring lzw_uncompress(vuint16 &&t_compressed) { ustring lzw_uncompress(vuint16 &&t_compressed) {
ustring ret{}; ustring ret{};
uint16_t old = 0; uint16_t old = 0;
// [1]
std::map<uint16_t, ustring> dict{}; std::map<uint16_t, ustring> dict{};
// [2]
uint16_t v = t_compressed[0]; uint16_t v = t_compressed[0];
// [3]
ret.append({static_cast<unsigned char>(v)}); ret.append({static_cast<unsigned char>(v)});
// [4]
old = v; old = v;
for (auto it = t_compressed.begin() + 1; it != t_compressed.end(); ++it) { for (auto it = t_compressed.begin() + 1; it != t_compressed.end(); ++it) {
// [5]
v = *it; v = *it;
// [6]
const auto uncompressed{dico_uncompress(dict, v, old)}; const auto uncompressed{dico_uncompress(dict, v, old)};
ret.insert(ret.end(), uncompressed.begin(), uncompressed.end()); ret.insert(ret.end(), uncompressed.begin(), uncompressed.end());
old = v; old = v;
@ -58,7 +46,7 @@ void uncompress(const string &t_input_name, const char *t_output_name) {
std::fread(&nb_chunks, sizeof(nb_chunks), 1, input); std::fread(&nb_chunks, sizeof(nb_chunks), 1, input);
for (uint16_t i = 0; i < nb_chunks; ++i) { for (uint16_t i = 0; i < nb_chunks; ++i) {
uint16_t size_chunk = 0; uint32_t size_chunk = 0;
fread(&size_chunk, sizeof(size_chunk), 1, input); fread(&size_chunk, sizeof(size_chunk), 1, input);
auto *chunk = static_cast<unsigned char *>( auto *chunk = static_cast<unsigned char *>(
std::malloc(sizeof(unsigned char) * size_chunk)); std::malloc(sizeof(unsigned char) * size_chunk));