From 7b663f8227df109f1c85a0e1c4a7a2a2e528f8ff Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 22 Apr 2022 17:36:00 -0700 Subject: [PATCH] ... --- inc/file.h | 2 +- src/add.c | 4 ++-- src/file.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/file.h b/inc/file.h index c67b1a8..df8d355 100644 --- a/inc/file.h +++ b/inc/file.h @@ -24,7 +24,7 @@ struct file { }; ssize_t file_bencode(struct file*,uint8_t*,size_t); -int file_equals(struct file*,struct file*); +int file_equals(const struct file*,const struct file*); void file_free(struct file*); int file_hash(struct file*,int); int file_init(struct file**,const char*); diff --git a/src/add.c b/src/add.c index a1f2649..75fe2e7 100644 --- a/src/add.c +++ b/src/add.c @@ -85,9 +85,9 @@ static void *add_hash(void *unused) { torrent_p = torrent_p->next; } - add_queue_entry_free(p); - log_info(ADD_MESSAGE_ADDED_FILE,p->file->path); + + add_queue_entry_free(p); } return NULL; diff --git a/src/file.c b/src/file.c index 278befe..03d652c 100644 --- a/src/file.c +++ b/src/file.c @@ -53,14 +53,14 @@ ssize_t file_bencode(struct file *p, uint8_t *buf, size_t len) { return buf_len-len; } -int file_equals(struct file *a, struct file *b) { +int file_equals(const struct file *a, const struct file *b) { if((NULL==a)&&(b!=NULL)) { return -1; } if((NULL==b)&&(a!=NULL)) { return -1; } if(strcmp(a->name,b->name)!=0) { return -1; } if(strcmp(a->path,b->path)!=0) { return -1; } - if(memcmp(a->root,b->root,crypto_hash_sha256_BYTES)!=0) { return -1; } + if(memcmp(a->root->hash,b->root->hash,crypto_hash_sha256_BYTES)!=0) { return -1; } return 1; } -- 2.30.2