summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-06-24 09:02:09 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-06-24 09:02:09 +0200
commit9ed10c72cde9fd8d2e95c2b170224561690c3dbb (patch)
tree285fb01b8ceca70dab2e4f4264c64180365582a3 /src
parent2a1cd7537367f70a6394b3d8b43dd0b9dfbfb1e4 (diff)
use td_list_entry_const() instead of td_list_entry() when variable is defined as const
Diffstat (limited to 'src')
-rw-r--r--src/dfxml.c2
-rw-r--r--src/dir.c6
-rw-r--r--src/dirn.c2
-rw-r--r--src/fat_adv.c12
-rw-r--r--src/fat_unformat.c2
-rw-r--r--src/fidentify.c4
-rw-r--r--src/ntfs_udl.c6
-rw-r--r--src/phbf.c2
-rw-r--r--src/photorec.c4
9 files changed, 20 insertions, 20 deletions
diff --git a/src/dfxml.c b/src/dfxml.c
index c9f4803..654cc7d 100644
--- a/src/dfxml.c
+++ b/src/dfxml.c
@@ -317,7 +317,7 @@ void xml_log_file_recovered(const file_recovery_t *file_recovery)
xml_push("byte_runs", "");
td_list_for_each(tmp, &file_recovery->location.list)
{
- const alloc_list_t *element=td_list_entry(tmp, alloc_list_t, list);
+ const alloc_list_t *element=td_list_entry_const(tmp, const alloc_list_t, list);
if(element->data>0)
{
const uint64_t len=element->end - element->start + 1;
diff --git a/src/dir.c b/src/dir.c
index 2694738..bf7094e 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -159,7 +159,7 @@ int dir_aff_log(const dir_data_t *dir_data, const file_info_t *dir_list)
}
td_list_for_each(file_walker, &dir_list->list)
{
- const file_info_t *current_file=td_list_entry(file_walker, file_info_t, list);
+ const file_info_t *current_file=td_list_entry_const(file_walker, const file_info_t, list);
char datestr[80];
char str[11];
{
@@ -216,7 +216,7 @@ int log_list_file(const disk_t *disk, const partition_t *partition, const dir_da
{
char datestr[80];
char str[11];
- const file_info_t *current_file=td_list_entry(tmp, file_info_t, list);
+ const file_info_t *current_file=td_list_entry_const(tmp, const file_info_t, list);
if((current_file->status&FILE_STATUS_DELETED)!=0)
log_info("X");
else
@@ -286,7 +286,7 @@ static int dir_whole_partition_log_aux(disk_t *disk, const partition_t *partitio
inode_known[dir_nbr++]=inode;
td_list_for_each(file_walker, &dir_list.list)
{
- const file_info_t *current_file=td_list_entry(file_walker, file_info_t, list);
+ const file_info_t *current_file=td_list_entry_const(file_walker, const file_info_t, list);
if(LINUX_S_ISDIR(current_file->st_mode)!=0)
{
const unsigned long int new_inode=current_file->st_ino;
diff --git a/src/dirn.c b/src/dirn.c
index 247a78f..df52c81 100644
--- a/src/dirn.c
+++ b/src/dirn.c
@@ -126,7 +126,7 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
file_walker!=&dir_list->list && (i-offset)<INTER_DIR;
file_walker=file_walker->next,i++)
{
- const file_info_t *current_file=td_list_entry(file_walker, file_info_t, list);
+ const file_info_t *current_file=td_list_entry_const(file_walker, const file_info_t, list);
char str[11];
char datestr[80];
wmove(window, 6+i-offset, 0);
diff --git a/src/fat_adv.c b/src/fat_adv.c
index cfd6c3c..9c595f5 100644
--- a/src/fat_adv.c
+++ b/src/fat_adv.c
@@ -205,7 +205,7 @@ static int ask_root_directory(disk_t *disk_car, const partition_t *partition, co
file_walker!=&dir_list->list && (i-offset)<INTER_DIR;
file_walker=file_walker->next,i++)
{
- const file_info_t *current_file=td_list_entry(file_walker, file_info_t, list);
+ const file_info_t *current_file=td_list_entry_const(file_walker, const file_info_t, list);
char str[11];
char datestr[80];
wmove(window,8+i-offset,0);
@@ -382,7 +382,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
dir_aff_log(NULL, &dir_list);
}
{
- const file_info_t *first_entry=td_list_entry(&dir_list.list, file_info_t, list);
+ const file_info_t *first_entry=td_list_entry_const(&dir_list.list, const file_info_t, list);
file_info_t *new_file=(file_info_t *)MALLOC(sizeof(*new_file));
memcpy(new_file, first_entry, sizeof(*new_file));
new_file->name=(char*)MALLOC(32);
@@ -505,8 +505,8 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
.list = TD_LIST_HEAD_INIT(dir_list.list),
.name = NULL
};
- const file_info_t *file1=td_list_entry(dir_list.list.next, file_info_t, list);
- const file_info_t *file2=td_list_entry(file1->list.next, file_info_t, list);
+ const file_info_t *file1=td_list_entry_const(dir_list.list.next, const file_info_t, list);
+ const file_info_t *file2=td_list_entry_const(file1->list.next, const file_info_t, list);
dir_fat_aux(buffer, cluster_size, 0, &dir_list);
if(!td_list_empty(&dir_list.list) && (&file2->list==&dir_list.list || file1->st_ino!=file2->st_ino))
{
@@ -653,7 +653,7 @@ static int fat32_create_rootdir(disk_t *disk_car,const partition_t *partition, c
memset(buffer,0,cluster_size);
td_list_for_each(file_walker, &rootdir_list->list)
{
- const file_info_t *current_file=td_list_entry(file_walker, file_info_t, list);
+ const file_info_t *current_file=td_list_entry_const(file_walker, const file_info_t, list);
file2entry((struct msdos_dir_entry*)buffer+current_entry,current_file);
if(++current_entry==(cluster_size/sizeof(struct msdos_dir_entry)))
{
@@ -847,7 +847,7 @@ static int analyse_dir_entries2(disk_t *disk_car,const partition_t *partition, c
}
td_list_for_each(file_walker, &dir_list.list)
{
- const file_info_t *current_file=td_list_entry(file_walker, file_info_t, list);
+ const file_info_t *current_file=td_list_entry_const(file_walker, const file_info_t, list);
if(LINUX_S_ISDIR(current_file->st_mode) && (current_file->status&FILE_STATUS_DELETED)==0)
{
const unsigned long int new_inode=current_file->st_ino;
diff --git a/src/fat_unformat.c b/src/fat_unformat.c
index 73980cd..daf04af 100644
--- a/src/fat_unformat.c
+++ b/src/fat_unformat.c
@@ -264,7 +264,7 @@ static pstatus_t fat_unformat_aux(struct ph_param *params, const struct ph_optio
stop==0 && file_walker!=&dir_list.list;
file_walker=file_walker->next, nbr++)
{
- const file_info_t *current_file=td_list_entry(file_walker, file_info_t, list);
+ const file_info_t *current_file=td_list_entry_const(file_walker, const file_info_t, list);
if(current_file->st_ino==1 ||
current_file->st_ino >= no_of_cluster+2)
stop=1;
diff --git a/src/fidentify.c b/src/fidentify.c
index a28712d..2a07334 100644
--- a/src/fidentify.c
+++ b/src/fidentify.c
@@ -98,10 +98,10 @@ static int file_identify(const char *filename, const unsigned int check)
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);
+ 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)
{
diff --git a/src/ntfs_udl.c b/src/ntfs_udl.c
index 6c80183..854e63e 100644
--- a/src/ntfs_udl.c
+++ b/src/ntfs_udl.c
@@ -1163,7 +1163,7 @@ static void scan_disk(ntfs_volume *vol, file_info_t *dir_list)
struct td_list_head *item;
td_list_for_each(item, &file->data)
{
- const struct data *d = td_list_entry(item, struct data, list);
+ const struct data *d = td_list_entry_const(item, const struct data, list);
file_info_t *new_file;
new_file=ufile_to_file_data(file, d);
if(new_file!=NULL)
@@ -1195,7 +1195,7 @@ static struct td_list_head *ntfs_next_non_deleted(struct td_list_head *current_f
{
const file_info_t *file_info;
walker=walker->next;
- file_info=td_list_entry(walker, file_info_t, list);
+ file_info=td_list_entry_const(walker, const file_info_t, list);
if((file_info->status&FILE_STATUS_DELETED)==0)
return walker;
}
@@ -1209,7 +1209,7 @@ static struct td_list_head *ntfs_prev_non_deleted(struct td_list_head *current_f
{
const file_info_t *file_info;
walker=walker->prev;
- file_info=td_list_entry(walker, file_info_t, list);
+ file_info=td_list_entry_const(walker, const file_info_t, list);
if((file_info->status&FILE_STATUS_DELETED)==0)
return walker;
}
diff --git a/src/phbf.c b/src/phbf.c
index 3589eba..d00bc3c 100644
--- a/src/phbf.c
+++ b/src/phbf.c
@@ -596,7 +596,7 @@ static bf_status_t photorec_bf_frag(struct ph_param *params, file_recovery_t *fi
extrablock_offset=0;
if(!td_list_empty(&file_recovery->location.list))
{
- const alloc_list_t *element=td_list_entry(file_recovery->location.list.prev, alloc_list_t, list);
+ const alloc_list_t *element=td_list_entry_const(file_recovery->location.list.prev, const alloc_list_t, list);
extrablock_offset=element->end/blocksize*blocksize;
}
/* Get the corresponding search_place */
diff --git a/src/photorec.c b/src/photorec.c
index 3276eaf..3851f56 100644
--- a/src/photorec.c
+++ b/src/photorec.c
@@ -77,7 +77,7 @@ void file_block_log(const file_recovery_t *file_recovery, const unsigned int sec
log_info("%s\t",file_recovery->filename);
td_list_for_each(tmp, &file_recovery->location.list)
{
- const alloc_list_t *element=td_list_entry(tmp, alloc_list_t, list);
+ const alloc_list_t *element=td_list_entry_const(tmp, const alloc_list_t, list);
if(element->data>0)
log_info(" %lu-%lu", (unsigned long)(element->start/sector_size), (unsigned long)(element->end/sector_size));
else
@@ -457,7 +457,7 @@ unsigned int find_blocksize(alloc_data_t *list_search_space, const unsigned int
run_again=0;
td_list_for_each(search_walker, &list_search_space->list)
{
- const alloc_data_t *tmp=td_list_entry(search_walker, alloc_data_t, list);
+ const alloc_data_t *tmp=td_list_entry_const(search_walker, const alloc_data_t, list);
if(tmp->file_stat!=NULL)
{
if(tmp->start%blocksize!=*offset && blocksize>default_blocksize)