summaryrefslogtreecommitdiffstats
path: root/src/psearchn.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-10-05 21:14:36 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-10-05 21:14:36 +0200
commit3f58711336035402a86cc747af5dce59823da89a (patch)
treec08529a4ef60a5ae2e2ba27d35fe3ecabecc3e6b /src/psearchn.c
parent3246c0e8d4ca6a1c21a3f9fcc403b6f84b5c6b59 (diff)
PhotoRec: constify some variables in photorec_check_header()
Diffstat (limited to 'src/psearchn.c')
-rw-r--r--src/psearchn.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/psearchn.c b/src/psearchn.c
index 3246a30..a92e678 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)
{