summaryrefslogtreecommitdiffstats
path: root/src/photorec.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-05-15 09:57:33 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-05-15 09:57:33 +0200
commit7afe29c487f68e7fe3978e3ffd10a6860953c357 (patch)
treeaac40d395f849600495e3a72e48ad9ac45d88509 /src/photorec.c
parent068c665c49be3a6f0efd23175f6e19aaff7733b6 (diff)
New function status_inc() to increment params->status
Diffstat (limited to 'src/photorec.c')
-rw-r--r--src/photorec.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/photorec.c b/src/photorec.c
index bc5b7fa..0896e3a 100644
--- a/src/photorec.c
+++ b/src/photorec.c
@@ -1023,3 +1023,51 @@ const char *status_to_name(const photorec_status_t status)
return "STATUS_QUIT";
}
}
+
+void status_inc(struct ph_param *params, const struct ph_options *options)
+{
+ params->offset=-1;
+ switch(params->status)
+ {
+ case STATUS_UNFORMAT:
+ params->status=STATUS_FIND_OFFSET;
+ break;
+ case STATUS_FIND_OFFSET:
+ params->status=(options->mode_ext2>0?STATUS_EXT2_ON:STATUS_EXT2_OFF);
+ params->file_nbr=0;
+ break;
+ case STATUS_EXT2_ON:
+ if(options->paranoid>1)
+ params->status=STATUS_EXT2_ON_BF;
+ else if(options->paranoid==1 && options->keep_corrupted_file>0)
+ params->status=STATUS_EXT2_ON_SAVE_EVERYTHING;
+ else
+ params->status=STATUS_QUIT;
+ break;
+ case STATUS_EXT2_ON_BF:
+ if(options->keep_corrupted_file>0)
+ params->status=STATUS_EXT2_ON_SAVE_EVERYTHING;
+ else
+ params->status=STATUS_QUIT;
+ break;
+ case STATUS_EXT2_OFF:
+ if(options->paranoid>1)
+ params->status=STATUS_EXT2_OFF_BF;
+ else if(options->paranoid==1 && options->keep_corrupted_file>0)
+ params->status=STATUS_EXT2_OFF_SAVE_EVERYTHING;
+ else
+ params->status=STATUS_QUIT;
+ break;
+ case STATUS_EXT2_OFF_BF:
+ if(options->keep_corrupted_file>0)
+ params->status=STATUS_EXT2_OFF_SAVE_EVERYTHING;
+ else
+ params->status=STATUS_QUIT;
+ break;
+ default:
+ params->status=STATUS_QUIT;
+ break;
+ }
+}
+
+