Обновить sk1/compressor.c
This commit is contained in:
		
							parent
							
								
									e463e2d1b0
								
							
						
					
					
						commit
						4125b24356
					
				| @ -133,8 +133,10 @@ 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
 | ||||||
| int compressFile(const char* input_file_name, const char* output_file_name) { | int compressFile(const char* input_file_name, const char* output_file_name) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user