From 16e8953dd3244e8822ee492bbccd1bc0e28470fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Wed, 2 Dec 2020 09:29:12 +0100 Subject: minor --- labb6/src/encoding.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'labb6/src/encoding.cpp') diff --git a/labb6/src/encoding.cpp b/labb6/src/encoding.cpp index b5ecd4e..81e8fe1 100755 --- a/labb6/src/encoding.cpp +++ b/labb6/src/encoding.cpp @@ -11,6 +11,7 @@ map buildFrequencyTable(istream& input) { while (true) { int c = input.get(); if (input.eof()) { + freq_table[PSEUDO_EOF] = 1; break; } if (!freq_table.count(c)) { @@ -18,7 +19,6 @@ map buildFrequencyTable(istream& input) { } freq_table[c] += 1; } - freq_table[PSEUDO_EOF] = 1; return freq_table; } @@ -105,7 +105,7 @@ void encodeData(istream& input, const map& encoding_map, obitstream } /* - * Read a single character from the Huffman-compressed 'input' encded with + * Read a single character from the Huffman-compressed 'input' encoded with * 'encoding_map'. */ int read_char(ibitstream& input, HuffmanNode* encoding_tree) { -- cgit v1.2.1