summaryrefslogtreecommitdiffstats
path: root/src/file_ps.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_ps.c')
-rw-r--r--src/file_ps.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/file_ps.c b/src/file_ps.c
index f572013..5551744 100644
--- a/src/file_ps.c
+++ b/src/file_ps.c
@@ -55,36 +55,33 @@ static void register_header_check_ps(file_stat_t *file_stat)
static int header_check_ps(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,ps_header,sizeof(ps_header))==0)
- { /* PS or EPSF */
- int i;
- for(i=sizeof(ps_header);i<20;i++)
+ /* PS or EPSF */
+ int i;
+ for(i=sizeof(ps_header);i<20;i++)
+ {
+ switch(buffer[i])
{
- switch(buffer[i])
- {
- case '\n':
+ case '\n':
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_ps.extension;
+ file_recovery_new->data_check=&data_check_ps;
+ file_recovery_new->file_check=&file_check_size;
+ return 1;
+ case 'E':
+ if(memcmp(&buffer[i],"EPSF-",5)==0)
+ {
reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_ps.extension;
- file_recovery_new->data_check=&data_check_ps;
- file_recovery_new->file_check=&file_check_size;
+ file_recovery_new->extension="eps";
return 1;
- case 'E':
- if(memcmp(&buffer[i],"EPSF-",5)==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension="eps";
- return 1;
- }
- break;
- }
+ }
+ break;
}
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_ps.extension;
- file_recovery_new->data_check=&data_check_ps;
- file_recovery_new->file_check=&file_check_size;
- return 1;
}
- return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_ps.extension;
+ file_recovery_new->data_check=&data_check_ps;
+ file_recovery_new->file_check=&file_check_size;
+ return 1;
}
static data_check_t data_check_ps(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)