Обновить sk1/compressor.c
This commit is contained in:
parent
e463e2d1b0
commit
4125b24356
@ -133,7 +133,9 @@ void storeCodes(struct MinHeapNode* root, char** codes, char* currentCode, int t
|
|||||||
}
|
}
|
||||||
if (!(root->left) && !(root->right)) {
|
if (!(root->left) && !(root->right)) {
|
||||||
currentCode[top] = '\0';
|
currentCode[top] = '\0';
|
||||||
|
if (root->data < 256) { // Ensure data is within bounds
|
||||||
codes[root->data] = strdup(currentCode);
|
codes[root->data] = strdup(currentCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Compress the input file using Huffman Coding
|
// Compress the input file using Huffman Coding
|
||||||
|
Loading…
Reference in New Issue
Block a user