PhotoRec: src/file_ses.c code reorganisation

This commit is contained in:
Christophe Grenier 2013-04-19 08:10:50 +02:00
parent 00e01f8727
commit 2326a5f02d

View file

@ -26,16 +26,12 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include <stdio.h>
#include "types.h"
#include "common.h"
#include "filegen.h"
static void register_header_check_ses(file_stat_t *file_stat);
static int header_check_ses(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);
const file_hint_t file_hint_ses= {
.extension="ses",
@ -47,22 +43,14 @@ const file_hint_t file_hint_ses= {
.register_header_check=&register_header_check_ses
};
static const unsigned char ses_magic[8]= {
'C', 'O', 'O', 'L', 'N', 'E', 'S', 'S'
};
static int header_check_ses(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)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_ses.extension;
return 1;
}
static void register_header_check_ses(file_stat_t *file_stat)
{
register_header_check(0, ses_magic, sizeof(ses_magic), &header_check_ses, file_stat);
}
static int header_check_ses(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(memcmp(buffer, ses_magic, sizeof(ses_magic))==0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_ses.extension;
return 1;
}
return 0;
register_header_check(0, "COOLNESS", 8, &header_check_ses, file_stat);
}