summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-01-05 14:17:29 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2014-01-05 14:17:29 +0100
commit727f2de6ce2de0c28441f34d7b6e3be22e153167 (patch)
tree134f399cb58d89bcb2a5c8fad657b04393a5298a
parentdf353cfc2c2e9d7015e0973d60e2405624a25e39 (diff)
Remove file_size_on_disk field from struct file_recovery_struct
-rw-r--r--src/filegen.c1
-rw-r--r--src/filegen.h1
-rw-r--r--src/phbf.c7
-rw-r--r--src/phbs.c1
-rw-r--r--src/photorec.c1
-rw-r--r--src/psearchn.c4
-rw-r--r--src/qphbs.cpp1
-rw-r--r--src/qpsearch.cpp4
8 files changed, 2 insertions, 18 deletions
diff --git a/src/filegen.c b/src/filegen.c
index 9635a71..d409876 100644
--- a/src/filegen.c
+++ b/src/filegen.c
@@ -304,7 +304,6 @@ void reset_file_recovery(file_recovery_t *file_recovery)
file_recovery->file_stat=NULL;
file_recovery->handle=NULL;
file_recovery->file_size=0;
- file_recovery->file_size_on_disk=0;
file_recovery->location.list.prev=&file_recovery->location.list;
file_recovery->location.list.next=&file_recovery->location.list;
file_recovery->location.start=0;
diff --git a/src/filegen.h b/src/filegen.h
index 0b85f7b..2f243da 100644
--- a/src/filegen.h
+++ b/src/filegen.h
@@ -70,7 +70,6 @@ struct file_recovery_struct
FILE *handle;
time_t time;
uint64_t file_size;
- uint64_t file_size_on_disk;
const char *extension;
uint64_t min_filesize;
uint64_t offset_ok;
diff --git a/src/phbf.c b/src/phbf.c
index cdd8939..a86b316 100644
--- a/src/phbf.c
+++ b/src/phbf.c
@@ -257,7 +257,6 @@ pstatus_t photorec_bf(struct ph_param *params, const struct ph_options *options,
if(file_recovery.data_check!=NULL)
res=file_recovery.data_check(buffer_olddata, 2*blocksize, &file_recovery);
file_recovery.file_size+=blocksize;
- file_recovery.file_size_on_disk+=blocksize;
if(res==DC_STOP || res==DC_ERROR)
{ /* EOF found */
need_to_check_file=1;
@@ -372,7 +371,6 @@ static bf_status_t photorec_bf_pad(struct ph_param *params, file_recovery_t *fil
}
list_append_block(&file_recovery->location, *offset, blocksize, 1);
file_recovery->file_size+=blocksize;
- file_recovery->file_size_on_disk+=blocksize;
nbr++;
memcpy(buffer, block_buffer, blocksize);
}
@@ -493,7 +491,6 @@ static bf_status_t photorec_bf_frag_fast(struct ph_param *params, file_recovery_
file_recovery->checkpoint_offset=original_offset_ok/blocksize*blocksize;
file_recovery->calculated_file_size=0;
file_recovery->file_size=0;
- file_recovery->file_size_on_disk=0;
for(file_recovery->file_size = 0;
file_recovery->file_size <= original_offset_ok/blocksize*blocksize;
)
@@ -506,7 +503,6 @@ static bf_status_t photorec_bf_frag_fast(struct ph_param *params, file_recovery_
memcpy(buffer, block_buffer, blocksize);
}
file_recovery->file_size+=blocksize;
- file_recovery->file_size_on_disk+=blocksize;
get_next_sector(list_search_space, current_search_space, offset, blocksize);
}
list_truncate(&file_recovery->location, file_recovery->file_size);
@@ -530,7 +526,6 @@ static bf_status_t photorec_bf_frag_fast(struct ph_param *params, file_recovery_
}
list_append_block(&file_recovery->location, *offset, blocksize, 1);
file_recovery->file_size+=blocksize;
- file_recovery->file_size_on_disk+=blocksize;
memcpy(buffer, block_buffer, blocksize);
get_next_sector(list_search_space, current_search_space, offset, blocksize);
}
@@ -618,7 +613,6 @@ static bf_status_t photorec_bf_frag(struct ph_param *params, file_recovery_t *fi
}
list_truncate(&file_recovery->location, file_offset);
file_recovery->file_size=file_offset;
- file_recovery->file_size_on_disk=file_recovery->file_size;
/* Set extractblock_search_space & extrablock_offset to the begining of the potential extra block */
/* FIXME */
#ifdef DEBUG_BF
@@ -807,7 +801,6 @@ static pstatus_t photorec_bf_aux(struct ph_param *params, file_recovery_t *file_
list_append_block(&file_recovery->location, offset, blocksize, 1);
get_next_sector(list_search_space, &current_search_space, &offset, blocksize);
}
- file_recovery->file_size_on_disk=file_recovery->file_size;
file_recovery->offset_error=file_recovery->file_size;
#ifdef DEBUG_BF
log_trace("BF Amorce ");
diff --git a/src/phbs.c b/src/phbs.c
index b9fb674..8107560 100644
--- a/src/phbs.c
+++ b/src/phbs.c
@@ -145,7 +145,6 @@ pstatus_t photorec_find_blocksize(struct ph_param *params, const struct ph_optio
if(file_recovery.data_check!=NULL)
res=file_recovery.data_check(buffer_olddata, 2*blocksize, &file_recovery);
file_recovery.file_size+=blocksize;
- file_recovery.file_size_on_disk+=blocksize;
if(res==DC_STOP || res==DC_ERROR)
{
/* EOF found */
diff --git a/src/photorec.c b/src/photorec.c
index 6384576..65a8746 100644
--- a/src/photorec.c
+++ b/src/photorec.c
@@ -571,7 +571,6 @@ static void file_finish_aux(file_recovery_t *file_recovery, struct ph_param *par
(long long unsigned) file_recovery->file_size,
(long long unsigned) file_recovery->min_filesize);
file_recovery->file_size=0;
- file_recovery->file_size_on_disk=0;
}
if(file_recovery->file_size==0)
{
diff --git a/src/psearchn.c b/src/psearchn.c
index 536feb7..9c9ffa1 100644
--- a/src/psearchn.c
+++ b/src/psearchn.c
@@ -268,12 +268,11 @@ pstatus_t photorec_aux(struct ph_param *params, const struct ph_options *options
{
/* try to skip ext2/ext3 indirect block */
if((params->status==STATUS_EXT2_ON || params->status==STATUS_EXT2_ON_SAVE_EVERYTHING) &&
- file_recovery.file_size_on_disk>=12*blocksize &&
+ file_recovery.file_size >= 12*blocksize &&
ind_block(buffer,blocksize)!=0)
{
file_block_append(&file_recovery, list_search_space, &current_search_space, &offset, blocksize, 0);
res=DC_CONTINUE;
- file_recovery.file_size_on_disk+=blocksize;
if(options->verbose > 1)
{
log_verbose("Skipping sector %10lu/%lu\n",
@@ -310,7 +309,6 @@ pstatus_t photorec_aux(struct ph_param *params, const struct ph_options *options
else
res=DC_CONTINUE;
file_recovery.file_size+=blocksize;
- file_recovery.file_size_on_disk+=blocksize;
if(res==DC_STOP)
{
if(options->verbose > 1)
diff --git a/src/qphbs.cpp b/src/qphbs.cpp
index f319f72..b8b5c41 100644
--- a/src/qphbs.cpp
+++ b/src/qphbs.cpp
@@ -143,7 +143,6 @@ pstatus_t QPhotorec::photorec_find_blocksize(alloc_data_t *list_search_space)
if(file_recovery.data_check!=NULL)
res=file_recovery.data_check(buffer_olddata, 2*blocksize, &file_recovery);
file_recovery.file_size+=blocksize;
- file_recovery.file_size_on_disk+=blocksize;
if(res==DC_STOP || res==DC_ERROR)
{
/* EOF found */
diff --git a/src/qpsearch.cpp b/src/qpsearch.cpp
index 8e4e93e..166fdb5 100644
--- a/src/qpsearch.cpp
+++ b/src/qpsearch.cpp
@@ -264,12 +264,11 @@ pstatus_t QPhotorec::photorec_aux(alloc_data_t *list_search_space)
{
/* try to skip ext2/ext3 indirect block */
if((params->status==STATUS_EXT2_ON || params->status==STATUS_EXT2_ON_SAVE_EVERYTHING) &&
- file_recovery.file_size_on_disk>=12*blocksize &&
+ file_recovery.file_size >= 12*blocksize &&
ind_block(buffer,blocksize)!=0)
{
file_block_append(&file_recovery, list_search_space, &current_search_space, &offset, blocksize, 0);
res=DC_CONTINUE;
- file_recovery.file_size_on_disk+=blocksize;
if(options->verbose > 1)
{
log_verbose("Skipping sector %10lu/%lu\n",
@@ -306,7 +305,6 @@ pstatus_t QPhotorec::photorec_aux(alloc_data_t *list_search_space)
else
res=DC_CONTINUE;
file_recovery.file_size+=blocksize;
- file_recovery.file_size_on_disk+=blocksize;
if(res==DC_STOP)
{
if(options->verbose > 1)