summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-04-10 19:20:53 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2016-04-10 19:20:53 +0200
commit4968f66059e9ca6d8c48b55460a73bfbc72fd1aa (patch)
tree17fea48cbb7ccf9f6eb54a5557e78129e5cfa0a0
parentb5ec147d4663cf73fba8c1fa082aedfda4c09dd4 (diff)
Use TD_INIT_LIST_HEAD() function instead of TD_LIST_HEAD_INIT() static initializer
-rw-r--r--src/askloc.c6
-rw-r--r--src/dir.c6
-rw-r--r--src/dirn.c12
-rw-r--r--src/dirpart.c6
-rw-r--r--src/fat.c6
-rw-r--r--src/fat_adv.c30
-rw-r--r--src/fat_unformat.c6
-rw-r--r--src/ntfs_fix.c12
-rw-r--r--src/ntfs_udl.c6
-rw-r--r--src/psearchn.c6
-rw-r--r--src/qphotorec.cpp9
-rw-r--r--src/qpsearch.cpp6
12 files changed, 36 insertions, 75 deletions
diff --git a/src/askloc.c b/src/askloc.c
index 0a8b5ec..3fe8480 100644
--- a/src/askloc.c
+++ b/src/askloc.c
@@ -178,10 +178,8 @@ char *ask_location(const char*msg, const char *src_dir, const char *dst_org)
do
{
DIR* dir;
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
wmove(window,5,0);
wclrtoeol(window); /* before addstr for BSD compatibility */
if(has_colors())
diff --git a/src/dir.c b/src/dir.c
index bf7094e..bde7f13 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -272,10 +272,8 @@ static int dir_whole_partition_log_aux(disk_t *disk, const partition_t *partitio
static unsigned int dir_nbr=0;
static unsigned long int inode_known[MAX_DIR_NBR];
const unsigned int current_directory_namelength=strlen(dir_data->current_directory);
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
if(dir_nbr==MAX_DIR_NBR)
return 1; /* subdirectories depth is too high => Back */
if(dir_data->verbose>0)
diff --git a/src/dirn.c b/src/dirn.c
index 8c3ef37..1bf7f5b 100644
--- a/src/dirn.c
+++ b/src/dirn.c
@@ -604,10 +604,8 @@ static int dir_partition_aux(disk_t *disk, const partition_t *partition, dir_dat
{
const unsigned int current_directory_namelength=strlen(dir_data->current_directory);
long int new_inode=-1; /* Quit */
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
/* Not perfect for FAT32 root cluster */
inode_known[depth]=inode;
dir_data->get_dir(disk, partition, dir_data, inode, &dir_list);
@@ -661,10 +659,8 @@ static int copy_dir(WINDOW *window, disk_t *disk, const partition_t *partition,
{
static unsigned int dir_nbr=0;
static unsigned long int inode_known[MAX_DIR_NBR];
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
const unsigned int current_directory_namelength=strlen(dir_data->current_directory);
char *dir_name;
struct td_list_head *file_walker = NULL;
diff --git a/src/dirpart.c b/src/dirpart.c
index a070476..3f07ad2 100644
--- a/src/dirpart.c
+++ b/src/dirpart.c
@@ -196,10 +196,8 @@ dir_partition_t dir_partition(disk_t *disk, const partition_t *partition, const
dir_partition_aff(disk, partition, &dir_data, dir_data.current_inode, current_cmd);
#else
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_data.get_dir(disk, partition, &dir_data, dir_data.current_inode, &dir_list);
dir_aff_log(&dir_data, &dir_list);
delete_list_file(&dir_list);
diff --git a/src/fat.c b/src/fat.c
index 912d125..0e0516f 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -765,13 +765,11 @@ static int fat_has_EFI_entry(disk_t *disk, partition_t *partition, const int ver
{
dir_data_t dir_data;
struct td_list_head *file_walker = NULL;
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
const dir_partition_t res=dir_partition_fat_init(disk, partition, &dir_data, verbose);
if(res!=DIR_PART_OK)
return 0;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_data.get_dir(disk, partition, &dir_data, 0, &dir_list);
td_list_for_each(file_walker, &dir_list.list)
{
diff --git a/src/fat_adv.c b/src/fat_adv.c
index 7561dd6..b295ddc 100644
--- a/src/fat_adv.c
+++ b/src/fat_adv.c
@@ -333,10 +333,8 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
#endif
unsigned char *buffer;
int ind_stop=0;
- file_info_t rootdir_list= {
- .list = TD_LIST_HEAD_INIT(rootdir_list.list),
- .name = NULL
- };
+ file_info_t rootdir_list;
+ TD_INIT_LIST_HEAD(&rootdir_list.list);
buffer=(unsigned char *)MALLOC(cluster_size);
#ifdef HAVE_NCURSES
if(interface)
@@ -378,10 +376,8 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
if(fat_get_cluster_from_entry(entry2)==0 &&
buffer[0x40]!=0) /* First-level directory with files */
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
log_info("First-level directory found at cluster %lu\n",root_cluster);
dir_fat_aux(buffer, cluster_size, 0, &dir_list);
if(verbose>0)
@@ -508,10 +504,8 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
}
}
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_fat_aux(buffer, cluster_size, 0, &dir_list);
if(is_root_cluster_candidat(&dir_list))
{
@@ -697,10 +691,8 @@ static int fat32_create_rootdir(disk_t *disk_car,const partition_t *partition, c
}
#ifdef DEBUG
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_fat_aux(buffer, cluster_size, 0, &dir_list);
dir_aff_log(NULL, dir_list);
delete_list_file(&dir_list);
@@ -826,11 +818,9 @@ static int analyse_dir_entries2(disk_t *disk_car,const partition_t *partition, c
{
unsigned char *buffer_dir;
unsigned int root_dir_size;
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
struct td_list_head *file_walker = NULL;
+ TD_INIT_LIST_HEAD(&dir_list.list);
if(root_size_max==0)
{
root_size_max=4096;
diff --git a/src/fat_unformat.c b/src/fat_unformat.c
index daf04af..b6d871e 100644
--- a/src/fat_unformat.c
+++ b/src/fat_unformat.c
@@ -246,10 +246,8 @@ static pstatus_t fat_unformat_aux(struct ph_param *params, const struct ph_optio
{
if(buffer[0]=='.' && is_fat_directory(buffer))
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_fat_aux(buffer, read_size, 0, &dir_list);
if(!td_list_empty(&dir_list.list))
{
diff --git a/src/ntfs_fix.c b/src/ntfs_fix.c
index 6399e1f..2b493d0 100644
--- a/src/ntfs_fix.c
+++ b/src/ntfs_fix.c
@@ -171,10 +171,8 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
}
if(res1==DIR_PART_OK)
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_data.get_dir(disk_car,partition,&dir_data,dir_data.current_inode, &dir_list);
if(!td_list_empty(&dir_list.list))
{
@@ -191,10 +189,8 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
res2=dir_partition_ntfs_init(disk_car,partition,&dir_data,verbose);
if(res2==DIR_PART_OK)
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_data.get_dir(disk_car,partition,&dir_data,dir_data.current_inode, &dir_list);
if(!td_list_empty(&dir_list.list))
{
diff --git a/src/ntfs_udl.c b/src/ntfs_udl.c
index e902521..0a569f1 100644
--- a/src/ntfs_udl.c
+++ b/src/ntfs_udl.c
@@ -1699,11 +1699,9 @@ int ntfs_undelete_part(disk_t *disk_car, const partition_t *partition, const int
break;
default:
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
struct ntfs_dir_struct *ls=(struct ntfs_dir_struct *)dir_data.private_dir_data;
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
scan_disk(ls->vol, &dir_list);
ntfs_undelete_menu(disk_car, partition, &dir_data, &dir_list, current_cmd);
delete_list_file(&dir_list);
diff --git a/src/psearchn.c b/src/psearchn.c
index 238ed6c..dc6bcc3 100644
--- a/src/psearchn.c
+++ b/src/psearchn.c
@@ -109,10 +109,8 @@ static FILE *fopen_with_retry(const char *path, const char *mode)
static void photorec_dir_fat(const unsigned char *buffer, const unsigned int read_size, const unsigned long long sector)
{
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_fat_aux(buffer, read_size, 0, &dir_list);
if(!td_list_empty(&dir_list.list))
{
diff --git a/src/qphotorec.cpp b/src/qphotorec.cpp
index 94ac8f9..9e7a465 100644
--- a/src/qphotorec.cpp
+++ b/src/qphotorec.cpp
@@ -891,13 +891,8 @@ void QPhotorec::qphotorec_search()
{
if(selected_disk==NULL || selected_partition==NULL)
return;
- static alloc_data_t list_search_space={
- .list = TD_LIST_HEAD_INIT(list_search_space.list),
- .start=0,
- .end=0,
- .file_stat=NULL,
- .data=0
- };
+ alloc_data_t list_search_space;
+ TD_INIT_LIST_HEAD(&list_search_space.list);
QByteArray byteArray = (directoryLabel->text() + "/" + DEFAULT_RECUP_DIR).toUtf8();
params->recup_dir=strdup(byteArray.constData());
diff --git a/src/qpsearch.cpp b/src/qpsearch.cpp
index 9b0d258..753427a 100644
--- a/src/qpsearch.cpp
+++ b/src/qpsearch.cpp
@@ -220,10 +220,8 @@ pstatus_t QPhotorec::photorec_aux(alloc_data_t *list_search_space)
if(file_recovery.file_stat->file_hint==&file_hint_dir && options->verbose > 0)
{ /* FAT directory found, list the file */
- file_info_t dir_list = {
- .list = TD_LIST_HEAD_INIT(dir_list.list),
- .name = NULL
- };
+ file_info_t dir_list;
+ TD_INIT_LIST_HEAD(&dir_list.list);
dir_fat_aux(buffer, read_size, 0, &dir_list);
if(!td_list_empty(&dir_list.list))
{