PhotoRec: constify some variables in photorec_check_header()

This commit is contained in:
Christophe Grenier 2014-10-05 21:14:36 +02:00
parent 3246c0e8d4
commit 3f58711336

View file

@ -182,9 +182,9 @@ static pstatus_t photorec_header_found(file_recovery_t *file_recovery_new, file_
return PSTATUS_OK;
}
static pstatus_t photorec_check_header(file_recovery_t *file_recovery, struct ph_param *params, const struct ph_options *options, alloc_data_t *list_search_space, const unsigned char *buffer, int *file_recovered, alloc_data_t **current_search_space, uint64_t *offset)
inline static pstatus_t photorec_check_header(file_recovery_t *file_recovery, struct ph_param *params, const struct ph_options *options, alloc_data_t *list_search_space, const unsigned char *buffer, int *file_recovered, alloc_data_t **current_search_space, uint64_t *offset)
{
struct td_list_head *tmpl;
const struct td_list_head *tmpl;
const unsigned int blocksize=params->blocksize;
const unsigned int read_size=(blocksize>65536?blocksize:65536);
file_recovery_t file_recovery_new;
@ -204,14 +204,14 @@ static pstatus_t photorec_check_header(file_recovery_t *file_recovery, struct ph
return PSTATUS_OK;
}
file_recovery_new.file_stat=NULL;
file_recovery_new.location.start=*offset;
td_list_for_each(tmpl, &file_check_list.list)
{
struct td_list_head *tmp;
const file_check_list_t *pos=td_list_entry(tmpl, file_check_list_t, list);
file_recovery_new.location.start=*offset;
const struct td_list_head *tmp;
const file_check_list_t *pos=td_list_entry_const(tmpl, const file_check_list_t, list);
td_list_for_each(tmp, &pos->file_checks[buffer[pos->offset]].list)
{
const file_check_t *file_check=td_list_entry(tmp, file_check_t, list);
const file_check_t *file_check=td_list_entry_const(tmp, const file_check_t, list);
if((file_check->length==0 || memcmp(buffer + file_check->offset, file_check->value, file_check->length)==0) &&
file_check->header_check(buffer, read_size, 0, file_recovery, &file_recovery_new)!=0)
{