fix: address PR review comments

- Rename receive_file_receive -> file_receive (comment 62)
- Guard metadata receive with config->use_metadata in server.c (comment 63)
- Add NULL check after malloc in file_load_data (comment 66)
- Make chunk_serialize/chunk_deserialize metadata conditional on use_metadata param,
  thread through chunk_compress/chunk_decompress (comment 65)
- Add missing stdbool.h include to chunk.h
This commit is contained in:
2026-07-05 20:45:34 +02:00
parent 660834d453
commit 5fa0dc11e1
7 changed files with 42 additions and 32 deletions
+6 -1
View File
@@ -73,8 +73,13 @@ void file_metadata_destroy(void *metadata) {
void file_load_data(File *file) {
if (file == NULL)
return;
if (file->data->data == NULL)
if (file->data->data == NULL) {
file->data->data = malloc(file->data->size);
if (file->data->data == NULL) {
perror("Could not allocate memory for file data");
exit(EXIT_FAILURE);
}
}
printf("%ld is file big", file->data->size);
size_t bytes_read = file_content_to_buffer(file);
if (bytes_read != file->data->size) {