Обновить sk1/compressor.c

This commit is contained in:
Yevhen Kozirovskyi 2025-01-19 16:58:09 +00:00
parent e463e2d1b0
commit 4125b24356

View File

@ -133,9 +133,11 @@ void storeCodes(struct MinHeapNode* root, char** codes, char* currentCode, int t
}
if (!(root->left) && !(root->right)) {
currentCode[top] = '\0';
if (root->data < 256) { // Ensure data is within bounds
codes[root->data] = strdup(currentCode);
}
}
}
// Compress the input file using Huffman Coding
int compressFile(const char* input_file_name, const char* output_file_name) {
FILE* inputFile = fopen(input_file_name, "rb");