summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <[email protected]>2010-10-31 17:14:22 +0100
committerChristophe Grenier <[email protected]>2010-10-31 17:14:22 +0100
commit173e66e1bc9e04d171097eb57d42692fd4440126 (patch)
tree0f6d13deadc45a0bf60a8a6aaf4a1e3bc6c955d2 /src
parent1fe68dd2b4eb2acca20132e52da6212360c84211 (diff)
PhotoRec: remove has_value field in file_check_list_t
Diffstat (limited to 'src')
-rw-r--r--src/fidentify.c2
-rw-r--r--src/filegen.c10
-rw-r--r--src/filegen.h1
-rw-r--r--src/phbf.c2
-rw-r--r--src/phbs.c2
-rw-r--r--src/phrecn.c4
6 files changed, 6 insertions, 15 deletions
diff --git a/src/fidentify.c b/src/fidentify.c
index 27954550..35644b29 100644
--- a/src/fidentify.c
+++ b/src/fidentify.c
@@ -90,7 +90,7 @@ static int file_identify(const char *filename)
{
struct td_list_head *tmp;
const file_check_list_t *pos=td_list_entry(tmpl, file_check_list_t, list);
- td_list_for_each(tmp, &pos->file_checks[pos->has_value==0?0:buffer[pos->offset]].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);
if((file_check->length==0 || memcmp(buffer + file_check->offset, file_check->value, file_check->length)==0) &&
diff --git a/src/filegen.c b/src/filegen.c
index ee6d7bee..8557e715 100644
--- a/src/filegen.c
+++ b/src/filegen.c
@@ -66,7 +66,6 @@ static void file_check_add_tail(file_check_t *file_check_new, file_check_list_t
unsigned int i;
file_check_list_t *newe=(file_check_list_t *)MALLOC(sizeof(*newe));
newe->offset=file_check_new->offset;
- newe->has_value=(file_check_new->length==0?0:1);
for(i=0;i<256;i++)
{
newe->file_checks[i].list.prev=&newe->file_checks[i].list;
@@ -96,7 +95,7 @@ static void index_header_check_aux(file_check_t *file_check_new)
td_list_for_each(tmp, &file_check_list.list)
{
file_check_list_t *pos=td_list_entry(tmp, file_check_list_t, list);
- if(file_check_new->length>0 && pos->has_value==1)
+ if(file_check_new->length>0)
{
if(pos->offset >= file_check_new->offset &&
pos->offset < file_check_new->offset+file_check_new->length)
@@ -112,13 +111,6 @@ static void index_header_check_aux(file_check_t *file_check_new)
return ;
}
}
- else if(file_check_new->length==0 && pos->has_value==0)
- {
- td_list_add_sorted(&file_check_new->list,
- &pos->file_checks[0].list,
- file_check_cmp);
- return;
- }
}
file_check_add_tail(file_check_new, &file_check_list);
}
diff --git a/src/filegen.h b/src/filegen.h
index 1fc1cde5..d7911d82 100644
--- a/src/filegen.h
+++ b/src/filegen.h
@@ -115,7 +115,6 @@ typedef struct
{
struct td_list_head list;
unsigned int offset;
- unsigned int has_value;
file_check_t file_checks[256];
} file_check_list_t;
diff --git a/src/phbf.c b/src/phbf.c
index 4a9b9158..b8f3c379 100644
--- a/src/phbf.c
+++ b/src/phbf.c
@@ -197,7 +197,7 @@ int photorec_bf(disk_t *disk_car, partition_t *partition, const int verbose, con
{
struct td_list_head *tmp;
const file_check_list_t *pos=td_list_entry(tmpl, file_check_list_t, list);
- td_list_for_each(tmp, &pos->file_checks[pos->has_value==0?0:buffer[pos->offset]].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);
if((file_check->length==0 || memcmp(buffer + file_check->offset, file_check->value, file_check->length)==0) &&
diff --git a/src/phbs.c b/src/phbs.c
index d7321f17..2e80ff79 100644
--- a/src/phbs.c
+++ b/src/phbs.c
@@ -136,7 +136,7 @@ int photorec_find_blocksize(disk_t *disk_car, partition_t *partition, const int
{
struct td_list_head *tmp;
const file_check_list_t *pos=td_list_entry(tmpl, file_check_list_t, list);
- td_list_for_each(tmp, &pos->file_checks[pos->has_value==0?0:buffer[pos->offset]].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);
if((file_check->length==0 || memcmp(buffer + file_check->offset, file_check->value, file_check->length)==0) &&
diff --git a/src/phrecn.c b/src/phrecn.c
index cf951bb6..d0130a1f 100644
--- a/src/phrecn.c
+++ b/src/phrecn.c
@@ -252,7 +252,7 @@ static int photorec_aux(disk_t *disk_car, partition_t *partition, const int verb
{
struct td_list_head *tmp;
const file_check_list_t *pos=td_list_entry(tmpl, file_check_list_t, list);
- td_list_for_each(tmp, &pos->file_checks[pos->has_value==0?0:buffer[pos->offset]].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);
if((file_check->length==0 || memcmp(buffer + file_check->offset, file_check->value, file_check->length)==0) &&
@@ -653,7 +653,7 @@ static void test_files_aux(disk_t *disk, partition_t *partition, file_recovery_t
{
struct td_list_head *tmp;
const file_check_list_t *pos=td_list_entry(tmpl, file_check_list_t, list);
- td_list_for_each(tmp, &pos->file_checks[pos->has_value==0?0:buffer[pos->offset]].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);
if((file_check->length==0 || memcmp(buffer + file_check->offset, file_check->value, file_check->length)==0) &&