};
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*);
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;
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;
}