From 3f58711336035402a86cc747af5dce59823da89a Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Sun, 5 Oct 2014 21:14:36 +0200 Subject: [PATCH] PhotoRec: constify some variables in photorec_check_header() --- src/psearchn.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/psearchn.c b/src/psearchn.c index 3246a306..a92e6789 100644 --- a/src/psearchn.c +++ b/src/psearchn.c @@ -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) {