diff --git a/src/file_doc.c b/src/file_doc.c index 6f287f91..88347b4f 100644 --- a/src/file_doc.c +++ b/src/file_doc.c @@ -684,7 +684,7 @@ static uint32_t *OLE_load_MiniFAT(FILE *IN, const struct OLE_HDR *header, const free(minifat); return NULL; } - if(OLE_read_block(IN, (char *)minifat_pos, uSectorShift, block, offset)<0) + if(OLE_read_block(IN, minifat_pos, uSectorShift, block, offset)<0) { free(minifat); return NULL; diff --git a/src/file_zip.c b/src/file_zip.c index 58feb984..6b806ebf 100644 --- a/src/file_zip.c +++ b/src/file_zip.c @@ -1212,7 +1212,7 @@ static int header_check_zip(const unsigned char *buffer, const unsigned int buff #endif /* A zip file begins by ZIP_FILE_ENTRY, this signature can also be * found for each compressed file */ - if(file_recovery->file_check == file_check_zip && + if(file_recovery->file_check == &file_check_zip && file_recovery->file_stat!=NULL && // file_recovery->file_stat->file_hint==&file_hint_zip && safe_header_only==0) diff --git a/src/filegen.c b/src/filegen.c index d8eec1a3..67d4edb2 100644 --- a/src/filegen.c +++ b/src/filegen.c @@ -325,52 +325,6 @@ void file_search_footer(file_recovery_t *file_recovery, const void*footer, const /*@ assert \valid(file_recovery->handle); */ } -/*@ - @ requires \valid(file_recovery); - @ requires footer_length > 0; - @ requires \valid_read((char *)footer+(0..footer_length-1)); - @*/ -static void file_search_lc_footer(file_recovery_t *file_recovery, const unsigned char*footer, const unsigned int footer_length) -{ - const unsigned int read_size=4096; - unsigned char*buffer; - int64_t file_size; - if(footer_length==0) - return ; - buffer=(unsigned char*)MALLOC(read_size+footer_length-1); - file_size=file_recovery->file_size; - memset(buffer+read_size,0,footer_length-1); - do - { - int i; - int taille; - if(file_size%read_size!=0) - file_size=file_size-(file_size%read_size); - else - file_size-=read_size; - if(my_fseek(file_recovery->handle,file_size,SEEK_SET)<0) - { - free(buffer); - return; - } - taille=fread(buffer,1,read_size,file_recovery->handle); - for(i=0;i=0;i--) - { - if(buffer[i]==footer[0] && memcmp(buffer+i,footer,footer_length)==0) - { - file_recovery->file_size=file_size+i+footer_length; - free(buffer); - return; - } - } - memcpy(buffer+read_size,buffer,footer_length-1); - } while(file_size>0); - file_recovery->file_size=0; - free(buffer); -} - data_check_t data_check_size(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery) { if(file_recovery->file_size + buffer_size/2 >= file_recovery->calculated_file_size)