summaryrefslogtreecommitdiffstats
path: root/labb6/src/encoding.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'labb6/src/encoding.cpp')
-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) {