summaryrefslogtreecommitdiffstats
path: root/labb6
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-12-02 09:29:12 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-12-02 09:29:12 +0100
commit16e8953dd3244e8822ee492bbccd1bc0e28470fa (patch)
tree4d5b826d650c82f7b206d9f2dadf46bbb8b19c81 /labb6
parentbf6fa300d6109966c2cb2d8bad5a4e4c15e35213 (diff)
downloadtddd86-16e8953dd3244e8822ee492bbccd1bc0e28470fa.tar.gz
minor
Diffstat (limited to 'labb6')
-rwxr-xr-xlabb6/src/encoding.cpp4
1 files changed, 2 insertions, 2 deletions
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<int, int> 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<int, int> 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<int, string>& 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) {