From 9194837f07ab4bada8d2b3232331b62cee56521a Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Wed, 30 Jul 2008 09:20:33 +0200 Subject: [PATCH] PhotoRec: avoid to split mov, stricter check for m2ts, m2t, ogg anti-split check --- src/file_m2ts.c | 3 ++- src/file_mov.c | 6 ++++++ src/file_ogg.c | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/file_m2ts.c b/src/file_m2ts.c index 085ad9f2..ac12f562 100644 --- a/src/file_m2ts.c +++ b/src/file_m2ts.c @@ -82,7 +82,8 @@ static int header_check_m2ts(const unsigned char *buffer, const unsigned int buf static int header_check_m2t(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new) { if(file_recovery!=NULL && file_recovery->file_stat!=NULL && - file_recovery->file_stat->file_hint==&file_hint_m2ts) + file_recovery->file_stat->file_hint==&file_hint_m2ts && + file_recovery->calculated_file_size == file_recovery->file_size) return 0; /* Each frame is 188 byte long and begins by a TS_SYNC_BYTE */ if(buffer[0]==0x47 && buffer[188]==0x47 && buffer[2*188]==0x47 && diff --git a/src/file_mov.c b/src/file_mov.c index e2d34391..1f14001c 100644 --- a/src/file_mov.c +++ b/src/file_mov.c @@ -56,6 +56,12 @@ static int header_check_mov(const unsigned char *buffer, const unsigned int buff { unsigned int i=0; unsigned int prev_atom_skip=0; + if(file_recovery!=NULL && file_recovery->file_stat!=NULL && + file_recovery->file_stat->file_hint==&file_hint_mov && + file_recovery->calculated_file_size == file_recovery->file_size) + { /* PhotoRec is already trying to recover this mov file */ + return 0; + } while(ifile_stat!=NULL && file_recovery->file_stat->file_hint==&file_hint_ogg) + if(file_recovery!=NULL && file_recovery->file_stat!=NULL && + file_recovery->file_stat->file_hint==&file_hint_ogg && + file_recovery->calculated_file_size == file_recovery->file_size) return 0; if(memcmp(buffer,ogg_header,sizeof(ogg_header))==0) {