Phase 1+2: bug fixes and dead code cleanup
Phase 1 — Bugs: - receive_data: fix unsigned long long vs size_t mismatch - chunk_deserialize: add NULL check in multiprocessing.c and server.c - file_content_to_buffer: add missing fclose on error path - send_files_multithreaded: propagate sender thread result - server: add SIGPIPE handler - to_disk: check fwrite return value - scanner: use S_ISDIR instead of !S_ISREG - scanner: free cur_path before early return Phase 2 — Cleanup: - Remove unused chunk_decompress function - Remove unused array_list_clear function - Remove unused num_connections config field - Remove duplicate FILE_METADATA_WIRE_SIZE macro - Update tests for removed APIs
This commit is contained in:
@@ -178,24 +178,5 @@ Data *chunk_compress(Chunk *chunk, int compression_level, bool use_metadata) {
|
||||
return compressed;
|
||||
}
|
||||
|
||||
Chunk *chunk_decompress(Data *compressed_data, bool use_metadata) {
|
||||
log_message(LOG_LEVEL_DEBUG, "Starting to decompress chunk");
|
||||
Data *uncompressed_data = data_decompress(compressed_data);
|
||||
if (uncompressed_data == NULL) {
|
||||
log_message(LOG_LEVEL_ERROR, "Failed to decompress chunk data");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Chunk *chunk = chunk_deserialize(uncompressed_data, use_metadata);
|
||||
if (chunk == NULL) {
|
||||
log_message(LOG_LEVEL_ERROR, "Failed to deserialize chunk data");
|
||||
data_destroy(uncompressed_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data_destroy(uncompressed_data);
|
||||
log_message(LOG_LEVEL_DEBUG, "Chunk successfully decompressed");
|
||||
return chunk;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user